From b2b4ea5f306f440332fd6cb1e12d0148d24a99ec Mon Sep 17 00:00:00 2001 From: Robert Jordan Date: Fri, 26 Jun 2009 12:49:57 +0000 Subject: [PATCH] 2009-06-26 Robert Jordan * BitVector32Test.cs, NameValueCollectionTest.cs: Upgrade to new NUnit style. svn path=/trunk/mcs/; revision=136954 --- .../BitVector32Test.cs | 60 ++++----- .../System.Collections.Specialized/ChangeLog | 5 + .../NameValueCollectionTest.cs | 120 +++++++++--------- 3 files changed, 95 insertions(+), 90 deletions(-) diff --git a/mcs/class/System/Test/System.Collections.Specialized/BitVector32Test.cs b/mcs/class/System/Test/System.Collections.Specialized/BitVector32Test.cs index 3adb631a369..c2772cd1b38 100644 --- a/mcs/class/System/Test/System.Collections.Specialized/BitVector32Test.cs +++ b/mcs/class/System/Test/System.Collections.Specialized/BitVector32Test.cs @@ -59,20 +59,20 @@ namespace MonoTests.System.Collections.Specialized public void Indexers () { BitVector32 b = new BitVector32 (7); - Assertion.Assert ("#1", b [0]); - Assertion.Assert ("#2", b [1]); - Assertion.Assert ("#3", b [2]); - Assertion.Assert ("#4", b [4]); - Assertion.Assert ("#5", !b [8]); - Assertion.Assert ("#6", !b [16]); + Assert.IsTrue (b [0], "#1"); + Assert.IsTrue (b [1], "#2"); + Assert.IsTrue (b [2], "#3"); + Assert.IsTrue (b [4], "#4"); + Assert.IsTrue (!b [8], "#5"); + Assert.IsTrue (!b [16], "#6"); b [8] = true; - Assertion.Assert ("#7", b [4]); - Assertion.Assert ("#8", b [8]); - Assertion.Assert ("#9", !b [16]); + Assert.IsTrue (b [4], "#7"); + Assert.IsTrue (b [8], "#8"); + Assert.IsTrue (!b [16], "#9"); b [8] = false; - Assertion.Assert ("#10", b [4]); - Assertion.Assert ("#11", !b [8]); - Assertion.Assert ("#12", !b [16]); + Assert.IsTrue (b [4], "#10"); + Assert.IsTrue (!b [8], "#11"); + Assert.IsTrue (!b [16], "#12"); BitVector32.Section s = BitVector32.CreateSection (31); s = BitVector32.CreateSection (64, s); @@ -83,7 +83,7 @@ namespace MonoTests.System.Collections.Specialized BitVector32 b2 = new BitVector32 (b1 [s]); //Console.WriteLine (b1.ToString ()); //Console.WriteLine (b2.ToString ()); - Assertion.AssertEquals ("#14", 123, b1 [s]); + Assert.AreEqual (123, b1 [s], "#14"); // b1 [s] = 15; //Console.WriteLine (b1.ToString ()); @@ -112,50 +112,50 @@ namespace MonoTests.System.Collections.Specialized public void CreateSection () { BitVector32.Section s = BitVector32.CreateSection (1); - Assertion.AssertEquals ("#1", (short) 1, s.Mask); + Assert.AreEqual ((short) 1, s.Mask, "#1"); s = BitVector32.CreateSection (2); - Assertion.AssertEquals ("#2", (short) 3, s.Mask); + Assert.AreEqual ((short) 3, s.Mask, "#2"); s = BitVector32.CreateSection (3); - Assertion.AssertEquals ("#3", (short) 3, s.Mask); + Assert.AreEqual ((short) 3, s.Mask, "#3"); s = BitVector32.CreateSection (5); - Assertion.AssertEquals ("#4", (short) 7, s.Mask); + Assert.AreEqual ((short) 7, s.Mask, "#4"); s = BitVector32.CreateSection (20); - Assertion.AssertEquals ("#4", (short) 0x1f, s.Mask); + Assert.AreEqual ((short) 0x1f, s.Mask, "#4"); s = BitVector32.CreateSection (Int16.MaxValue); - Assertion.AssertEquals ("#5", (short) 0x7fff, s.Mask); + Assert.AreEqual ((short) 0x7fff, s.Mask, "#5"); s = BitVector32.CreateSection (Int16.MaxValue - 100); - Assertion.AssertEquals ("#6", (short) 0x7fff, s.Mask); + Assert.AreEqual ((short) 0x7fff, s.Mask, "#6"); try { BitVector32.Section s2 = BitVector32.CreateSection (0); - Assertion.Fail ("#7"); + Assert.Fail ("#7"); } catch (ArgumentException) {} try { BitVector32.Section s2 = BitVector32.CreateSection (-1); - Assertion.Fail ("#8"); + Assert.Fail ("#8"); } catch (ArgumentException) {} try { BitVector32.Section s2 = BitVector32.CreateSection (Int16.MinValue); - Assertion.Fail ("#9"); + Assert.Fail ("#9"); } catch (ArgumentException) {} s = BitVector32.CreateSection (20); - Assertion.AssertEquals ("#10a", (short) 0x1f, s.Mask); - Assertion.AssertEquals ("#10b", (short) 0x00, s.Offset); + Assert.AreEqual ((short) 0x1f, s.Mask, "#10a"); + Assert.AreEqual ((short) 0x00, s.Offset, "#10b"); s = BitVector32.CreateSection (120, s); - Assertion.AssertEquals ("#10c", (short) 0x7f, s.Mask); - Assertion.AssertEquals ("#10d", (short) 0x05, s.Offset); + Assert.AreEqual ((short) 0x7f, s.Mask, "#10c"); + Assert.AreEqual ((short) 0x05, s.Offset, "#10d"); s = BitVector32.CreateSection (1000, s); - Assertion.AssertEquals ("#10e", (short) 0x3ff, s.Mask); - Assertion.AssertEquals ("#10f", (short) 0x0c, s.Offset); + Assert.AreEqual ((short) 0x3ff, s.Mask, "#10e"); + Assert.AreEqual ((short) 0x0c, s.Offset, "#10f"); } [Test] @@ -217,7 +217,7 @@ namespace MonoTests.System.Collections.Specialized Assert.AreEqual (1, bv[sect], "bv[sect]"); bv [sect] = 0; - Assertion.AssertEquals ("#12a", Int32.MaxValue, bv.Data); + Assert.AreEqual (Int32.MaxValue, bv.Data, "#12a"); } [Test, ExpectedException (typeof (ArgumentException))] diff --git a/mcs/class/System/Test/System.Collections.Specialized/ChangeLog b/mcs/class/System/Test/System.Collections.Specialized/ChangeLog index 7a442b2ba83..e0cec4060c0 100644 --- a/mcs/class/System/Test/System.Collections.Specialized/ChangeLog +++ b/mcs/class/System/Test/System.Collections.Specialized/ChangeLog @@ -1,3 +1,8 @@ +2009-06-26 Robert Jordan + + * BitVector32Test.cs, NameValueCollectionTest.cs: + Upgrade to new NUnit style. + 2008-08-21 Scott Peterson * BitVector32Test.cs: Added test to make sure illegal sections cannot diff --git a/mcs/class/System/Test/System.Collections.Specialized/NameValueCollectionTest.cs b/mcs/class/System/Test/System.Collections.Specialized/NameValueCollectionTest.cs index a37c58e39bb..5b76f619181 100644 --- a/mcs/class/System/Test/System.Collections.Specialized/NameValueCollectionTest.cs +++ b/mcs/class/System/Test/System.Collections.Specialized/NameValueCollectionTest.cs @@ -18,17 +18,17 @@ using NUnit.Framework; namespace MonoTests.System.Collections.Specialized { [TestFixture] - public class NameValueCollectionTest : Assertion { + public class NameValueCollectionTest { [Test] public void GetValues () { NameValueCollection col = new NameValueCollection (); col.Add ("foo1", "bar1"); - AssertEquals ("#1", null, col.GetValues (null)); - AssertEquals ("#2", null, col.GetValues ("")); - AssertEquals ("#3", null, col.GetValues ("NotExistent")); - AssertEquals ("#4", 1, col.GetValues (0).Length); + Assert.AreEqual (null, col.GetValues (null), "#1"); + Assert.AreEqual (null, col.GetValues (""), "#2"); + Assert.AreEqual (null, col.GetValues ("NotExistent"), "#3"); + Assert.AreEqual (1, col.GetValues (0).Length, "#4"); } [Test] @@ -37,7 +37,7 @@ namespace MonoTests.System.Collections.Specialized { { NameValueCollection c = new NameValueCollection (); c.Add ("foo1", "bar1"); - AssertEquals ("#5", null, c.GetValues (1)); + Assert.AreEqual (null, c.GetValues (1), "#5"); } [Test] @@ -45,11 +45,11 @@ namespace MonoTests.System.Collections.Specialized { { NameValueCollection col = new NameValueCollection (5); col.Add ("foo1", "bar1"); - AssertEquals ("#1", null, col.Get (null)); - AssertEquals ("#2", null, col.Get ("")); - AssertEquals ("#3", null, col.Get ("NotExistent")); - AssertEquals ("#4", "bar1", col.Get ("foo1")); - AssertEquals ("#5", "bar1", col.Get (0)); + Assert.AreEqual (null, col.Get (null), "#1"); + Assert.AreEqual (null, col.Get (""), "#2"); + Assert.AreEqual (null, col.Get ("NotExistent"), "#3"); + Assert.AreEqual ("bar1", col.Get ("foo1"), "#4"); + Assert.AreEqual ("bar1", col.Get (0), "#5"); } [Test] @@ -58,7 +58,7 @@ namespace MonoTests.System.Collections.Specialized { { NameValueCollection c = new NameValueCollection (); c.Add ("foo1", "bar1"); - AssertEquals ("#6", null, c.Get (1)); + Assert.AreEqual (null, c.Get (1), "#6"); } [Test] @@ -66,7 +66,7 @@ namespace MonoTests.System.Collections.Specialized { { NameValueCollection c = new NameValueCollection (CaseInsensitiveHashCodeProvider.DefaultInvariant, CaseInsensitiveComparer.DefaultInvariant); c.Add ("foo1", "bar1"); - AssertEquals ("#1", "foo1", c.GetKey (0)); + Assert.AreEqual ("foo1", c.GetKey (0), "#1"); } [Test] @@ -75,27 +75,27 @@ namespace MonoTests.System.Collections.Specialized { { NameValueCollection c = new NameValueCollection (); c.Add ("foo1", "bar1"); - AssertEquals ("#2", null, c.GetKey (1)); + Assert.AreEqual (null, c.GetKey (1), "#2"); } [Test] public void HasKeys () { NameValueCollection c = new NameValueCollection (5, CaseInsensitiveHashCodeProvider.DefaultInvariant, CaseInsensitiveComparer.DefaultInvariant); - Assert ("#1", !c.HasKeys ()); + Assert.IsTrue (!c.HasKeys (), "#1"); c.Add ("foo1", "bar1"); - Assert ("#2", c.HasKeys ()); + Assert.IsTrue (c.HasKeys (), "#2"); } [Test] public void Clear () { NameValueCollection c = new NameValueCollection (); - AssertEquals ("#1", 0, c.Count); + Assert.AreEqual (0, c.Count, "#1"); c.Add ("foo1", "bar1"); - AssertEquals ("#2", 1, c.Count); + Assert.AreEqual (1, c.Count, "#2"); c.Clear (); - AssertEquals ("#3", 0, c.Count); + Assert.AreEqual (0, c.Count, "#3"); } [Test] @@ -105,10 +105,10 @@ namespace MonoTests.System.Collections.Specialized { c.Add ("mono", "mono"); c.Add ("!mono", null); c.Add (null, "mono!"); - AssertEquals ("Count", 3, c.Count); - AssertEquals ("mono", "mono", c ["mono"]); - AssertNull ("!mono", c ["!mono"]); - AssertEquals ("mono!", "mono!", c [null]); + Assert.AreEqual (3, c.Count, "Count"); + Assert.AreEqual ("mono", c ["mono"], "mono"); + Assert.IsNull (c ["!mono"], "!mono"); + Assert.AreEqual ("mono!", c [null], "mono!"); } [Test] @@ -118,8 +118,8 @@ namespace MonoTests.System.Collections.Specialized { c.Add ("mono", "mono"); c.Add ("mono", "mono"); c.Add ("mono", "mono"); - AssertEquals ("Count", 1, c.Count); - AssertEquals ("mono", "mono,mono,mono", c ["mono"]); + Assert.AreEqual (1, c.Count, "Count"); + Assert.AreEqual ("mono,mono,mono", c ["mono"], "mono"); } [Test] @@ -129,8 +129,8 @@ namespace MonoTests.System.Collections.Specialized { c.Add ("mono", "mono"); c.Add ("mono", null); c.Add ("mono", "mono"); - AssertEquals ("Count", 1, c.Count); - AssertEquals ("mono", "mono,mono", c ["mono"]); + Assert.AreEqual (1, c.Count, "Count"); + Assert.AreEqual ("mono,mono", c ["mono"], "mono"); } [Test] @@ -140,18 +140,18 @@ namespace MonoTests.System.Collections.Specialized { NameValueCollection c2 = new NameValueCollection (c1); c2.Add (c1); - AssertEquals ("c1.Count", 0, c1.Count); - AssertEquals ("c2.Count", 0, c2.Count); + Assert.AreEqual (0, c1.Count, "c1.Count"); + Assert.AreEqual (0, c2.Count, "c2.Count"); c1.Add ("foo", "bar"); c2.Add ("bar", "foo"); - AssertEquals ("c1.Count", 1, c1.Count); - AssertEquals ("c2.Count", 1, c2.Count); + Assert.AreEqual (1, c1.Count, "c1.Count"); + Assert.AreEqual (1, c2.Count, "c2.Count"); c2.Add (c1); - AssertEquals ("c1.Count", 1, c1.Count); - AssertEquals ("c2.Count", 2, c2.Count); + Assert.AreEqual (1, c1.Count, "c1.Count"); + Assert.AreEqual (2, c2.Count, "c2.Count"); } [Test] @@ -173,7 +173,7 @@ namespace MonoTests.System.Collections.Specialized { b.Add ("Test", null); a.Add (b); - AssertEquals ("Count", 1, a.Count); + Assert.AreEqual (1, a.Count, "Count"); } [Test] @@ -183,10 +183,10 @@ namespace MonoTests.System.Collections.Specialized { c.Set ("mono", "mono"); c.Set ("!mono", null); c.Set (null, "mono!"); - AssertEquals ("Count", 3, c.Count); - AssertEquals ("mono", "mono", c ["mono"]); - AssertNull ("!mono", c ["!mono"]); - AssertEquals ("mono!", "mono!", c [null]); + Assert.AreEqual (3, c.Count, "Count"); + Assert.AreEqual ("mono", c ["mono"], "mono"); + Assert.IsNull (c ["!mono"], "!mono"); + Assert.AreEqual ("mono!", c [null], "mono!"); } [Test] @@ -196,19 +196,19 @@ namespace MonoTests.System.Collections.Specialized { c.Add ("mono", "mono"); c.Add ("!mono", "!mono"); c.Add ("mono!", "mono!"); - AssertEquals ("Count", 3, c.Count); - AssertEquals ("mono", "mono", c ["mono"]); - AssertEquals ("!mono", "!mono", c ["!mono"]); - AssertEquals ("mono!", "mono!", c ["mono!"]); + Assert.AreEqual (3, c.Count, "Count"); + Assert.AreEqual ("mono", c ["mono"], "mono"); + Assert.AreEqual ("!mono", c ["!mono"], "!mono"); + Assert.AreEqual ("mono!", c ["mono!"], "mono!"); c.Set ("mono", "nomo"); c.Set ("!mono", null); c.Set (null, "mono!"); - AssertEquals ("Count", 4, c.Count); // mono! isn't removed - AssertEquals ("mono", "nomo", c ["mono"]); - AssertNull ("!mono", c ["!mono"]); - AssertEquals ("mono!1", "mono!", c ["mono!"]); - AssertEquals ("mono!2", "mono!", c [null]); + Assert.AreEqual (4, c.Count, "Count"); // mono! isn't removed + Assert.AreEqual ("nomo", c ["mono"], "mono"); + Assert.IsNull (c ["!mono"], "!mono"); + Assert.AreEqual ("mono!", c ["mono!"], "mono!1"); + Assert.AreEqual ("mono!", c [null], "mono!2"); } [Test] @@ -220,7 +220,7 @@ namespace MonoTests.System.Collections.Specialized { c.Add ("MoNo", "MoNo"); c.Add ("mOnO", "mOnO"); c.Add ("MONO", "MONO"); - AssertEquals ("Count", 1, c.Count); + Assert.AreEqual (1, c.Count, "Count"); } [Test] @@ -318,24 +318,24 @@ namespace MonoTests.System.Collections.Specialized { string add = "Add-" + i.ToString () + "-Count"; c.Add (items [i], add); - AssertEquals (add, 1, c.Count); + Assert.AreEqual (1, c.Count, add); c.Remove (items [0]); - AssertEquals ("Remove-0-Count", 0, c.Count); + Assert.AreEqual (0, c.Count, "Remove-0-Count"); c.Add (items [i], add); - AssertEquals (add, 1, c.Count); + Assert.AreEqual (1, c.Count, add); c.Remove (items [1]); - AssertEquals ("Remove-1-Count", 0, c.Count); + Assert.AreEqual (0, c.Count, "Remove-1-Count"); c.Add (items [i], add); - AssertEquals (add, 1, c.Count); + Assert.AreEqual (1, c.Count, add); c.Remove (items [2]); - AssertEquals ("Remove-2-Count", 0, c.Count); + Assert.AreEqual (0, c.Count, "Remove-2-Count"); c.Add (items [i], add); - AssertEquals (add , 1, c.Count); + Assert.AreEqual (1, c.Count, add); c.Remove (items [3]); - AssertEquals ("Remove-3-Count", 0, c.Count); + Assert.AreEqual (0, c.Count, "Remove-3-Count"); } } [Test] @@ -366,7 +366,7 @@ namespace MonoTests.System.Collections.Specialized { { NameValueCollection coll = new NameValueCollection (new EqualityComparer ()); coll.Add ("a", "1"); - AssertEquals ("#1", 1, coll.Count); + Assert.AreEqual (1, coll.Count, "#1"); } [Test] @@ -374,7 +374,7 @@ namespace MonoTests.System.Collections.Specialized { { NameValueCollection coll = new NameValueCollection (5, new EqualityComparer ()); coll.Add ("a", "1"); - AssertEquals ("#1", 1, coll.Count); + Assert.AreEqual (1, coll.Count, "#1"); } [Test] @@ -389,7 +389,7 @@ namespace MonoTests.System.Collections.Specialized { { NameValueCollection c1 = new NameValueCollection ((IEqualityComparer)null); c1.Add ("key", "value"); - AssertEquals ("Constructor_IEqualityComparer_Null", c1.Get ("KEY"), "value"); + Assert.AreEqual (c1.Get ("KEY"), "value", "Constructor_IEqualityComparer_Null"); c1.Remove ("key"); } @@ -399,7 +399,7 @@ namespace MonoTests.System.Collections.Specialized { NameValueCollection c1 = new NameValueCollection (StringComparer.InvariantCultureIgnoreCase); c1.Add ("key", "value"); NameValueCollection c2 = new NameValueCollection (c1); - AssertEquals ("Constructor_NameValueCollection", c2.Get ("KEY"), "value"); + Assert.AreEqual (c2.Get ("KEY"), "value", "Constructor_NameValueCollection"); c2.Remove ("key"); } #endif -- 2.25.1