From: Richard B. <rb...@us...> - 2005-02-06 02:50:00
|
Update of /cvsroot/jcframework/Nunit/InheritedClasses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4173/InheritedClasses Modified Files: Tag: v2_0 AtomsFrameworkTests.vb SuperClassTests.vb TableA_B.vb Log Message: Extra test for collection restoration in the cache after transaction rollback. Slight fix for tableA/B classes in unit tests Index: TableA_B.vb =================================================================== RCS file: /cvsroot/jcframework/Nunit/InheritedClasses/TableA_B.vb,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -u -d -r1.4 -r1.4.2.1 --- TableA_B.vb 31 Jan 2005 22:27:19 -0000 1.4 +++ TableA_B.vb 6 Feb 2005 02:49:52 -0000 1.4.2.1 @@ -62,6 +62,14 @@ _tableBCol.ContainerObject = Me _tableCCol.ContainerObject = Me End Sub + + Private Sub _tableBCol_ObjectAdded(ByVal index As Integer, ByRef value As Object) Handles _tableBCol.ObjectAdded + Me.SetDirtyFlag() + End Sub + + Private Sub _tableBCol_ObjectRemoved(ByVal index As Integer, ByRef value As Object) Handles _tableBCol.ObjectRemoved + Me.SetDirtyFlag() + End Sub End Class Public Class TableB Index: SuperClassTests.vb =================================================================== RCS file: /cvsroot/jcframework/Nunit/InheritedClasses/SuperClassTests.vb,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -u -d -r1.5 -r1.5.2.1 --- SuperClassTests.vb 2 Jan 2005 09:41:10 -0000 1.5 +++ SuperClassTests.vb 6 Feb 2005 02:49:52 -0000 1.5.2.1 @@ -216,7 +216,7 @@ a1 = CType(cpo, A) - Assert.AreEqual(1, a1.BCol.Count, "Number of objects in collection is grater then 1") + Assert.AreEqual(1, a1.BCol.Count, "Number of objects in collection is greater then 1") End Sub End Class Index: AtomsFrameworkTests.vb =================================================================== RCS file: /cvsroot/jcframework/Nunit/InheritedClasses/AtomsFrameworkTests.vb,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -u -d -r1.11 -r1.11.2.1 --- AtomsFrameworkTests.vb 2 Feb 2005 05:09:03 -0000 1.11 +++ AtomsFrameworkTests.vb 6 Feb 2005 02:49:52 -0000 1.11.2.1 @@ -446,5 +446,44 @@ Assert.AreEqual("2b", CType(a1.TableBCollection.Item(1), TableB).Id) End Sub + <Test()> Public Sub CheckCacheAfterRollback3() + 'Check that null collections are correctly handled + Dim a As New TableA + Dim b As New TableB + Dim a1 As New TableA + a.Id = "aa1a" + a.TableBCollection = Nothing + a.TableCCollection = Nothing + a.Save() + Assert.IsNull(a.TableBCollection) + pbroker.startTransaction() + a1.Id = "aa1a" + a1.Retrieve() + a1.TableBCollection = New CPersistentCollection + b.Id = "b1b" + b.TableA = a1 + a1.TableBCollection.Add(b) + Assert.AreEqual(1, a1.TableBCollection.Count) + a1.Save() + a1 = New TableA + a1.Id = "aa1a" + a1.Retrieve() + b = New TableB + b.Id = "b1b" + b.Retrieve() + Assert.IsTrue(b.Persistent) + Assert.AreEqual(1, a1.TableBCollection.Count) + 'Now abort the transaction + pbroker.rollback() + a1 = New TableA + a1.Id = "aa1a" + a1.Retrieve() + b = New TableB + b.Id = "b1b" + b.Retrieve() + Assert.IsFalse(b.Persistent) + Assert.IsNull(a1.TableBCollection) + End Sub + End Class End Namespace \ No newline at end of file |