2009-06-24 Robert Jordan <robertj@gmx.net>
[mono.git] / mcs / class / corlib / Test / System.Collections / HashtableTest.cs
index a20b63876dfeb5f06369473dacc81a68111bd76c..109bcbf84d430235fabf08c9af196d8c6452080d 100644 (file)
@@ -23,12 +23,12 @@ namespace MonoTests.System.Collections {
 \r
 /// <summary>Hashtable test.</summary>\r
 [TestFixture]\r
-public class HashtableTest : Assertion {\r
+public class HashtableTest {\r
 \r
         [Test]\r
        public void TestCtor1() {\r
                Hashtable h = new Hashtable();\r
-               AssertNotNull("No hash table", h);\r
+               Assert.IsNotNull (h, "No hash table");\r
        }\r
 \r
         [Test]\r
@@ -40,8 +40,7 @@ public class HashtableTest : Assertion {
                        } catch (ArgumentNullException) {\r
                                errorThrown = true;\r
                        }\r
-                       Assert("null hashtable error not thrown", \r
-                              errorThrown);\r
+                       Assert.IsTrue (errorThrown, "null hashtable error not thrown");\r
                }\r
                {\r
                        string[] keys = {"this", "is", "a", "test"};\r
@@ -52,8 +51,7 @@ public class HashtableTest : Assertion {
                        }\r
                        Hashtable h2 = new Hashtable(h1);\r
                        for (int i = 0; i < keys.Length; i++) {\r
-                               AssertEquals("No match for key " + keys[i],\r
-                                            values[i], h2[keys[i]]);\r
+                               Assert.AreEqual (values[i], h2[keys[i]], "No match for key " + keys[i]);\r
                        }\r
                }\r
        }\r
@@ -79,29 +77,29 @@ public class HashtableTest : Assertion {
                // tests if negative capacity throws exception\r
                try {\r
                        Hashtable ht = new Hashtable (-10, 0.1f, null, null);\r
-                       Assert("must throw ArgumentOutOfRange exception, param: capacity", false);\r
+                       Assert.Fail ("must throw ArgumentOutOfRange exception, param: capacity");\r
                } catch (ArgumentOutOfRangeException e) {\r
-                       Assert("ParamName is not capacity", e.ParamName == "capacity");\r
+                       Assert.IsTrue (e.ParamName == "capacity", "ParamName is not capacity");\r
                }\r
 \r
                // tests if loadFactor out of range throws exception (low)\r
                try {\r
                        Hashtable ht = new Hashtable (100, 0.01f, null, null);\r
-                       Assert("must throw ArgumentOutOfRange exception, param: loadFactor, too low value", false);\r
+                       Assert.Fail ("must throw ArgumentOutOfRange exception, param: loadFactor, too low value");\r
                }       catch (ArgumentOutOfRangeException e) \r
                {\r
-                       Assert("ParamName is not loadFactor",e.ParamName == "loadFactor");\r
+                       Assert.IsTrue (e.ParamName == "loadFactor", "ParamName is not loadFactor");\r
                }\r
 \r
                // tests if loadFactor out of range throws exception (high)\r
                try \r
                {\r
                        Hashtable ht = new Hashtable (100, 2f, null, null);\r
-                       Assert("must throw ArgumentOutOfRange exception, param: loadFactor, too high value", false);\r
+                       Assert.Fail ("must throw ArgumentOutOfRange exception, param: loadFactor, too high value");\r
                }       \r
                catch (ArgumentOutOfRangeException e) \r
                {\r
-                       Assert("ParamName is not loadFactor", e.ParamName == "loadFactor");\r
+                       Assert.IsTrue (e.ParamName == "loadFactor", "ParamName is not loadFactor");\r
                }\r
 \r
        }\r
@@ -112,32 +110,28 @@ public class HashtableTest : Assertion {
         [Test] \r
        public void TestCount() {\r
                Hashtable h = new Hashtable();\r
-               AssertEquals("new table - count zero", 0, h.Count);\r
+               Assert.AreEqual (0, h.Count, "new table - count zero");\r
                int max = 100;\r
                for (int i = 1; i <= max; i++) {\r
                        h[i] = i;\r
-                       AssertEquals("Count wrong for " + i,\r
-                                    i, h.Count);\r
+                       Assert.AreEqual (i, h.Count, "Count wrong for " + i);\r
                }\r
                for (int i = 1; i <= max; i++) {\r
                        h[i] = i * 2;\r
-                       AssertEquals("Count shouldn't change at " + i,\r
-                                    max, h.Count);\r
+                       Assert.AreEqual (max, h.Count, "Count shouldn't change at " + i);\r
                }\r
        }\r
 \r
         [Test]        \r
        public void TestIsFixedSize() {\r
                Hashtable h = new Hashtable();\r
-               AssertEquals("hashtable not fixed by default",\r
-                            false, h.IsFixedSize);\r
+               Assert.AreEqual (false, h.IsFixedSize, "hashtable not fixed by default");\r
                // TODO - any way to get a fixed-size hashtable?\r
        }\r
 \r
        public void TestIsReadOnly() {\r
                Hashtable h = new Hashtable();\r
-               AssertEquals("hashtable not read-only by default",\r
-                            false, h.IsReadOnly);\r
+               Assert.AreEqual (false, h.IsReadOnly, "hashtable not read-only by default");\r
                // TODO - any way to get a read-only hashtable?\r
        }\r
 \r
@@ -145,13 +139,13 @@ public class HashtableTest : Assertion {
        public void TestIsSynchronized ()\r
        {\r
                Hashtable h = new Hashtable ();\r
-               Assert ("hashtable not synched by default", !h.IsSynchronized);\r
+               Assert.IsTrue (!h.IsSynchronized, "hashtable not synched by default");\r
 \r
                Hashtable h2 = Hashtable.Synchronized (h);\r
-               Assert ("hashtable should by synched", h2.IsSynchronized);\r
+               Assert.IsTrue (h2.IsSynchronized, "hashtable should by synched");\r
 \r
                Hashtable h3 = (Hashtable) h2.Clone ();\r
-               Assert ("Cloned Hashtable should by synched", h3.IsSynchronized);\r
+               Assert.IsTrue (h3.IsSynchronized, "Cloned Hashtable should by synched");\r
        }\r
 \r
         [Test]\r
@@ -163,10 +157,9 @@ public class HashtableTest : Assertion {
                                Object o = h[null];\r
                        } catch (ArgumentNullException e) {\r
                                errorThrown = true;\r
-                               AssertEquals("ParamName is not \"key\"", "key", e.ParamName);\r
+                               Assert.AreEqual ("key", e.ParamName, "ParamName is not \"key\"");\r
                        }\r
-                       Assert("null hashtable error not thrown", \r
-                              errorThrown);\r
+                       Assert.IsTrue (errorThrown, "null hashtable error not thrown");\r
                }\r
                // TODO - if read-only and/or fixed-size is possible,\r
                //        test 'NotSupportedException' here\r
@@ -176,8 +169,7 @@ public class HashtableTest : Assertion {
                        int max = 100;\r
                        for (int i = 1; i <= max; i++) {\r
                                h[i] = i;\r
-                               AssertEquals("value wrong for " + i,\r
-                                            i, h[i]);\r
+                               Assert.AreEqual (i, h[i], "value wrong for " + i);\r
                        }\r
                }\r
        }\r
@@ -193,27 +185,23 @@ public class HashtableTest : Assertion {
                for (int i = 0; i < keys.Length; i++) {\r
                        h1[keys[i]] = values1[i];\r
                }\r
-               AssertEquals("keys wrong size",\r
-                            keys.Length, h1.Keys.Count);\r
+               Assert.AreEqual (keys.Length, h1.Keys.Count, "keys wrong size");\r
                for (int i = 0; i < keys.Length; i++) {\r
                        h1[keys[i]] = values2[i];\r
                }\r
-               AssertEquals("keys wrong size 2",\r
-                            keys.Length, h1.Keys.Count);\r
+               Assert.AreEqual (keys.Length, h1.Keys.Count, "keys wrong size 2");\r
 \r
                // MS .NET Always returns the same reference when calling Keys property\r
                keysReference = h1.Keys;\r
            keysReference2 = h1.Keys;\r
-               AssertEquals("keys references differ", keysReference, keysReference2);\r
+               Assert.AreEqual (keysReference, keysReference2, "keys references differ");\r
 \r
                for (int i = 0; i < keys2.Length; i++) \r
                {\r
                        h1[keys2[i]] = values2[i];\r
                }\r
-               AssertEquals("keys wrong size 3",\r
-                       keys.Length+keys2.Length, h1.Keys.Count);\r
-               AssertEquals("keys wrong size 4",\r
-                       keys.Length+keys2.Length, keysReference.Count);\r
+               Assert.AreEqual (keys.Length+keys2.Length, h1.Keys.Count, "keys wrong size 3");\r
+               Assert.AreEqual (keys.Length+keys2.Length, keysReference.Count, "keys wrong size 4");\r
        }\r
 \r
        // TODO - SyncRoot\r
@@ -226,18 +214,16 @@ public class HashtableTest : Assertion {
                for (int i = 0; i < keys.Length; i++) {\r
                        h1[keys[i]] = values1[i];\r
                }\r
-               AssertEquals("values wrong size",\r
-                            keys.Length, h1.Values.Count);\r
+               Assert.AreEqual (keys.Length, h1.Values.Count, "values wrong size");\r
                for (int i = 0; i < keys.Length; i++) {\r
                        h1[keys[i]] = values2[i];\r
                }\r
-               AssertEquals("values wrong size 2",\r
-                            keys.Length, h1.Values.Count);\r
+               Assert.AreEqual (keys.Length, h1.Values.Count, "values wrong size 2");\r
 \r
                // MS .NET Always returns the same reference when calling Values property\r
                ICollection valuesReference1 = h1.Values;\r
                ICollection valuesReference2 = h1.Values;\r
-               AssertEquals("values references differ", valuesReference1, valuesReference2);\r
+               Assert.AreEqual (valuesReference1, valuesReference2, "values references differ");\r
        }\r
 \r
        [Test]\r
@@ -249,10 +235,9 @@ public class HashtableTest : Assertion {
                                h.Add(null, "huh?");\r
                        } catch (ArgumentNullException e) {\r
                                errorThrown = true;\r
-                               AssertEquals("ParamName is not 'key'", "key", e.ParamName);\r
+                               Assert.AreEqual ("key", e.ParamName, "ParamName is not 'key'");\r
                        }\r
-                       Assert("null add error not thrown", \r
-                              errorThrown);\r
+                       Assert.IsTrue (errorThrown, "null add error not thrown");\r
                }\r
                {\r
                        bool errorThrown = false;\r
@@ -263,8 +248,7 @@ public class HashtableTest : Assertion {
                        } catch (ArgumentException) {\r
                                errorThrown = true;\r
                        }\r
-                       Assert("re-add error not thrown", \r
-                              errorThrown);\r
+                       Assert.IsTrue (errorThrown, "re-add error not thrown");\r
                }\r
                // TODO - hit NotSupportedException\r
                {\r
@@ -272,8 +256,7 @@ public class HashtableTest : Assertion {
                        int max = 100;\r
                        for (int i = 1; i <= max; i++) {\r
                                h.Add(i, i);\r
-                               AssertEquals("value wrong for " + i,\r
-                                            i, h[i]);\r
+                               Assert.AreEqual (i, h[i], "value wrong for " + i);\r
                        }\r
                }\r
        }\r
@@ -282,15 +265,14 @@ public class HashtableTest : Assertion {
        public void TestClear() {\r
                // TODO - hit NotSupportedException\r
                Hashtable h = new Hashtable();\r
-               AssertEquals("new table - count zero", 0, h.Count);\r
+               Assert.AreEqual (0, h.Count, "new table - count zero");\r
                int max = 100;\r
                for (int i = 1; i <= max; i++) {\r
                        h[i] = i;\r
                }\r
-               Assert("table don't gots stuff", h.Count > 0);\r
+               Assert.IsTrue (h.Count > 0, "table don't gots stuff");\r
                h.Clear();\r
-               AssertEquals("Table should be cleared",\r
-                            0, h.Count);\r
+               Assert.AreEqual (0, h.Count, "Table should be cleared");\r
        }\r
 \r
 #if NET_2_0\r
@@ -316,11 +298,10 @@ public class HashtableTest : Assertion {
                                h1[c1[i]] = c2[i];\r
                        }\r
                        Hashtable h2 = (Hashtable)h1.Clone();\r
-                       AssertNotNull("got no clone!", h2);\r
-                       AssertNotNull("clone's got nothing!", h2[c1[0]]);\r
+                       Assert.IsNotNull (h2, "got no clone!");\r
+                       Assert.IsNotNull (h2[c1[0]], "clone's got nothing!");\r
                        for (int i = 0; i < c1.Length; i++) {\r
-                               AssertEquals("Hashtable match", \r
-                                            h1[c1[i]], h2[c1[i]]);\r
+                               Assert.AreEqual (h1[c1[i]], h2[c1[i]], "Hashtable match");\r
                        }\r
                }\r
                {\r
@@ -334,15 +315,14 @@ public class HashtableTest : Assertion {
                                h1[c1[i]] = c2[i];\r
                        }\r
                        Hashtable h2 = (Hashtable)h1.Clone();\r
-                       AssertNotNull("got no clone!", h2);\r
-                       AssertNotNull("clone's got nothing!", h2[c1[0]]);\r
+                       Assert.IsNotNull (h2, "got no clone!");\r
+                       Assert.IsNotNull (h2[c1[0]], "clone's got nothing!");\r
                        for (int i = 0; i < c1.Length; i++) {\r
-                               AssertEquals("Hashtable match", \r
-                                            h1[c1[i]], h2[c1[i]]);\r
+                               Assert.AreEqual (h1[c1[i]], h2[c1[i]], "Hashtable match");\r
                        }\r
 \r
                        ((char[])h1[c1[0]])[0] = 'z';\r
-                       AssertEquals("shallow copy", h1[c1[0]], h2[c1[0]]);\r
+                       Assert.AreEqual (h1[c1[0]], h2[c1[0]], "shallow copy");\r
 \r
 #if NET_2_0\r
                        // NET 2.0 stuff\r
@@ -351,9 +331,7 @@ public class HashtableTest : Assertion {
                        Hashtable mh1clone = (Hashtable) mh1.Clone ();\r
                        \r
                        // warning, depends on the field name.\r
-                       AssertEquals ("EqualityComparer",\r
-                               GetEqualityComparer (mh1),\r
-                               GetEqualityComparer (mh1clone));\r
+                       Assert.AreEqual (GetEqualityComparer (mh1), GetEqualityComparer (mh1clone), "EqualityComparer");\r
 #endif\r
                }\r
        }\r
@@ -367,10 +345,9 @@ public class HashtableTest : Assertion {
                                bool result = h.Contains(null);\r
                        } catch (ArgumentNullException e) {\r
                                errorThrown = true;\r
-                               AssertEquals("ParamName is not 'key'", "key", e.ParamName);\r
+                               Assert.AreEqual ("key", e.ParamName, "ParamName is not 'key'");\r
                        }\r
-                       Assert("null add error not thrown", \r
-                              errorThrown);\r
+                       Assert.IsTrue (errorThrown, "null add error not thrown");\r
                }\r
                {\r
                        Hashtable h = new Hashtable();\r
@@ -380,8 +357,8 @@ public class HashtableTest : Assertion {
                        }\r
                        for (int i = 0; i < 10000; i += 2) \r
                        {\r
-                               Assert("hashtable must contain"+i.ToString(), h.Contains(i));\r
-                               Assert("hashtable does not contain "+((int)(i+1)).ToString(), !h.Contains(i+1));\r
+                               Assert.IsTrue (h.Contains(i), "hashtable must contain"+i.ToString());\r
+                               Assert.IsTrue (!h.Contains(i+1), "hashtable does not contain "+((int)(i+1)).ToString());\r
                        }\r
                }\r
        }\r
@@ -398,10 +375,9 @@ public class HashtableTest : Assertion {
                        catch (ArgumentNullException e) \r
                        {\r
                                errorThrown = true;\r
-                               AssertEquals("ParamName is not 'key'", "key", e.ParamName);\r
+                               Assert.AreEqual ("key", e.ParamName, "ParamName is not 'key'");\r
                        }\r
-                       Assert("null add error not thrown", \r
-                               errorThrown);\r
+                       Assert.IsTrue (errorThrown, "null add error not thrown");\r
                }\r
                {\r
                        Hashtable h = new Hashtable();\r
@@ -411,8 +387,8 @@ public class HashtableTest : Assertion {
                        }\r
                        for (int i = 0; i < 1000; i += 2) \r
                        {\r
-                               Assert("hashtable must contain"+i.ToString(), h.Contains(i));\r
-                               Assert("hashtable does not contain "+((int)(i+1)).ToString(), !h.Contains(i+1));\r
+                               Assert.IsTrue (h.Contains(i), "hashtable must contain"+i.ToString());\r
+                               Assert.IsTrue (!h.Contains(i+1), "hashtable does not contain "+((int)(i+1)).ToString());\r
                        }\r
                }\r
 \r
@@ -423,15 +399,11 @@ public class HashtableTest : Assertion {
                {\r
                        Hashtable h = new Hashtable();\r
                        h['a'] = "blue";\r
-                       Assert("blue? it's in there!", \r
-                              h.ContainsValue("blue"));\r
-                       Assert("green? no way!", \r
-                              !h.ContainsValue("green"));\r
-                       Assert("null? no way!", \r
-                               !h.ContainsValue(null));\r
+                       Assert.IsTrue (h.ContainsValue("blue"), "blue? it's in there!");\r
+                       Assert.IsTrue (!h.ContainsValue("green"), "green? no way!");\r
+                       Assert.IsTrue (!h.ContainsValue(null), "null? no way!");\r
                        h['b'] = null;\r
-                       Assert("null? it's in there!", \r
-                               h.ContainsValue(null));\r
+                       Assert.IsTrue (h.ContainsValue(null), "null? it's in there!");\r
 \r
                }\r
        }\r
@@ -445,10 +417,9 @@ public class HashtableTest : Assertion {
                                h.CopyTo(null, 0);\r
                        } catch (ArgumentNullException e) {\r
                                errorThrown = true;\r
-                               AssertEquals("ParamName is not \"array\"", "array", e.ParamName); \r
+                               Assert.AreEqual ("array", e.ParamName, "ParamName is not \"array\""); \r
                        }\r
-                       Assert("null hashtable error not thrown", \r
-                              errorThrown);\r
+                       Assert.IsTrue (errorThrown, "null hashtable error not thrown");\r
                }\r
                {\r
                        bool errorThrown = false;\r
@@ -458,10 +429,9 @@ public class HashtableTest : Assertion {
                                h.CopyTo(o, -1);\r
                        } catch (ArgumentOutOfRangeException e) {\r
                                errorThrown = true;\r
-                               AssertEquals("ParamName is not \"arrayIndex\"", "arrayIndex", e.ParamName);\r
+                               Assert.AreEqual ("arrayIndex", e.ParamName, "ParamName is not \"arrayIndex\"");\r
                        }\r
-                       Assert("out of range error not thrown", \r
-                              errorThrown);\r
+                       Assert.IsTrue (errorThrown, "out of range error not thrown");\r
                }\r
                {\r
                        bool errorThrown = false;\r
@@ -472,8 +442,7 @@ public class HashtableTest : Assertion {
                        } catch (ArgumentException) {\r
                                errorThrown = true;\r
                        }\r
-                       Assert("multi-dim array error not thrown", \r
-                              errorThrown);\r
+                       Assert.IsTrue (errorThrown, "multi-dim array error not thrown");\r
                }\r
                {\r
                        bool errorThrown = false;\r
@@ -485,8 +454,7 @@ public class HashtableTest : Assertion {
                        } catch (ArgumentException) {\r
                                errorThrown = true;\r
                        }\r
-                       Assert("no room in array error not thrown", \r
-                              errorThrown);\r
+                       Assert.IsTrue (errorThrown, "no room in array error not thrown");\r
                }\r
                {\r
                        bool errorThrown = false;\r
@@ -500,8 +468,7 @@ public class HashtableTest : Assertion {
                        } catch (ArgumentException) {\r
                                errorThrown = true;\r
                        }\r
-                       Assert("table too big error not thrown", \r
-                              errorThrown);\r
+                       Assert.IsTrue (errorThrown, "table too big error not thrown");\r
                }\r
                {\r
                        bool errorThrown = false;\r
@@ -515,8 +482,7 @@ public class HashtableTest : Assertion {
                        } catch (InvalidCastException) {\r
                                errorThrown = true;\r
                        }\r
-                       Assert("invalid cast error not thrown", \r
-                              errorThrown);\r
+                       Assert.IsTrue (errorThrown, "invalid cast error not thrown");\r
                }\r
 \r
                {\r
@@ -532,10 +498,10 @@ public class HashtableTest : Assertion {
                                o[1] = v;\r
                        }\r
 #endif // TARGET_JVM\r
-                       AssertEquals("first copy fine.", 'a', o[0].Key);\r
-                       AssertEquals("first copy fine.", 1, o[0].Value);\r
-                       AssertEquals("second copy fine.", 'b', o[1].Key);\r
-                       AssertEquals("second copy fine.", 2, o[1].Value);\r
+                       Assert.AreEqual ('a', o[0].Key, "first copy fine.");\r
+                       Assert.AreEqual (1, o[0].Value, "first copy fine.");\r
+                       Assert.AreEqual ('b', o[1].Key, "second copy fine.");\r
+                       Assert.AreEqual (2, o[1].Value, "second copy fine.");\r
                }\r
        }\r
 \r
@@ -548,14 +514,12 @@ public class HashtableTest : Assertion {
                        h1[s1[i]] = c1[i];\r
                }\r
                IDictionaryEnumerator en = h1.GetEnumerator();\r
-               AssertNotNull("No enumerator", en);\r
+               Assert.IsNotNull (en, "No enumerator");\r
                \r
                for (int i = 0; i < s1.Length; i++) {\r
                        en.MoveNext();\r
-                       Assert("Not enumerating for " + en.Key, \r
-                              Array.IndexOf(s1, en.Key) >= 0);\r
-                       Assert("Not enumerating for " + en.Value, \r
-                              Array.IndexOf(c1, en.Value) >= 0);\r
+                       Assert.IsTrue (Array.IndexOf(s1, en.Key) >= 0, "Not enumerating for " + en.Key);\r
+                       Assert.IsTrue (Array.IndexOf(c1, en.Value) >= 0, "Not enumerating for " + en.Value);\r
                }\r
        }\r
 \r
@@ -575,7 +539,7 @@ public class HashtableTest : Assertion {
                \r
                bool result;\r
                foreach (DictionaryEntry de in table1)\r
-                       AssertEquals (de.Value, table2 [de.Key]);\r
+                       Assert.AreEqual (table2 [de.Key], de.Value);\r
        }\r
        \r
        [Test]\r
@@ -591,7 +555,7 @@ public class HashtableTest : Assertion {
                formatter.Serialize(stream, table);\r
                stream.Position = 0;\r
                table = (Hashtable) formatter.Deserialize(stream);\r
-               AssertEquals ("#1", 1, table.Count);\r
+               Assert.AreEqual (1, table.Count, "#1");\r
        }\r
 \r
         [Test]        \r
@@ -603,10 +567,9 @@ public class HashtableTest : Assertion {
                                h.Remove(null);\r
                        } catch (ArgumentNullException e) {\r
                                errorThrown = true;\r
-                               AssertEquals("ParamName is not \"key\"", "key", e.ParamName);\r
+                               Assert.AreEqual ("key", e.ParamName, "ParamName is not \"key\"");\r
                        }\r
-                       Assert("null hashtable error not thrown", \r
-                              errorThrown);\r
+                       Assert.IsTrue (errorThrown, "null hashtable error not thrown");\r
                }\r
                {\r
                        string[] keys = {"this", "is", "a", "test"};\r
@@ -615,17 +578,13 @@ public class HashtableTest : Assertion {
                        for (int i = 0; i < keys.Length; i++) {\r
                                h[keys[i]] = values[i];\r
                        }\r
-                       AssertEquals("not enough in table",\r
-                                    4, h.Count);\r
+                       Assert.AreEqual (4, h.Count, "not enough in table");\r
                        h.Remove("huh?");\r
-                       AssertEquals("not enough in table",\r
-                                    4, h.Count);\r
+                       Assert.AreEqual (4, h.Count, "not enough in table");\r
                        h.Remove("this");\r
-                       AssertEquals("Wrong count in table",\r
-                                    3, h.Count);\r
+                       Assert.AreEqual (3, h.Count, "Wrong count in table");\r
                        h.Remove("this");\r
-                       AssertEquals("Wrong count in table",\r
-                                    3, h.Count);\r
+                       Assert.AreEqual (3, h.Count, "Wrong count in table");\r
                }\r
        }\r
 \r
@@ -637,18 +596,15 @@ public class HashtableTest : Assertion {
                                Hashtable h = Hashtable.Synchronized(null);\r
                        } catch (ArgumentNullException e) {\r
                                errorThrown = true;\r
-                               AssertEquals("ParamName is not \"table\"", "table", e.ParamName);\r
+                               Assert.AreEqual ("table", e.ParamName, "ParamName is not \"table\"");\r
                        }\r
-                       Assert("null hashtable error not thrown", \r
-                              errorThrown);\r
+                       Assert.IsTrue (errorThrown, "null hashtable error not thrown");\r
                }\r
                {\r
                        Hashtable h = new Hashtable();\r
-                       Assert("hashtable not synced by default", \r
-                              !h.IsSynchronized);\r
+                       Assert.IsTrue (!h.IsSynchronized, "hashtable not synced by default");\r
                        Hashtable h2 = Hashtable.Synchronized(h);\r
-                       Assert("hashtable should by synced", \r
-                              h2.IsSynchronized);\r
+                       Assert.IsTrue (h2.IsSynchronized, "hashtable should by synced");\r
                }\r
        }\r
        \r
@@ -672,20 +628,20 @@ public class HashtableTest : Assertion {
         [Test]\r
        public void TestAddRemoveClear() {\r
                ht.Clear();\r
-               Assert(ht.Count==0);\r
+               Assert.IsTrue (ht.Count==0);\r
                \r
                SetDefaultData();\r
-               Assert(ht.Count==3);\r
+               Assert.IsTrue (ht.Count==3);\r
                \r
                bool thrown=false;\r
                try {\r
                        ht.Add("k2","cool");\r
                } catch (ArgumentException) {thrown=true;}\r
-               Assert("Must throw ArgumentException!",thrown);\r
+               Assert.IsTrue (thrown, "Must throw ArgumentException!");\r
                \r
                ht["k2"]="cool";\r
-               Assert(ht.Count==3);\r
-               Assert(ht["k2"].Equals("cool"));\r
+               Assert.IsTrue (ht.Count==3);\r
+               Assert.IsTrue (ht["k2"].Equals("cool"));\r
                \r
        }\r
 \r
@@ -694,14 +650,14 @@ public class HashtableTest : Assertion {
                SetDefaultData();\r
                Object[] entries=new Object[ht.Count];\r
                ht.CopyTo(entries,0);\r
-               Assert("Not an entry.",entries[0] is DictionaryEntry);\r
+               Assert.IsTrue (entries[0] is DictionaryEntry, "Not an entry.");\r
        }\r
 \r
        [Test]\r
        public void CopyTo_Empty ()\r
        {\r
                Hashtable ht = new Hashtable ();\r
-               AssertEquals ("Count", 0, ht.Count);\r
+               Assert.AreEqual (0, ht.Count, "Count");\r
                object[] array = new object [ht.Count];\r
                ht.CopyTo (array, 0);\r
        }\r
@@ -725,14 +681,14 @@ public class HashtableTest : Assertion {
                        }\r
                }\r
                \r
-               Assert(ht.Count==n);\r
+               Assert.IsTrue (ht.Count==n);\r
                \r
                for (int i=0;i<n;i++) {\r
                        String key=cache[i];\r
                        String val=ht[key] as String;\r
                        String err="ht[\""+key+"\"]=\""+val+\r
                                "\", expected \""+cache[i+max]+"\"";\r
-                       Assert(err,val!=null && val.Equals(cache[i+max]));\r
+                       Assert.IsTrue (val!=null && val.Equals(cache[i+max]), err);\r
                }\r
                \r
                int r1=(n/3);\r
@@ -745,32 +701,32 @@ public class HashtableTest : Assertion {
                \r
                for (int i=0;i<n;i++) {\r
                        if (i>=r1 && i<r2) {\r
-                               Assert(ht[cache[i]]==null);\r
+                               Assert.IsTrue (ht[cache[i]]==null);\r
                        } else {\r
                                String key=cache[i];\r
                                String val=ht[key] as String;\r
                                String err="ht[\""+key+"\"]=\""+val+\r
                                        "\", expected \""+cache[i+max]+"\"";\r
-                               Assert(err,val!=null && val.Equals(cache[i+max]));\r
+                               Assert.IsTrue (val!=null && val.Equals(cache[i+max]), err);\r
                        }\r
                }\r
                \r
                ICollection keys=ht.Keys;\r
                int nKeys=0;\r
                foreach (Object key in keys) {\r
-                       Assert((key as String) != null);\r
+                       Assert.IsTrue ((key as String) != null);\r
                        nKeys++;\r
                }\r
-               Assert(nKeys==ht.Count);\r
+               Assert.IsTrue (nKeys==ht.Count);\r
 \r
                \r
                ICollection vals=ht.Values;\r
                int nVals=0;\r
                foreach (Object val in vals) {\r
-                       Assert((val as String) != null);\r
+                       Assert.IsTrue ((val as String) != null);\r
                        nVals++;\r
                }\r
-               Assert(nVals==ht.Count);\r
+               Assert.IsTrue (nVals==ht.Count);\r
                \r
        }\r
 \r
@@ -787,11 +743,11 @@ public class HashtableTest : Assertion {
                Hashtable ciHashtable = new Hashtable(11,1.0f,CaseInsensitiveHashCodeProvider.Default,CaseInsensitiveComparer.Default);\r
                ciHashtable ["key1"] = "value";\r
                ciHashtable ["key2"] = "VALUE";\r
-               Assert(ciHashtable ["key1"].Equals ("value"));\r
-               Assert(ciHashtable ["key2"].Equals ("VALUE"));\r
+               Assert.IsTrue (ciHashtable ["key1"].Equals ("value"));\r
+               Assert.IsTrue (ciHashtable ["key2"].Equals ("VALUE"));\r
 \r
                ciHashtable ["KEY1"] = "new_value";\r
-               Assert(ciHashtable ["key1"].Equals ("new_value"));\r
+               Assert.IsTrue (ciHashtable ["key1"].Equals ("new_value"));\r
 \r
        }\r
 \r
@@ -802,7 +758,7 @@ public class HashtableTest : Assertion {
 \r
                Hashtable htCopy = new Hashtable (ht);\r
 \r
-               Assert(ht.Count == htCopy.Count);\r
+               Assert.IsTrue (ht.Count == htCopy.Count);\r
        }\r
 \r
         [Test]\r
@@ -814,7 +770,7 @@ public class HashtableTest : Assertion {
 \r
                while (e.MoveNext ()) {}\r
 \r
-               Assert (!e.MoveNext ());\r
+               Assert.IsTrue (!e.MoveNext ());\r
 \r
        }\r
 \r
@@ -845,10 +801,10 @@ public class HashtableTest : Assertion {
        {\r
                Hashtable ht = new Hashtable ();\r
                // see bug #76300\r
-               Assert ("Keys.IsSerializable", ht.Keys.GetType ().IsSerializable);\r
-               Assert ("Values.IsSerializable", ht.Values.GetType ().IsSerializable);\r
-               Assert ("GetEnumerator.IsSerializable", ht.GetEnumerator ().GetType ().IsSerializable);\r
-               Assert ("Synchronized.IsSerializable", Hashtable.Synchronized (ht).GetType ().IsSerializable);\r
+               Assert.IsTrue (ht.Keys.GetType ().IsSerializable, "Keys.IsSerializable");\r
+               Assert.IsTrue (ht.Values.GetType ().IsSerializable, "Values.IsSerializable");\r
+               Assert.IsTrue (ht.GetEnumerator ().GetType ().IsSerializable, "GetEnumerator.IsSerializable");\r
+               Assert.IsTrue (Hashtable.Synchronized (ht).GetType ().IsSerializable, "Synchronized.IsSerializable");\r
        }\r
 \r
        [Test]\r