From: Richard B. <rb...@us...> - 2005-02-07 22:07:34
|
Update of /cvsroot/jcframework/Nunit/InheritedClasses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28478/InheritedClasses Modified Files: AtomsFrameworkTests.vb Log Message: Extra unit test for collections and transaction rollbacks Also change to XML file to use providers instead of classes Index: AtomsFrameworkTests.vb =================================================================== RCS file: /cvsroot/jcframework/Nunit/InheritedClasses/AtomsFrameworkTests.vb,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- AtomsFrameworkTests.vb 6 Feb 2005 02:45:19 -0000 1.12 +++ AtomsFrameworkTests.vb 7 Feb 2005 22:07:16 -0000 1.13 @@ -485,5 +485,60 @@ Assert.IsNull(a1.TableBCollection) End Sub - End Class + <Test()> Public Sub CheckCacheAfterRollback4() + 'Add and remove items in the collection during the transaction + Dim a As New TableA + Dim b As New TableB + Dim a1 As New TableA + a.Id = "aa4" + b.Id = "bb41" + b.TableA = a + a.TableBCollection.Add(b) + b = New TableB + b.Id = "bb42" + b.TableA = a + a.TableBCollection.Add(b) + a.Save() + Assert.AreEqual(2, a.TableBCollection.Count) + pbroker.startTransaction() + a1.Id = "aa4" + a1.Retrieve() + Assert.AreEqual(2, a1.TableBCollection.Count) + b = New TableB + b.Id = "bb43" + b.TableA = a + a.TableBCollection.Add(b) + b = New TableB + b.Id = "bb44" + b.TableA = a + a.TableBCollection.Add(b) + b = a.TableBCollection.Item(1) + Assert.AreEqual("bb42", b.Id) + a.TableBCollection.Remove(1) + b.Delete() + Assert.AreEqual(3, a.TableBCollection.Count) + a.Save() + a1 = New TableA + a1.Id = "aa4" + a1.Retrieve() + b = New TableB + b.Id = "bb42" + b.Retrieve() + Assert.IsFalse(b.Persistent) + Assert.AreEqual(3, a1.TableBCollection.Count) + 'Now abort the transaction + pbroker.rollback() + a1 = New TableA + a1.Id = "aa4" + a1.Retrieve() + b = New TableB + b.Id = "bb42" + b.Retrieve() + Assert.IsTrue(b.Persistent) + Assert.AreEqual(2, a1.TableBCollection.Count) + Assert.AreEqual("bb42", CType(a1.TableBCollection.Item(1), TableB).Id) + End Sub + + + End Class End Namespace \ No newline at end of file |