Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
31 | 2 | 3 | 0.978 | class_member_declaration |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 31 | 12 | src/NHibernate.Test/NHSpecificTest/NH1549/Fixture.cs |
2 | 31 | 45 | src/NHibernate.Test/NHSpecificTest/NH1549/Fixture.cs |
| ||||
/// <summary> /// Verifies that an entity with a base class containing the id property /// can have the id accessed without loading the entity /// </summary> [Test] public void CanLoadForEntitiesWithInheritedIds() { //create some related products var category = new CategoryWithInheritedId { Name = "Fruit" } ; var product = new ProductWithInheritedId { CategoryWithInheritedId = category } ; using (ISession session = OpenSession()) { using (ITransaction trans = session.BeginTransaction()) { session.Save(category); session.Save(product); trans.Commit(); } } ProductWithInheritedId restoredProductWithInheritedId; //restore the product from the db in another session so that //the association is a proxy using (ISession session = OpenSession()) { restoredProductWithInheritedId = session.Get < ProductWithInheritedId > (product.Id); } //verify that the category is a proxy Assert.IsFalse(NHibernateUtil.IsInitialized(restoredProductWithInheritedId.CategoryWithInheritedId)); //we should be able to access the id of the category outside of the session Assert.AreEqual(category.Id, restoredProductWithInheritedId.CategoryWithInheritedId.Id); } |
| ||||
[Test] public void CanLoadForEntitiesWithTheirOwnIds() { //create some related products var category = new CategoryWithId { Name = "Fruit" } ; var product = new ProductWithId { CategoryWithId = category } ; using (ISession session = OpenSession()) { using (ITransaction trans = session.BeginTransaction()) { session.Save(category); session.Save(product); trans.Commit(); } } ProductWithId restoredProductWithInheritedId; //restore the product from the db in another session so that //the association is a proxy using (ISession session = OpenSession()) { restoredProductWithInheritedId = session.Get < ProductWithId > (product.Id); } //verify that the category is a proxy Assert.IsFalse(NHibernateUtil.IsInitialized(restoredProductWithInheritedId.CategoryWithId)); //we should be able to access the id of the category outside of the session Assert.AreEqual(category.Id, restoredProductWithInheritedId.CategoryWithId.Id); } |
| |||
/// <summary> /// Verifies that an entity with a base class containing the id property /// can have the id accessed without loading the entity /// </summary> [Test] public void [[#variable70409c00]]() { //create some related products var category = new [[#variable70bc24a0]]{ Name = "Fruit" } ; var product = new [[#variable70bc3860]]{ [[#variable70bc24a0]]= category } ; using (ISession session = OpenSession()) { using (ITransaction trans = session.BeginTransaction()) { session.Save(category); session.Save(product); trans.Commit(); } } [[#variable70bc3860]]restoredProductWithInheritedId; //restore the product from the db in another session so that //the association is a proxy using (ISession session = OpenSession()) { restoredProductWithInheritedId = session.Get < [[#variable70bc3860]]> (product.Id); } //verify that the category is a proxy Assert.IsFalse(NHibernateUtil.IsInitialized(restoredProductWithInheritedId. [[#variable70bc24a0]])); //we should be able to access the id of the category outside of the session Assert.AreEqual(category.Id, restoredProductWithInheritedId. [[#variable70bc24a0]].Id); } |
CloneAbstraction |
Parameter Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
1 | 1 | [[#70409c00]] | CanLoadForEntitiesWithInheritedIds |
1 | 2 | [[#70409c00]] | CanLoadForEntitiesWithTheirOwnIds |
2 | 1 | [[#70bc24a0]] | CategoryWithInheritedId |
2 | 2 | [[#70bc24a0]] | CategoryWithId |
3 | 1 | [[#70bc3860]] | ProductWithInheritedId |
3 | 2 | [[#70bc3860]] | ProductWithId |