2009-06-25 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Thu, 25 Jun 2009 20:55:57 +0000 (20:55 -0000)
committerZoltan Varga <vargaz@gmail.com>
Thu, 25 Jun 2009 20:55:57 +0000 (20:55 -0000)
* *.cs: Convert all tests to new-style nunit classes/methods.

svn path=/trunk/mcs/; revision=136887

mcs/class/corlib/Test/System.Runtime.Serialization/ArraySerializationTest.cs
mcs/class/corlib/Test/System.Runtime.Serialization/ChangeLog
mcs/class/corlib/Test/System.Runtime.Serialization/FormatterServicesTests.cs
mcs/class/corlib/Test/System.Runtime.Serialization/ObjectIDGeneratorTests.cs

index 05179fa832de2a8c7842f4009021100068622010..24cfa5d1037109308e00aaad8c23d616e08e8e85 100644 (file)
@@ -189,9 +189,9 @@ namespace MonoTests.System.Runtime.Serialization
                
                void CompareArrays (string txt, Array a1, Array a2)
                {
-                       Assertion.AssertEquals (txt + " length", a1.Length, a2.Length);
+                       Assert.AreEqual (a1.Length, a2.Length, txt + " length");
                        for (int n=0; n<a1.Length; n++)
-                               Assertion.AssertEquals (txt + " [" + n + "]", a1.GetValue (n), a2.GetValue (n));
+                               Assert.AreEqual (a1.GetValue (n), a2.GetValue (n), txt + " [" + n + "]");
                }
        }
 }
index 14b112f05bfe2ce32935d146f61c42e89a24eb05..a5aa0929dcddf24d057eee96d46acd9ce99d30f3 100644 (file)
@@ -1,3 +1,7 @@
+2009-06-25  Zoltan Varga  <vargaz@gmail.com>
+
+       * *.cs: Convert all tests to new-style nunit classes/methods.
+
 2009-02-04  Zoltan Varga  <vargaz@gmail.com>
 
        * SerializationCallbackTest.cs: Make a few tests quiet.
index 429068e73ad44f07b25e77ea480205f5d01cf9a1..0374b64daacbd920dce60c8e253d8d92747c0093 100644 (file)
@@ -14,30 +14,30 @@ using System.Runtime.Serialization;
 
 namespace MonoTests.System.Runtime.Serialization
 {
-       public class FormatterServicesTests : TestCase
+       public class FormatterServicesTests
        {
                public void TestClass1 ()
                {
                        DerivedClass1 derived = new DerivedClass1 ();
                        derived.anotherInt = 69;
                        MemberInfo [] members = FormatterServices.GetSerializableMembers (derived.GetType ());
-                       Assert ("#01", members != null);
-                       AssertEquals ("#02", 3, members.Length);
+                       Assert.IsTrue (members != null, "#01");
+                       Assert.AreEqual (3, members.Length, "#02");
 
                        object [] data = FormatterServices.GetObjectData (derived, members);
-                       Assert ("#03", data != null);
-                       AssertEquals ("#04", 3, data.Length);
+                       Assert.IsTrue (data != null, "#03");
+                       Assert.AreEqual (3, data.Length, "#04");
 
                        DerivedClass1 o = (DerivedClass1) FormatterServices.GetUninitializedObject (derived.GetType ());
-                       Assert ("#05", o != null);
+                       Assert.IsTrue (o != null, "#05");
 
                        o = (DerivedClass1) FormatterServices.PopulateObjectMembers (o, members, data);
-                       Assert ("#06", o != null);
-                       AssertEquals ("#07", "hola", o.Hello);
-                       AssertEquals ("#08", 21, o.IntBase);
-                       AssertEquals ("#09", 1, o.IntDerived);
-                       AssertEquals ("#10", 69, o.anotherInt);
-                       AssertEquals ("#11", "hey", DerivedClass1.hey);
+                       Assert.IsTrue (o != null, "#06");
+                       Assert.AreEqual ("hola", o.Hello, "#07");
+                       Assert.AreEqual (21, o.IntBase, "#08");
+                       Assert.AreEqual (1, o.IntDerived, "#09");
+                       Assert.AreEqual (69, o.anotherInt, "#10");
+                       Assert.AreEqual ("hey", DerivedClass1.hey, "#11");
                }
        }
 
index d15ffd3cafbf98880d18cd8f0eb3e83aa9047a4a..68f91b3058f0510e32a8ae55f1d4c5e74ac79429 100644 (file)
@@ -14,7 +14,7 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Runtime.Serialization
 {
-       public class ObjectIDGeneratorTests : TestCase
+       public class ObjectIDGeneratorTests
        {
                ObjectIDGenerator generator;
 
@@ -22,7 +22,8 @@ namespace MonoTests.System.Runtime.Serialization
                int obj2 = 42;          
                long id;
 
-               protected override void SetUp ()
+               [SetUp]
+               protected void SetUp ()
                {
                        generator = new ObjectIDGenerator ();
                }
@@ -35,8 +36,8 @@ namespace MonoTests.System.Runtime.Serialization
                        bool testBool1;
                        id = generator.GetId (obj1, out testBool1);
 
-                       AssertEquals ("A1", 1L, id); // should start at 1
-                       AssertEquals ("A2", true, testBool1);   // firstTime should be true
+                       Assert.AreEqual (1L, id); // should start at 1, "A1");
+                       Assert.AreEqual (true, testBool1);      // firstTime should be true, "A2");
                }
 
                //
@@ -49,8 +50,8 @@ namespace MonoTests.System.Runtime.Serialization
                        id = generator.GetId (obj1, out testBool1);
                        long testId1 = generator.GetId (obj1, out testBool2);
 
-                       AssertEquals ("B1", testId1, id); // same object, same ID
-                       AssertEquals ("B2", false, testBool2); // no longer firstTime
+                       Assert.AreEqual (testId1, id); // same object, same ID, "B1");
+                       Assert.AreEqual (false, testBool2); // no longer firstTime, "B2");
                }
 
                //
@@ -63,8 +64,8 @@ namespace MonoTests.System.Runtime.Serialization
                        id = generator.GetId (obj1, out testBool1);
                        long testId2 = generator.HasId (obj1, out testBool3);
 
-                       AssertEquals ("C1", false, testBool3); // this has been inserted before
-                       AssertEquals ("C2", id, testId2); // we should get the same ID
+                       Assert.AreEqual (false, testBool3); // this has been inserted before, "C1");
+                       Assert.AreEqual (id, testId2); // we should get the same ID, "C2");
                }
 
                //
@@ -75,8 +76,8 @@ namespace MonoTests.System.Runtime.Serialization
                        bool testBool4;
                        long testId3 = generator.HasId (obj2, out testBool4);
 
-                       AssertEquals ("D1", 0L, testId3);
-                       AssertEquals ("D2", true, testBool4);
+                       Assert.AreEqual (0L, testId3, "D1");
+                       Assert.AreEqual (true, testBool4, "D2");
                }
        }
 }