From: Richard B. <rb...@us...> - 2005-02-10 22:43:06
|
Update of /cvsroot/jcframework/Nunit/InheritedClasses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23935/InheritedClasses Modified Files: Tag: v2_0 AtomsFrameworkTests.vb Log Message: Unit test for checking collection of cached objects after rollback Index: AtomsFrameworkTests.vb =================================================================== RCS file: /cvsroot/jcframework/Nunit/InheritedClasses/AtomsFrameworkTests.vb,v retrieving revision 1.11.2.2 retrieving revision 1.11.2.3 diff -u -d -r1.11.2.2 -r1.11.2.3 --- AtomsFrameworkTests.vb 7 Feb 2005 22:05:52 -0000 1.11.2.2 +++ AtomsFrameworkTests.vb 10 Feb 2005 22:42:56 -0000 1.11.2.3 @@ -539,6 +539,45 @@ Assert.AreEqual("bb42", CType(a1.TableBCollection.Item(1), TableB).Id) End Sub + <Test()> Public Sub CheckCacheAfterRollback5() + 'Modify but don't save an object during a transaction + Dim a As New TableA + Dim b As New TableB + Dim a1 As New TableA + a.Id = "aa5" + b.Id = "bb51" + b.TableA = a + a.TableBCollection.Add(b) + b = New TableB + b.Id = "bb52" + b.TableA = a + a.TableBCollection.Add(b) + a.Save() + Assert.AreEqual(2, a.TableBCollection.Count) + pbroker.startTransaction() + a1.Id = "aa5" + a1.Retrieve() + Assert.AreEqual(2, a1.TableBCollection.Count) + b = New TableB + b.Id = "bb53" + b.TableA = a + a.TableBCollection.Add(b) + b = New TableB + b.Id = "bb54" + b.TableA = a + a.TableBCollection.Add(b) + b = a.TableBCollection.Item(1) + Assert.AreEqual("bb52", b.Id) + a.TableBCollection.Remove(1) + Assert.AreEqual(3, a.TableBCollection.Count) + 'Now abort the transaction + pbroker.rollback() + a1 = New TableA + a1.Id = "aa5" + a1.Retrieve() 'Will get from cache + Assert.AreEqual(2, a1.TableBCollection.Count) + Assert.AreEqual("bb52", CType(a1.TableBCollection.Item(1), TableB).Id) + End Sub End Class End Namespace \ No newline at end of file |