* *.cs: Convert all tests to new-style nunit classes/methods.
svn path=/trunk/mcs/; revision=136887
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 + "]");
}
}
}
+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.
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");
}
}
namespace MonoTests.System.Runtime.Serialization
{
- public class ObjectIDGeneratorTests : TestCase
+ public class ObjectIDGeneratorTests
{
ObjectIDGenerator generator;
int obj2 = 42;
long id;
- protected override void SetUp ()
+ [SetUp]
+ protected void SetUp ()
{
generator = new ObjectIDGenerator ();
}
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");
}
//
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");
}
//
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");
}
//
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");
}
}
}