Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
36 | 2 | 3 | 0.988 | class_member_declaration |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 36 | 79 | src/NHibernate.Test/Events/PostEvents/PostUpdateFixture.cs |
2 | 38 | 117 | 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]; } |
| ||||
[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]; } |
| |||
[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 Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
1 | 1 | [[#50203240]] | WithDetachedObject |
1 | 2 | [[#50203240]] | UpdateDetachedObject |
2 | 1 | [[#502031a0]] | Is.Not |
2 | 2 | [[#502031a0]] | Is |
3 | 1 | [[#50203100]] | Merge |
3 | 2 | [[#50203100]] | Update |