CloneSet170


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
36230.988class_member_declaration
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
13679
src/NHibernate.Test/Events/PostEvents/PostUpdateFixture.cs
238117
src/NHibernate.Test/Events/PostEvents/PostUpdateFixture.cs
Clone Instance
1
Line Count
36
Source Line
79
Source File
src/NHibernate.Test/Events/PostEvents/PostUpdateFixture.cs

                [Test]
                public void WithDetachedObject()
                {
                        ((SessionFactoryImpl) sessions).EventListeners.PostUpdateEventListeners = new IPostUpdateEventListener[]
                                                                                                        {
                                                                                                                new AssertOldStatePostListener(
                                                                                                                        eArgs =>
                                                                                                                        Assert.That(eArgs.OldState, Is.Not.Null))
                                                                                                        } ;
                        FillDb();
                        SimpleEntity toModify;
                        using (ISession s = OpenSession())
                        {
                                using (ITransaction tx = s.BeginTransaction())
                                {
                                        IList<SimpleEntity> l = s.CreateCriteria<SimpleEntity> ().List<SimpleEntity> ();
                                        toModify = l[0];
                                        tx.Commit();
                                }
                        }
                        toModify.Description = "Modified";
                        using ( var ls = new LogSpy( typeof( AssertOldStatePostListener)))
                        {
                                using (ISession s = OpenSession())
                                {
                                        using (ITransaction tx = s.BeginTransaction())
                                        {
                                                s.Merge(toModify);
                                                tx.Commit();
                                        }
                                }
                                Assert.That(ls.GetWholeLog(), Text.Contains(AssertOldStatePostListener.LogMessage));
                        }

                        DbCleanup();
                        ((SessionFactoryImpl) sessions).EventListeners.PostUpdateEventListeners = new IPostUpdateEventListener[0];
                }



Clone Instance
2
Line Count
38
Source Line
117
Source File
src/NHibernate.Test/Events/PostEvents/PostUpdateFixture.cs

                [Test]
                public void UpdateDetachedObject()
                {
                        // When the update is used directly as method to reattach a entity the OldState is null
                        // that mean that NH should not retrieve info from DB
                        ((SessionFactoryImpl) sessions).EventListeners.PostUpdateEventListeners = new IPostUpdateEventListener[]
                                                                                                        {
                                                                                                                new AssertOldStatePostListener(
                                                                                                                        eArgs =>
                                                                                                                        Assert.That(eArgs.OldState, Is.Null))
                                                                                                        } ;
                        FillDb();
                        SimpleEntity toModify;
                        using (ISession s = OpenSession())
                        {
                                using (ITransaction tx = s.BeginTransaction())
                                {
                                        IList<SimpleEntity> l = s.CreateCriteria<SimpleEntity> ().List<SimpleEntity> ();
                                        toModify = l[0];
                                        tx.Commit();
                                }
                        }
                        toModify.Description = "Modified";
                        using ( var ls = new LogSpy( typeof( AssertOldStatePostListener)))
                        {
                                using (ISession s = OpenSession())
                                {
                                        using (ITransaction tx = s.BeginTransaction())
                                        {
                                                s.Update(toModify);
                                                tx.Commit();
                                        }
                                }
                                Assert.That(ls.GetWholeLog(), Text.Contains(AssertOldStatePostListener.LogMessage));
                        }

                        DbCleanup();
                        ((SessionFactoryImpl) sessions).EventListeners.PostUpdateEventListeners = new IPostUpdateEventListener[0];
                }



Clone AbstractionParameter Count: 3Parameter Bindings

[Test]
public void [[#variable50203240]]()
{
   // When the update is used directly as method to reattach a entity the OldState is null
   // that mean that NH should not retrieve info from DB
   ((SessionFactoryImpl)sessions).EventListeners.PostUpdateEventListeners = new IPostUpdateEventListener[]
                                                                            {
                                                                               new AssertOldStatePostListener(eArgs => Assert.That(eArgs.OldState, [[#variable502031a0]].Null))
                                                                            } ;
   FillDb();
   SimpleEntity toModify;
   using (ISession s = OpenSession())
   {
      using (ITransaction tx = s.BeginTransaction())
      {
         IList<SimpleEntity> l = s.CreateCriteria<SimpleEntity> ().List<SimpleEntity> ();
         toModify = l[0];
         tx.Commit();
      }
   }
   toModify.Description = "Modified";
   using ( var ls = new LogSpy( typeof(AssertOldStatePostListener)))
   {
      using (ISession s = OpenSession())
      {
         using (ITransaction tx = s.BeginTransaction())
         {
            s. [[#variable50203100]](toModify);
            tx.Commit();
         }
      }
      Assert.That(ls.GetWholeLog(), Text.Contains(AssertOldStatePostListener.LogMessage));
   }
   DbCleanup();
   ((SessionFactoryImpl)sessions).EventListeners.PostUpdateEventListeners = new IPostUpdateEventListener[0];
}

 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#50203240]]
WithDetachedObject 
12[[#50203240]]
UpdateDetachedObject 
21[[#502031a0]]
Is.Not 
22[[#502031a0]]
Is 
31[[#50203100]]
Merge 
32[[#50203100]]
Update