[Mono-list] CollectionBaseTest patch

cesar@kentia.matem.unam.mx cesar@kentia.matem.unam.mx
Sun, 26 May 2002 16:13:29 -0500


Index: CollectionBaseTest.cs
===================================================================
RCS file: /mono/mcs/class/corlib/Test/System.Collections/CollectionBaseTest.cs,v
retrieving revision 1.1
diff -u -r1.1 CollectionBaseTest.cs
--- CollectionBaseTest.cs	17 Oct 2001 17:36:03 -0000	1.1
+++ CollectionBaseTest.cs	26 May 2002 21:41:45 -0000
@@ -138,14 +138,14 @@
 	public void TestCount() {

 		ConcreteCollection myCollection;

 		myCollection = new ConcreteCollection(4);

-		Assert(4 == myCollection.Count);

+		AssertEquals ("A01", 4, mycollection);

 	}

 

 	// Make sure GetEnumerator returns an object

 	public void TestGetEnumerator() {

 		ConcreteCollection myCollection;

 		myCollection = new ConcreteCollection(4);

-		Assert(null != myCollection.GetEnumerator());

+		Assert ("A02", null != myCollection.GetEnumerator());

 	}

 

 	// OnValid disallows nulls

@@ -165,15 +165,15 @@
 		numberOfItems = 3;

 		// The constructor inserts

 		myCollection = new ConcreteCollection(numberOfItems);

-		Assert(myCollection.onInsertFired);

-		Assert(myCollection.onInsertCompleteFired);

+		AssertEquals ("A03", myCollection.onInsertFired, true);

+		AssertEquals ("A04", myCollection.onInsertCompleteFired, true);

 

 		// Using the IList interface, check inserts in the middle

 		IList listObj = myCollection;

 		listObj.Insert(1, 9);

-		Assert(myCollection.onInsertIndex == 1);

-		Assert(myCollection.onInsertCompleteIndex == 1);

-		Assert(myCollection.PeekAt(1) == 9);

+		AssertEquals ("A05", myCollection.onInsertIndex, 1);

+		AssertEquals ("A06", myCollection.onInsertCompleteIndex, 1);

+		AssertEquals ("A07", myCollection.PeekAt(1), 9);

 	}

 

 	// Test Clear and it's hooks

@@ -184,9 +184,9 @@
 		numberOfItems = 1;

 		myCollection = new ConcreteCollection(numberOfItems);

 		myCollection.Clear();

-		Assert(myCollection.Count == 0);

-		Assert(myCollection.onClearFired);

-		Assert(myCollection.onClearCompleteFired);

+		AssertEquals ("A08", myCollection.Count, 0);

+		AssertEquals ("A09", myCollection.onClearFired, true);

+		AssertEquals ("A10", myCollection.onClearCompleteFired, true);

 	}

 

 	// Test RemoveAt, other removes and the hooks

@@ -202,16 +202,16 @@
 		myCollection.RemoveAt(1);

 

 		// We should see the original third one in it's place

-		Assert(myCollection.PeekAt(1) == 2);

-		Assert(myCollection.onRemoveFired);

-		Assert(myCollection.onRemoveIndex == 1);

-		Assert(myCollection.onRemoveCompleteFired);

-		Assert(myCollection.onRemoveCompleteIndex == 1);

+		AssertEquals ("A11", myCollection.PeekAt(1), 2);

+		AssertEquals ("A12", myCollection.onRemoveFired, true);

+		AssertEquals ("A13", myCollection.onRemoveIndex, 1);

+		AssertEquals ("A14", myCollection.onRemoveCompleteFired, true);

+		AssertEquals ("A15", myCollection.onRemoveCompleteIndex, 1);

 		IList listObj = myCollection;

 		listObj.Remove(0);

 		// Confirm parameters are being passed to the hooks

-		Assert(myCollection.onRemoveIndex == 0);

-		Assert(myCollection.onRemoveCompleteIndex == 0);

+		AssertEquals ("A16", myCollection.onRemoveIndex, 0);

+		AssertEquals ("A17", myCollection.onRemoveCompleteIndex, 0);

 	}

 

 	// Test the random access feature

@@ -223,13 +223,13 @@
 		myCollection = new ConcreteCollection(numberOfItems);

 		IList listObj = myCollection;

 		listObj[0] = 99;

-		Assert((int) listObj[0] == 99);

-		Assert(myCollection.onSetFired);

-		Assert(myCollection.onSetCompleteFired);

-		Assert(myCollection.onSetOldValue == 0);

-		Assert(myCollection.onSetCompleteOldValue == 0);

-		Assert(myCollection.onSetNewValue == 99);

-		Assert(myCollection.onSetCompleteNewValue == 99);

+		AssertEquals ("A18", (int) listObj[0], 99);

+		AssertEquals ("A19", myCollection.onSetFired, true);

+		AssertEquals ("A20", myCollection.onSetCompleteFired, true);

+		AssertEquals ("A21", myCollection.onSetOldValue, 0);

+		AssertEquals ("A22", myCollection.onSetCompleteOldValue, 0);

+		AssertEquals ("A23", myCollection.onSetNewValue, 99);

+		AssertEquals ("A24", myCollection.onSetCompleteNewValue, 99);

 	}

 }