CloneSet324


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
31230.978class_member_declaration
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
13112
src/NHibernate.Test/NHSpecificTest/NH1549/Fixture.cs
23145
src/NHibernate.Test/NHSpecificTest/NH1549/Fixture.cs
Clone Instance
1
Line Count
31
Source Line
12
Source File
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);
                }



Clone Instance
2
Line Count
31
Source Line
45
Source File
src/NHibernate.Test/NHSpecificTest/NH1549/Fixture.cs

                [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);
                }



Clone AbstractionParameter Count: 3Parameter Bindings

/// <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 Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#70409c00]]
CanLoadForEntitiesWithInheritedIds 
12[[#70409c00]]
CanLoadForEntitiesWithTheirOwnIds 
21[[#70bc24a0]]
CategoryWithInheritedId 
22[[#70bc24a0]]
CategoryWithId 
31[[#70bc3860]]
ProductWithInheritedId 
32[[#70bc3860]]
ProductWithId