Update to NUnit 2.5 syntax
authorDavid Schmitt <david@dasz.at>
Mon, 11 Apr 2011 19:53:11 +0000 (21:53 +0200)
committerDavid Schmitt <david@dasz.at>
Mon, 11 Apr 2011 19:53:11 +0000 (21:53 +0200)
mcs/class/System.Data/Test/System.Data/ConstraintCollectionTest.cs
mcs/class/System.Data/Test/System.Data/ConstraintTest.cs
mcs/class/System.Data/Test/System.Data/DataRelationCollectionTest.cs
mcs/class/System.Data/Test/System.Data/DataRelationTest.cs
mcs/class/System.Data/Test/System.Data/UniqueConstraintTest.cs

index fe2c89a55c7ea063e0a70adc4f9b623c2b1c9c65..7ea938bed14a60adb090ff305c45d641ea0b7f75 100644 (file)
 
 
 using NUnit.Framework;
+using NUnit.Framework.SyntaxHelpers;
 using System;
 using System.Data;
 
 namespace MonoTests.System.Data
 {
        [TestFixture]
-       public class ConstraintCollectionTest : Assertion {
+       public class ConstraintCollectionTest {
                private DataTable _table;
                private DataTable _table2;
                private Constraint _constraint1;
@@ -76,7 +77,7 @@ namespace MonoTests.System.Data
                        col.Add(_constraint1);
                        col.Add(_constraint2);
 
-                       AssertEquals("Count doesn't equal added.",2, col.Count);
+                       Assert.That(col.Count, Is.EqualTo(2), "Count doesn't equal added.");
                }
 
                [Test]
@@ -88,13 +89,13 @@ namespace MonoTests.System.Data
                        try 
                        {
                                col.Add(null);
-                               Fail("B1: Failed to throw ArgumentNullException.");
+                               Assert.Fail("B1: Failed to throw ArgumentNullException.");
                        }
                        catch (ArgumentNullException) {}
                        catch (AssertionException exc) {throw exc;}
                        catch 
                        {
-                               Fail("A1: Wrong exception type");
+                               Assert.Fail("A1: Wrong exception type");
                        }
 
                        //duplicate name
@@ -106,7 +107,7 @@ namespace MonoTests.System.Data
                                col.Add(_constraint2);
 #if NET_1_1
 #else
-                               Fail("Failed to throw Duplicate name exception.");
+                               Assert.Fail("Failed to throw Duplicate name exception.");
 #endif
                                col.Remove (_constraint2); // only for !1.0
                                col.Remove (_constraint1);
@@ -119,7 +120,7 @@ namespace MonoTests.System.Data
 /* Don't use such catch. They cover our eyes from the exact exception location.
                        catch (Exception exc)
                        {
-                               Fail("A2: Wrong exception type. " + exc.ToString());
+                               Assert.Fail("A2: Wrong exception type. " + exc.ToString());
                        }
 */
                        //Constraint Already exists
@@ -128,7 +129,7 @@ namespace MonoTests.System.Data
                                col.Add(_constraint1);
 #if NET_1_1
 #else
-                               Fail("B2: Failed to throw ArgumentException.");
+                               Assert.Fail("B2: Failed to throw ArgumentException.");
 #endif
                                col.Remove (_constraint1);
                        }
@@ -141,7 +142,7 @@ namespace MonoTests.System.Data
                        catch (AssertionException exc) {throw exc;}
                        catch 
                        {
-                               Fail("A3: Wrong exception type");
+                               Assert.Fail("A3: Wrong exception type");
                        }
                }
 
@@ -158,11 +159,11 @@ namespace MonoTests.System.Data
                        _table.Constraints.Add(c1);
                        _table.Constraints.Add(c2);
 
-                       AssertSame("A1", c1, _table.Constraints[0]); 
-                       AssertSame("A2", c2, _table.Constraints[1]);
+                       Assert.AreSame(c1, _table.Constraints[0], "A1"); 
+                       Assert.AreSame(c2, _table.Constraints[1], "A2");
 
-                       AssertSame("A3", c1, _table.Constraints["first"]);
-                       AssertSame("A4", c2, _table.Constraints["sEcond"]); //case insensitive
+                       Assert.AreSame(c1, _table.Constraints["first"], "A3");
+                       Assert.AreSame(c2, _table.Constraints["sEcond"], "A4"); //case insensitive
 
                }
 
@@ -178,10 +179,10 @@ namespace MonoTests.System.Data
                        _table.Constraints.Add(c1);
                        _table.Constraints.Add(c2);
 
-                       AssertEquals("A1", 0, _table.Constraints.IndexOf(c1));
-                       AssertEquals("A2", 1, _table.Constraints.IndexOf(c2));
-                       AssertEquals("A3", 0, _table.Constraints.IndexOf("first"));
-                       AssertEquals("A4", 1, _table.Constraints.IndexOf("second"));
+                       Assert.AreEqual(0, _table.Constraints.IndexOf(c1), "A1");
+                       Assert.AreEqual(1, _table.Constraints.IndexOf(c2), "A2");
+                       Assert.AreEqual(0, _table.Constraints.IndexOf("first"), "A3");
+                       Assert.AreEqual(1, _table.Constraints.IndexOf("second"), "A4");
                }
 
                [Test]
@@ -195,8 +196,8 @@ namespace MonoTests.System.Data
 
                        _table.Constraints.Add(c1);
 
-                       Assert("A1", _table.Constraints.Contains(c1.ConstraintName)); //true
-                       Assert("A2", _table.Constraints.Contains(c2.ConstraintName) == false); //doesn't contain
+                       Assert.That(_table.Constraints.Contains(c1.ConstraintName), Is.True);
+                       Assert.That(_table.Constraints.Contains(c2.ConstraintName), Is.False);
                }
 
                [Test]
@@ -205,32 +206,32 @@ namespace MonoTests.System.Data
                        _table.Constraints.Add(new UniqueConstraint(_table.Columns[0]));
 
                        //This doesn't throw
-                       AssertNull(_table.Constraints["notInCollection"]);
+                       Assert.That(_table.Constraints["notInCollection"], Is.Null);
                        
                        //Index too high
                        try 
                        {
                                Constraint c = _table.Constraints[_table.Constraints.Count];
-                               Fail("B1: Failed to throw IndexOutOfRangeException.");
+                               Assert.Fail("B1: Failed to throw IndexOutOfRangeException.");
                        }
                        catch (IndexOutOfRangeException) {}
                        catch (AssertionException exc) {throw exc;}
                        catch 
                        {
-                               Fail("A1: Wrong exception type");
+                               Assert.Fail("A1: Wrong exception type");
                        }
 
                        //Index too low
                        try 
                        {
                                Constraint c = _table.Constraints[-1];
-                               Fail("B2: Failed to throw IndexOutOfRangeException.");
+                               Assert.Fail("B2: Failed to throw IndexOutOfRangeException.");
                        }
                        catch (IndexOutOfRangeException) {}
                        catch (AssertionException exc) {throw exc;}
                        catch 
                        {
-                               Fail("A2: Wrong exception type");
+                               Assert.Fail("A2: Wrong exception type");
                        }       
 
                }
@@ -253,13 +254,13 @@ namespace MonoTests.System.Data
                                                                                        _table2.Columns[0]);
                                
                                _table2.Constraints.Add(fkc);   //should throw                  
-                               Fail("B1: Failed to throw ArgumentException.");
+                               Assert.Fail("B1: Failed to throw ArgumentException.");
                        }
                        catch (ArgumentException) {}
                        catch (AssertionException exc) {throw exc;}
                        catch (Exception exc)
                        {
-                               Fail("A1: Wrong Exception type. " + exc.ToString());
+                               Assert.Fail("A1: Wrong Exception type. " + exc.ToString());
                        }
 
 
@@ -290,13 +291,13 @@ namespace MonoTests.System.Data
                                        _table2.Columns[0]);
                                
                                _table2.Constraints.Add(fkc);   //should throw                  
-                               Fail("B1: Failed to throw ArgumentException.");
+                               Assert.Fail("B1: Failed to throw ArgumentException.");
                        }
                        catch (ArgumentException) {}
                        catch (AssertionException exc) {throw exc;}
                        catch (Exception exc)
                        {
-                               Fail("A1: Wrong Exception type. " + exc.ToString());
+                               Assert.Fail("A1: Wrong Exception type. " + exc.ToString());
                        }
 
 
@@ -316,13 +317,13 @@ namespace MonoTests.System.Data
                                UniqueConstraint uc = new UniqueConstraint( _table.Columns[0]);
                                
                                _table.Constraints.Add(uc);     //should throw                  
-                               Fail("B1: Failed to throw ArgumentException.");
+                               Assert.Fail("B1: Failed to throw ArgumentException.");
                        }
                        catch (ArgumentException) {}
                        catch (AssertionException exc) {throw exc;}
                        catch (Exception exc)
                        {
-                               Fail("A1: Wrong Exception type. " + exc.ToString());
+                               Assert.Fail("A1: Wrong Exception type. " + exc.ToString());
                        }
                }
 
@@ -359,11 +360,11 @@ namespace MonoTests.System.Data
                         Constraint [] constraints1 = {_constraint3, _constraint4};
                         _table2.Constraints.AddRange (constraints1);
                                                                                                     
-                        AssertEquals ("A1", "UK1", _table.Constraints [0].ConstraintName);
-                        AssertEquals ("A2", "UK12", _table.Constraints [1].ConstraintName);
-                                                                                                    
-                        AssertEquals ("A3", "FK2", _table2.Constraints [0].ConstraintName);
-                        AssertEquals ("A4", "UK2", _table2.Constraints [1].ConstraintName);
+                        Assert.AreEqual ("UK1", _table.Constraints [0].ConstraintName, "A1");
+                        Assert.AreEqual ("UK12", _table.Constraints [1].ConstraintName, "A2");
+                                                                                              
+                        Assert.AreEqual ("FK2", _table2.Constraints [0].ConstraintName, "A3");
+                        Assert.AreEqual ("UK2", _table2.Constraints [1].ConstraintName, "A4");
 
                }
                
@@ -371,7 +372,7 @@ namespace MonoTests.System.Data
                [Category ("NotDotNet")]
                // Even after EndInit(), MS.NET does not fill Table property
                // on UniqueConstraint.
-               public void TestAddRange2()
+               public void TestAddRange2()
                 {
                         DataTable table = new DataTable ("Table");
                         DataColumn column1 = new DataColumn ("col1");
@@ -393,33 +394,30 @@ namespace MonoTests.System.Data
                                                                                                     
                         //Check the table property of UniqueConstraint Object
                         try{
-                                Assertion.AssertNull ("#01", constraints [2].Table);
+                                Assert.That (constraints [2].Table, Is.Null, "#A01");
                         }
                         catch (Exception e) {
-                                Assertion.Assert ("#A02", "System.NullReferenceException".Equals (e.GetType().ToString()));
+                                Assert.That (e, Is.TypeOf(typeof(NullReferenceException)), "#A02");
                         }
 
                        table.EndInit();
 
                        // After EndInit is called the constraints associated with most recent call to AddRange() must be
                        // added to the ConstraintCollection
-                        Assertion.Assert ("#A03", constraints [2].Table.ToString().Equals ("Table"));
-                        Assertion.Assert ("#A04", table.Constraints.Contains ("Unique1"));
-                        Assertion.Assert ("#A05", table.Constraints.Contains ("Unique2"));
-                        Assertion.Assert ("#A06", table.Constraints.Contains ("Unique3"));
-
+                        Assert.That (constraints [2].Table.ToString(), Is.EqualTo ("Table"), "#A03");
+                        Assert.That (table.Constraints.Contains ("Unique1"), Is.True, "#A04");
+                        Assert.That (table.Constraints.Contains ("Unique3"), Is.True, "#A06");
+                        Assert.That (table.Constraints.Contains ("Unique2"), Is.True, "#A05");
                 }
-        
-
 
                [Test]
                public void Clear()
                {
                        try {
                                _table.Constraints.Clear (); //Clear all constraints
-                                AssertEquals ("A1", 0, _table.Constraints.Count); //No constraints should remain
+                                Assert.That (_table.Constraints.Count, Is.EqualTo(0), "A1"); //No constraints should remain
                                 _table2.Constraints.Clear ();
-                                AssertEquals ("A2", 0, _table2.Constraints.Count);
+                                Assert.That (_table2.Constraints.Count, Is.EqualTo(0), "A2"); //No constraints should remain
                         }
                         catch (Exception e) {
                                 Console.WriteLine (e);
@@ -431,8 +429,7 @@ namespace MonoTests.System.Data
                [Ignore ("This never works on MS.NET (and it should not)")]
                public void CanRemove()
                {
-                       AssertEquals ("A1", false, _table.Constraints.CanRemove (_table.Constraints [0]));
-
+                       Assert.That (_table.Constraints.CanRemove (_table.Constraints [0]), Is.False, "A1");
                }
 
                [Test]
@@ -461,7 +458,7 @@ namespace MonoTests.System.Data
                public void Remove()
                {
                        _table2.Constraints.Remove (_table2.Constraints [1]); //Remove constraint and again add it
-                        AssertEquals ("A1", 1, _table2.Constraints.Count);                      
+                        Assert.That (_table2.Constraints.Count, Is.EqualTo(1), "A1");
                         UniqueConstraint _constraint4 = new UniqueConstraint ("UK2", _table2.Columns [1]);                                                                               
                         // Add the constraints.
                         Constraint [] constraints = {_constraint4};
@@ -474,9 +471,9 @@ namespace MonoTests.System.Data
                        try {
                                 //Remove constraint that cannot be removed
                                 _table.Constraints.Remove (_table.Constraints [0]);
-                               Fail ("A1");
+                               Assert.Fail ("A1");
                        } catch (Exception e) {
-                               AssertEquals ("A2", typeof (IndexOutOfRangeException), e.GetType ());
+                               Assert.That (e, Is.TypeOf (typeof (IndexOutOfRangeException)), "A2");
                         }
                 }
 
index 777e5dd7f906079b1d9f86c3b69fcf6726c34f92..f86d300a90b5a6e317a9476ed3490e0536abf4ff 100644 (file)
@@ -33,6 +33,7 @@
 //
 
 using NUnit.Framework;
+using NUnit.Framework.SyntaxHelpers;
 using System;
 using System.Data;
 
@@ -55,7 +56,7 @@ namespace MonoTests.System.Data
 //     }
 
        [TestFixture]
-       public class ConstraintTest : Assertion
+       public class ConstraintTest
        {
                private DataTable _table;
                private Constraint _constraint1;
@@ -104,11 +105,10 @@ namespace MonoTests.System.Data
                                        exceptionCaught = true;
                                }
                                catch {
-                                       Fail("Wrong exception type thrown.");
+                                       Assert.Fail("Wrong exception type thrown.");
                                }
                                
-                               Assert("Failed to throw exception.",
-                                       true == exceptionCaught);
+                               Assert.That(exceptionCaught, Is.True, "Failed to throw exception.");
                        }       
                }
 
@@ -129,10 +129,11 @@ namespace MonoTests.System.Data
                [Test]
                public void ToStringTest() {
                        _constraint1.ConstraintName = "Test";
-                       Assert("ToString is the same as constraint name.", _constraint1.ConstraintName.CompareTo( _constraint1.ToString()) == 0);
+                       Assert.That(_constraint1.ConstraintName, Is.EqualTo(_constraint1.ToString()),
+                               "ToString is the same as constraint name.");
                        
                        _constraint1.ConstraintName = null;
-                       AssertNotNull("ToString should return empty.",_constraint1.ToString());
+                       Assert.That(_constraint1.ToString(), Is.Not.Null, "ToString should return empty.");
                }
 
                [Test]
@@ -140,8 +141,8 @@ namespace MonoTests.System.Data
                        PropertyCollection col = _constraint1.ExtendedProperties as
                                PropertyCollection;
 
-                       AssertNotNull("ExtendedProperties returned null or didn't " +
-                               "return the correct type", col);
+                       Assert.That(col, Is.Not.Null, "ExtendedProperties returned null or didn't " +
+                               "return the correct type");
                }
        }
 }
index 8651ad115ee6c8dc9a02ed5fd453669ae2f6c67b..56c80c82caf650e0891f2fc581af2e2e09debf26 100644 (file)
@@ -30,6 +30,7 @@
 
 
 using NUnit.Framework;
+using NUnit.Framework.SyntaxHelpers;
 using System;
 using System.Data;
 
@@ -37,7 +38,7 @@ namespace MonoTests.System.Data
 {
 
        [TestFixture]
-       public class DataRelationCollectionTest : Assertion 
+       public class DataRelationCollectionTest
        {
                DataSet _dataset;
                DataTable _tblparent,_tblchild;
@@ -77,23 +78,23 @@ namespace MonoTests.System.Data
                        DataRelation dr = new DataRelation("CustOrder",parentCol,childCol);
                        
                        drcol.Add(dr);
-                       AssertEquals("test#1","CustOrder",drcol[0].RelationName);
+                       Assert.That (drcol[0].RelationName, Is.EqualTo ("CustOrder"), "test#1");
                        drcol.Clear();
                        
                        drcol.Add(parentCol,childCol);
-                       AssertEquals("test#2",1,drcol.Count);
+                       Assert.That (drcol.Count, Is.EqualTo (1), "test#2");
                        drcol.Clear();
                        
                        drcol.Add("NewRelation",parentCol,childCol);
-                       AssertEquals("test#3","NewRelation",drcol[0].RelationName);
+                       Assert.That (drcol[0].RelationName, Is.EqualTo ("NewRelation"), "test#3");
                        drcol.Clear();
                        
                        drcol.Add("NewRelation",parentCol,childCol,false);
-                       AssertEquals("test#4",1,drcol.Count);
+                       Assert.That (drcol.Count, Is.EqualTo (1), "test#4");
                        drcol.Clear();
                        
                        drcol.Add("NewRelation",parentCol,childCol,true);
-                       AssertEquals("test#5",1,drcol.Count);
+                       Assert.That (drcol.Count, Is.EqualTo (1), "test#5");
                        drcol.Clear();
                }
                
@@ -148,8 +149,8 @@ namespace MonoTests.System.Data
                                                        ,_dataset.Tables["Order"].Columns["custid"]);
                        drcol.AddRange(new DataRelation[] {dr1,dr2});
                        
-                       AssertEquals("test#1","CustOrder",drcol[0].RelationName);
-                       AssertEquals("test#2","ItemOrder",drcol[1].RelationName);
+                       Assert.That (drcol[0].RelationName, Is.EqualTo ("CustOrder"), "test#1");
+                       Assert.That (drcol[1].RelationName, Is.EqualTo ("ItemOrder"), "test#2");
                }
                
                [Test]
@@ -161,13 +162,12 @@ namespace MonoTests.System.Data
                        DataRelation dr = new DataRelation("CustOrder",parentCol,childCol);
                        
                        drcol.Add(dr);
-                       AssertEquals("test#1",true,drcol.CanRemove(dr));
-                       dr = null;
-                       AssertEquals("test#2",false,drcol.CanRemove(dr));
+                       Assert.That (drcol.CanRemove(dr), Is.True, "test#1");
+                       Assert.That (drcol.CanRemove(null), Is.False, "test#2");
                        DataRelation dr2 = new DataRelation("ItemOrder"
                                                ,_dataset.Tables["Item"].Columns["itemid"]
                                                ,_dataset.Tables["Order"].Columns["custid"]);
-                       AssertEquals("test#3",false,drcol.CanRemove(dr2));
+                       Assert.That (drcol.CanRemove(dr2), Is.False, "test#3");
                }
                
                [Test]
@@ -180,7 +180,7 @@ namespace MonoTests.System.Data
                        drcol.Add("ItemOrder",_dataset.Tables["Item"].Columns["itemid"]
                                                                 ,_dataset.Tables["Order"].Columns["itemid"]);
                        drcol.Clear();
-                       AssertEquals("test#1",0,drcol.Count);
+                       Assert.That (drcol.Count, Is.EqualTo (0), "test#1");
                }
                
                [Test]
@@ -192,11 +192,11 @@ namespace MonoTests.System.Data
                        DataRelation dr = new DataRelation("CustOrder",parentCol,childCol);
                        
                        drcol.Add(dr);
-                       AssertEquals("test#1",true,drcol.Contains(dr.RelationName));
+                       Assert.That(drcol.Contains(dr.RelationName), Is.True, "test#1");
                        string drnull = "";
-                       AssertEquals("test#2",false,drcol.Contains(drnull));
+                       Assert.That(drcol.Contains(drnull), Is.False, "test#2");
                        dr = new DataRelation("newRelation",childCol,parentCol);
-                       AssertEquals("test#3",false,drcol.Contains("NoSuchRelation"));
+                       Assert.That(drcol.Contains("NoSuchRelation"), Is.False, "test#3");
                }
                
                [Test]
@@ -212,16 +212,16 @@ namespace MonoTests.System.Data
                        
                        DataRelation [] array = new DataRelation[2];
                        drcol.CopyTo(array,0);
-                       AssertEquals("test#1",2,array.Length);
-                       AssertEquals("test#2", "CustOrder", array[0].RelationName);
-                       AssertEquals("test#3", "ItemOrder", array[1].RelationName);
+                       Assert.That(array.Length, Is.EqualTo(2), "test#1");
+                       Assert.That(array[0].RelationName, Is.EqualTo("CustOrder"), "test#2");
+                       Assert.That(array[1].RelationName, Is.EqualTo("ItemOrder"), "test#3");
                        
                        DataRelation [] array1 = new DataRelation[4];
                        drcol.CopyTo(array1,2);
-                       AssertEquals("test#4", null, array1[0]);
-                       AssertEquals("test#5", null, array1[1]);
-                       AssertEquals("test#6", "CustOrder", array1[2].RelationName);
-                       AssertEquals("test#7", "ItemOrder", array1[3].RelationName);
+                       Assert.That(array1[0], Is.Null,"test#4");
+                       Assert.That(array1[1], Is.Null,"test#5" );
+                       Assert.That(array1[2].RelationName, Is.EqualTo("CustOrder"),"test#6");
+                       Assert.That(array1[3].RelationName, Is.EqualTo("ItemOrder"),"test#7");
                }
                
                [Test]
@@ -238,14 +238,14 @@ namespace MonoTests.System.Data
                        DataRelationCollection drcol1 = newds.Relations;
                        DataRelationCollection drcol2 = _dataset.Relations;
 
-                       AssertEquals("test#1", true, drcol.Equals(drcol));
-                       AssertEquals("test#2", true, drcol.Equals(drcol2));
+                       Assert.That(drcol.Equals(drcol), Is.True,"test#1");
+                       Assert.That(drcol.Equals(drcol2), Is.True,"test#2");
                        
-                       AssertEquals("test#3", false, drcol1.Equals(drcol));
-                       AssertEquals("test#4", false, drcol.Equals(drcol1));
+                       Assert.That(drcol1.Equals(drcol), Is.False,"test#3");
+                       Assert.That(drcol.Equals(drcol1), Is.False,"test#4");
                        
-                       AssertEquals("test#5", true, Object.Equals(drcol,drcol2));
-                       AssertEquals("test#6", false, Object.Equals(drcol,drcol1));
+                       Assert.That(Object.Equals(drcol,drcol2), Is.True,"test#5");
+                       Assert.That(Object.Equals(drcol,drcol1), Is.False,"test#6");
                        
                }
                [Test]
@@ -261,21 +261,21 @@ namespace MonoTests.System.Data
                        drcol.Add(dr1);
                        drcol.Add(dr2);
                        
-                       AssertEquals("test#1",0,drcol.IndexOf(dr1));
-                       AssertEquals("test#2",1,drcol.IndexOf(dr2));
+                       Assert.That(drcol.IndexOf(dr1), Is.EqualTo(0), "test#1");
+                       Assert.That(drcol.IndexOf(dr2), Is.EqualTo(1), "test#2");
                        
-                       AssertEquals("test#3",0,drcol.IndexOf("CustOrder"));
-                       AssertEquals("test#4",1,drcol.IndexOf("ItemOrder"));
+                       Assert.That(drcol.IndexOf("CustOrder"), Is.EqualTo(0), "test#3");
+                       Assert.That(drcol.IndexOf("ItemOrder"), Is.EqualTo(1), "test#4");
                        
-                       AssertEquals("test#5",0,drcol.IndexOf(drcol[0]));
-                       AssertEquals("test#6",1,drcol.IndexOf(drcol[1]));
+                       Assert.That(drcol.IndexOf(drcol[0]), Is.EqualTo(0), "test#5");
+                       Assert.That(drcol.IndexOf(drcol[1]), Is.EqualTo(1), "test#6");
                        
-                       AssertEquals("test#7",-1,drcol.IndexOf("_noRelation_"));
+                       Assert.That(drcol.IndexOf("_noRelation_"), Is.EqualTo(-1), "test#7");
                        DataRelation newdr = new DataRelation("newdr"
                                                                                ,_dataset.Tables["Customer"].Columns["custid"]
                                                                                ,_dataset.Tables["Order"].Columns["custid"]);
                        
-                       AssertEquals("test#8",-1,drcol.IndexOf(newdr));
+                       Assert.That(drcol.IndexOf(newdr), Is.EqualTo(-1), "test#8");
                }
 
                [Test]
@@ -292,11 +292,11 @@ namespace MonoTests.System.Data
                        drcol.Add(dr2);
                        
                        drcol.Remove(dr1);
-                       AssertEquals("test#1", false, drcol.Contains(dr1.RelationName));
+                       Assert.That(drcol.Contains(dr1.RelationName), Is.False, "test#1");
                        drcol.Add(dr1);
                        
                        drcol.Remove("CustOrder");
-                       AssertEquals("test#2", false, drcol.Contains("CustOrder"));
+                       Assert.That(drcol.Contains("CustOrder"), Is.False, "test#2");
                        drcol.Add(dr1);
                        
                        DataRelation drnull = null;
@@ -308,16 +308,16 @@ namespace MonoTests.System.Data
                        try
                        {
                                drcol.Remove(newdr);
-                               Fail("Err: removed relation which not part of collection");
+                               Assert.Fail("Err: removed relation which not part of collection");
                        }
                        catch (Exception e)
                        {
-                               AssertEquals ("test#4", typeof(ArgumentException), e.GetType());
+                               Assert.That (e, Is.TypeOf(typeof(ArgumentException)), "test#4");
                        }
                        try
                        {
                                drcol.Remove("newdr");
-                               Fail("Err: removed relation which not part of collection");
+                               Assert.Fail("Err: removed relation which not part of collection");
                        }
                        catch (ArgumentException e)
                        {
@@ -342,7 +342,7 @@ namespace MonoTests.System.Data
                        try
                        {
                                drcol.RemoveAt(-1);
-                               Fail("the index was out of bound: must have failed");
+                               Assert.Fail("the index was out of bound: must have failed");
                        }
                        catch(IndexOutOfRangeException e)
                        {
@@ -350,16 +350,16 @@ namespace MonoTests.System.Data
                        try
                        {
                                drcol.RemoveAt(101);
-                               Fail("the index was out of bound: must have failed");
+                               Assert.Fail("the index was out of bound: must have failed");
                        }
                        catch(IndexOutOfRangeException e)
                        {
                        }
                        
                        drcol.RemoveAt (1);
-                       AssertEquals ("test#5", false, drcol.Contains(dr2.RelationName));
+                       Assert.That (drcol.Contains(dr2.RelationName), Is.False, "test#5");
                        drcol.RemoveAt (0);
-                       AssertEquals ("test#6", false, drcol.Contains(dr1.RelationName));
+                       Assert.That (drcol.Contains(dr1.RelationName), Is.False, "test#6");
                }
                
                //[Test]
@@ -370,7 +370,7 @@ namespace MonoTests.System.Data
                                                        ,_dataset.Tables["Customer"].Columns["custid"]
                                                        ,_dataset.Tables["Order"].Columns["custid"]);
                        drcol.Add(dr1); 
-                       AssertEquals("test#1","System.Data.DataRelationCollection",drcol.ToString());
+                       Assert.That (drcol.ToString(), Is.EqualTo("System.Data.DataRelationCollection"), "test#1");
                        Console.WriteLine(drcol.ToString());
                }
        }
index 9988d11062a33cdc39d86ab5370e9da3502d4220..d87dbe87c099179be77bffe387a50073e9f83c2e 100644 (file)
 //\r
 \r
 using NUnit.Framework;\r
+using NUnit.Framework.SyntaxHelpers;\r
 using System;\r
 using System.Data;\r
 \r
 namespace MonoTests.System.Data\r
 {\r
        [TestFixture]\r
-        public class DataRelationTest : Assertion\r
+        public class DataRelationTest\r
         {\r
                private DataSet Set = null;\r
                private DataTable Mom = null;\r
@@ -96,12 +97,12 @@ namespace MonoTests.System.Data
                        Row [1] = 56;\r
                        Child.Rows.Add (Row);\r
                        \r
-                       AssertEquals ("test#01", 2, Child.Rows.Count);\r
+                       Assert.That (Child.Rows.Count, Is.EqualTo (2), "test#01");\r
                        \r
                        Row = Mom.Rows [0];\r
                        Row.Delete ();\r
                        \r
-                       AssertEquals ("test#02", 1, Child.Rows.Count);\r
+                       Assert.That (Child.Rows.Count, Is.EqualTo (1), "test#02");\r
                        \r
                        Row = Mom.NewRow ();\r
                        Row [0] = "Teresa";\r
@@ -109,18 +110,18 @@ namespace MonoTests.System.Data
                        \r
                        try {\r
                                Mom.Rows.Add (Row);\r
-                               Fail ("test#03");\r
+                               Assert.Fail ("test#03");\r
                        } catch (Exception e) {\r
-                               AssertEquals ("test#04", typeof (ConstraintException), e.GetType ());\r
+                               Assert.That (e, Is.TypeOf (typeof (ConstraintException)), "test#04");\r
                                // Never premise English.\r
-                               //AssertEquals ("test#05", "Column 'ChildName' is constrained to be unique.  Value 'Dick' is already present.", e.Message);\r
+                               //Assert.That (e.Message, Is.EqualTo("Column 'ChildName' is constrained to be unique.  Value 'Dick' is already present."), "test#05");\r
                        }                       \r
 \r
                        Row = Mom.NewRow ();                                 \r
                         Row [0] = "Teresa";                                  \r
                         Row [1] = "Mich";                                    \r
                         Mom.Rows.Add (Row);                                  \r
-                        AssertEquals ("test#06", 1, Child.Rows.Count);       \r
+                        Assert.That (Child.Rows.Count, Is.EqualTo (1), "test#06");\r
                        \r
                         Row = Child.NewRow ();                               \r
                         Row [0] = "Jack";                                    \r
@@ -128,11 +129,11 @@ namespace MonoTests.System.Data
                        \r
                         try {                                                \r
                                 Child.Rows.Add (Row);                               \r
-                                Fail ("test#07");                                   \r
+                                Assert.Fail ("test#07");\r
                         } catch (Exception e) {                              \r
-                                AssertEquals ("test#08", typeof (InvalidConstraintException), e.GetType ());\r
+                                Assert.That (e, Is.TypeOf (typeof (InvalidConstraintException)), "test#08");\r
                                // Never premise English.\r
-                                //AssertEquals ("test#09", "ForeignKeyConstraint Rel requires the child key values (Jack) to exist in the parent table.", e.Message);                                                                      \r
+                                //Assert.That (e.Message, Is.EqualTo("ForeignKeyConstraint Rel requires the child key values (Jack) to exist in the parent table."), "test#09");                                                                      \r
                         }                                                    \r
 \r
                 }\r
@@ -154,7 +155,7 @@ namespace MonoTests.System.Data
                        \r
                        DataRelation Relation = new DataRelation ("Rel", Mom.Columns [1], Child.Columns [1], true);\r
                        Set.Relations.Add (Relation);\r
-                       AssertEquals("test#01", 1, Set.Relations.Count);\r
+                       Assert.That (Set.Relations.Count, Is.EqualTo (1), "test#01");\r
                        \r
                        Child.Columns [1].DataType = Type.GetType ("System.Double");\r
                }\r
@@ -163,42 +164,42 @@ namespace MonoTests.System.Data
                public void DataSetRelations ()\r
                {\r
                        DataRelation Relation;\r
-                       AssertEquals ("test#01", 0, Set.Relations.Count);\r
-                       AssertEquals ("test#02", 0, Mom.ParentRelations.Count);\r
-                       AssertEquals ("test#03", 0, Mom.ChildRelations.Count);\r
-                       AssertEquals ("test#04", 0, Child.ParentRelations.Count);\r
-                       AssertEquals ("test#05", 0, Child.ChildRelations.Count);\r
+                       Assert.That (Set.Relations.Count, Is.EqualTo (0), "test#01");\r
+                       Assert.That (Mom.ParentRelations.Count, Is.EqualTo (0), "test#02");\r
+                       Assert.That (Mom.ChildRelations.Count, Is.EqualTo (0), "test#03");\r
+                       Assert.That (Child.ParentRelations.Count, Is.EqualTo (0), "test#04");\r
+                       Assert.That (Child.ChildRelations.Count, Is.EqualTo (0), "test#05");\r
                        \r
                        Relation = new DataRelation ("Rel", Mom.Columns [1], Child.Columns [0]);\r
                        Set.Relations.Add (Relation);\r
                        \r
-                       AssertEquals ("test#06", 1, Set.Relations.Count);\r
-                       AssertEquals ("test#07", 0, Mom.ParentRelations.Count);\r
-                       AssertEquals ("test#08", 1, Mom.ChildRelations.Count);\r
-                       AssertEquals ("test#09", 1, Child.ParentRelations.Count);\r
-                       AssertEquals ("test#10", 0, Child.ChildRelations.Count);\r
+                       Assert.That (Set.Relations.Count, Is.EqualTo (1), "test#06");\r
+                       Assert.That (Mom.ParentRelations.Count, Is.EqualTo (0), "test#07");\r
+                       Assert.That (Mom.ChildRelations.Count, Is.EqualTo (1), "test#08");\r
+                       Assert.That (Child.ParentRelations.Count, Is.EqualTo (1), "test#09");\r
+                       Assert.That (Child.ChildRelations.Count, Is.EqualTo (0), "test#10");\r
                                                \r
                        Relation = Set.Relations [0];\r
-                       AssertEquals ("test#11", 1, Relation.ParentColumns.Length);\r
-                       AssertEquals ("test#12", 1, Relation.ChildColumns.Length);\r
-                       AssertEquals ("test#13", "Rel", Relation.ChildKeyConstraint.ConstraintName);\r
-                       AssertEquals ("test#14", "Constraint1", Relation.ParentKeyConstraint.ConstraintName);\r
+                       Assert.That (Relation.ParentColumns.Length, Is.EqualTo (1), "test#11");\r
+                       Assert.That (Relation.ChildColumns.Length, Is.EqualTo (1), "test#12");\r
+                       Assert.That (Relation.ChildKeyConstraint.ConstraintName, Is.EqualTo ("Rel"), "test#13");\r
+                       Assert.That (Relation.ParentKeyConstraint.ConstraintName, Is.EqualTo ("Constraint1"), "test#14");\r
                }\r
                \r
                [Test]\r
                public void Constraints ()\r
                {\r
                                \r
-                       AssertEquals ("test#01", 0, Mom.Constraints.Count);\r
-                       AssertEquals ("test#02", 0, Child.Constraints.Count);\r
+                       Assert.That (Mom.Constraints.Count, Is.EqualTo (0), "test#01");\r
+                       Assert.That (Child.Constraints.Count, Is.EqualTo (0), "test#02");\r
 \r
                        DataRelation Relation = new DataRelation ("Rel", Mom.Columns [1], Child.Columns [0]);\r
                        Set.Relations.Add (Relation);\r
                        \r
-                       AssertEquals ("test#03", 1, Mom.Constraints.Count);\r
-                       AssertEquals ("test#04", 1, Child.Constraints.Count);\r
-                       AssertEquals ("test#05", typeof (ForeignKeyConstraint), Child.Constraints [0].GetType ());\r
-                       AssertEquals ("test#05", typeof (UniqueConstraint), Mom.Constraints [0].GetType ());\r
+                       Assert.That (Mom.Constraints.Count, Is.EqualTo (1), "test#03");\r
+                       Assert.That (Child.Constraints.Count, Is.EqualTo (1), "test#04");\r
+                       Assert.That (Child.Constraints [0], Is.TypeOf (typeof (ForeignKeyConstraint)), "test#05");\r
+                       Assert.That (Mom.Constraints [0], Is.TypeOf (typeof (UniqueConstraint)), "test#06");\r
                        \r
                }\r
 \r
@@ -209,23 +210,23 @@ namespace MonoTests.System.Data
                        DataRelation Relation = new DataRelation ("Rel", Mom.Columns [1], Child.Columns [0]);\r
                        Set.Relations.Add (Relation);\r
                        DataRelation Test = null;\r
-                       AssertEquals ("test#01", 1, Mom.ChildRelations.Count);\r
-                       AssertEquals ("test#02", 0, Child.ChildRelations.Count);\r
-                       AssertEquals ("test#03", 0, Mom.ParentRelations.Count);\r
-                       AssertEquals ("test#04", 1, Child.ParentRelations.Count);\r
+                       Assert.That (Mom.ChildRelations.Count, Is.EqualTo (1), "test#01");\r
+                       Assert.That (Child.ChildRelations.Count, Is.EqualTo (0), "test#02");\r
+                       Assert.That (Mom.ParentRelations.Count, Is.EqualTo (0), "test#03");\r
+                       Assert.That (Child.ParentRelations.Count, Is.EqualTo (1), "test#04");\r
                                \r
                        Test = Child.ParentRelations [0];\r
-                       AssertEquals ("test#05", "Rel", Test.ToString ());\r
-                       AssertEquals ("test#06", "Rel", Test.RelationName);\r
-                       AssertEquals ("test#07", "Mom", Test.ParentTable.TableName);\r
-                       AssertEquals ("test#08", 1, Test.ParentKeyConstraint.Columns.Length);\r
-                       AssertEquals ("test#09", false, Test.ParentKeyConstraint.IsPrimaryKey);\r
-                       AssertEquals ("test#10", 1, Test.ParentColumns.Length);\r
-                       AssertEquals ("test#11", false, Test.Nested);\r
-                       AssertEquals ("test#12", 0, Test.ExtendedProperties.Count);\r
-                       AssertEquals ("test#13", "Child", Test.ChildTable.TableName);\r
-                       AssertEquals ("test#14", "Rel", Test.ChildKeyConstraint.ConstraintName);\r
-                       AssertEquals ("test#15", 1, Test.ChildColumns.Length);\r
+                       Assert.That (Test.ToString (), Is.EqualTo ("Rel"), "test#05");\r
+                       Assert.That (Test.RelationName, Is.EqualTo ("Rel"), "test#06");\r
+                       Assert.That (Test.ParentTable.TableName, Is.EqualTo ("Mom"), "test#07");\r
+                       Assert.That (Test.ParentKeyConstraint.Columns.Length, Is.EqualTo (1), "test#08");\r
+                       Assert.That (Test.ParentKeyConstraint.IsPrimaryKey, Is.False, "test#09");\r
+                       Assert.That (Test.ParentColumns.Length, Is.EqualTo (1), "test#10");\r
+                       Assert.That (Test.Nested, Is.False, "test#11");\r
+                       Assert.That (Test.ExtendedProperties.Count, Is.EqualTo (0), "test#12");\r
+                       Assert.That (Test.ChildTable.TableName, Is.EqualTo ("Child"), "test#13" );\r
+                       Assert.That (Test.ChildKeyConstraint.ConstraintName, Is.EqualTo ("Rel"), "test#14");\r
+                       Assert.That (Test.ChildColumns.Length, Is.EqualTo (1), "test#15");\r
                }\r
                \r
                [Test]\r
@@ -270,10 +271,10 @@ namespace MonoTests.System.Data
                        DataRelation Relation = null;\r
                        try {\r
                                Relation = new DataRelation ("Rel", Parents, Childs);\r
-                               Fail ("test#01");\r
+                               Assert.Fail ("test#01");\r
                        } catch (InvalidConstraintException e) {\r
-//                             AssertEquals ("test#02", typeof (InvalidConstraintException), e.GetType ());                            \r
-//                             AssertEquals ("test#03", "Cannot create a Key from Columns that belong to different tables.", e.Message);\r
+//                             Assert.That (e.GetType (), Is.EqualTo(typeof (InvalidConstraintException)), "test#02");                         \r
+//                             Assert.That (e.Message, Is.EqualTo("Cannot create a Key from Columns that belong to different tables."), "test#03");\r
                        }\r
                        \r
                        Childs [1] = Col6;\r
@@ -282,27 +283,27 @@ namespace MonoTests.System.Data
                        Set.Relations.Add (Relation);\r
                        \r
                        DataRelation Test = null;\r
-                       AssertEquals ("test#01", 1, Mom2.ChildRelations.Count);\r
-                       AssertEquals ("test#02", 0, Child2.ChildRelations.Count);\r
-                       AssertEquals ("test#03", 0, Mom2.ParentRelations.Count);\r
-                       AssertEquals ("test#04", 1, Child2.ParentRelations.Count);\r
+                       Assert.That (Mom2.ChildRelations.Count, Is.EqualTo (1), "test#01");\r
+                       Assert.That (Child2.ChildRelations.Count, Is.EqualTo (0), "test#02");\r
+                       Assert.That (Mom2.ParentRelations.Count, Is.EqualTo (0), "test#03");\r
+                       Assert.That (Child2.ParentRelations.Count, Is.EqualTo (1), "test#04");\r
                                \r
                        Test = Child2.ParentRelations [0];\r
-                       AssertEquals ("test#05", "Rel", Test.ToString ());\r
-                       AssertEquals ("test#06", "Rel", Test.RelationName);\r
-                       AssertEquals ("test#07", "Mom", Test.ParentTable.TableName);\r
-                       AssertEquals ("test#08", 2, Test.ParentKeyConstraint.Columns.Length);\r
-                       AssertEquals ("test#09", false, Test.ParentKeyConstraint.IsPrimaryKey);\r
-                       AssertEquals ("test#10", 2, Test.ParentColumns.Length);\r
-                       AssertEquals ("test#11", false, Test.Nested);\r
-                       AssertEquals ("test#12", 0, Test.ExtendedProperties.Count);\r
-                       AssertEquals ("test#13", "Child", Test.ChildTable.TableName);\r
-                       AssertEquals ("test#14", "Rel", Test.ChildKeyConstraint.ConstraintName);\r
-                       AssertEquals ("test#15", 2, Test.ChildColumns.Length);\r
-                       AssertEquals ("test#16", 1, Mom2.Constraints.Count);\r
-                       AssertEquals ("test#17", "Constraint1", Mom2.Constraints [0].ToString ());\r
-                       AssertEquals ("test#18", 1, Child2.Constraints.Count);                  \r
-                       AssertEquals ("test#19", 0, Hubby.Constraints.Count);\r
+                       Assert.That (Test.ToString (), Is.EqualTo ("Rel"), "test#05");\r
+                       Assert.That (Test.RelationName, Is.EqualTo ("Rel"), "test#06");\r
+                       Assert.That (Test.ParentTable.TableName, Is.EqualTo ("Mom"), "test#07");\r
+                       Assert.That (Test.ParentKeyConstraint.Columns.Length, Is.EqualTo (2), "test#08");\r
+                       Assert.That (Test.ParentKeyConstraint.IsPrimaryKey, Is.False, "test#09");\r
+                       Assert.That (Test.ParentColumns.Length, Is.EqualTo (2), "test#10");\r
+                       Assert.That (Test.Nested, Is.False, "test#11");\r
+                       Assert.That (Test.ExtendedProperties.Count, Is.EqualTo (0), "test#12");\r
+                       Assert.That (Test.ChildTable.TableName, Is.EqualTo ("Child"), "test#13");\r
+                       Assert.That (Test.ChildKeyConstraint.ConstraintName, Is.EqualTo ("Rel"), "test#14");\r
+                       Assert.That (Test.ChildColumns.Length, Is.EqualTo (2), "test#15");\r
+                       Assert.That (Mom2.Constraints.Count, Is.EqualTo (1), "test#16");\r
+                       Assert.That (Mom2.Constraints [0].ToString (), Is.EqualTo ("Constraint1"), "test#17");\r
+                       Assert.That (Child2.Constraints.Count, Is.EqualTo (1), "test#18");\r
+                       Assert.That (Hubby.Constraints.Count, Is.EqualTo (0), "test#19");\r
                }\r
                \r
                [Test]\r
@@ -313,31 +314,31 @@ namespace MonoTests.System.Data
                        Set.Relations.Add (Relation);\r
                        DataRelation Test = null;\r
        \r
-                       AssertEquals ("test#01", 1, Mom.ChildRelations.Count);\r
-                       AssertEquals ("test#02", 0, Child.ChildRelations.Count);\r
-                       AssertEquals ("test#03", 0, Mom.ParentRelations.Count);\r
-                       AssertEquals ("test#04", 1, Child.ParentRelations.Count);\r
-                               \r
+                       Assert.That (Mom.ChildRelations.Count, Is.EqualTo (1), "test#01");\r
+                       Assert.That (Child.ChildRelations.Count, Is.EqualTo (0), "test#02");\r
+                       Assert.That (Mom.ParentRelations.Count, Is.EqualTo (0), "test#03");\r
+                       Assert.That (Child.ParentRelations.Count, Is.EqualTo (1), "test#04");\r
+\r
                        Test = Child.ParentRelations [0];\r
                        \r
-                       AssertEquals ("test#05", "Rel", Test.ToString ());\r
-                       \r
-                       AssertEquals ("test#06", "Rel", Test.RelationName);\r
-                       AssertEquals ("test#07", "Mom", Test.ParentTable.TableName);\r
-                       \r
-                       Assert ("test#08", Test.ParentKeyConstraint == null);\r
-                       \r
-                       Assert ("test#09", Test.ParentKeyConstraint == null);\r
-                       \r
-                       AssertEquals ("test#10", 1, Test.ParentColumns.Length);\r
-                       AssertEquals ("test#11", false, Test.Nested);\r
-                       AssertEquals ("test#12", 0, Test.ExtendedProperties.Count);\r
-                       AssertEquals ("test#13", "Child", Test.ChildTable.TableName);\r
-                       \r
-                       Assert ("test#14", Test.ChildKeyConstraint == null);\r
-                       AssertEquals ("test#15", 1, Test.ChildColumns.Length);\r
-                       AssertEquals ("test#16", 0, Mom.Constraints.Count);                     \r
-                       AssertEquals ("test#17", 0, Child.Constraints.Count);                   \r
+                       Assert.That (Test.ToString (), Is.EqualTo ("Rel"), "test#05");\r
+\r
+                       Assert.That (Test.RelationName, Is.EqualTo ("Rel"), "test#06");\r
+                       Assert.That (Test.ParentTable.TableName, Is.EqualTo ("Mom"), "test#07");\r
+\r
+                       Assert.That (Test.ParentKeyConstraint, Is.Null, "test#08");\r
+\r
+                       Assert.That (Test.ParentKeyConstraint, Is.Null, "test#09");\r
+\r
+                       Assert.That (Test.ParentColumns.Length, Is.EqualTo (1), "test#10");\r
+                       Assert.That (Test.Nested, Is.False, "test#11");\r
+                       Assert.That (Test.ExtendedProperties.Count, Is.EqualTo (0), "test#12");\r
+                       Assert.That (Test.ChildTable.TableName, Is.EqualTo ("Child"), "test#13");\r
+\r
+                       Assert.That (Test.ChildKeyConstraint, Is.Null, "test#14");\r
+                       Assert.That (Test.ChildColumns.Length, Is.EqualTo (1), "test#15");\r
+                       Assert.That (Mom.Constraints.Count, Is.EqualTo (0), "test#16");\r
+                       Assert.That (Child.Constraints.Count, Is.EqualTo (0), "test#17");\r
 \r
                }\r
 \r
@@ -351,16 +352,16 @@ namespace MonoTests.System.Data
                        \r
                        try {\r
                                Set.Relations.Add (Relation);\r
-                               Fail ("test#01");\r
+                               Assert.Fail ("test#01");\r
                        } catch (Exception e) {\r
-                               AssertEquals ("test#02", typeof (NullReferenceException), e.GetType ());\r
+                               Assert.That (e, Is.TypeOf (typeof (NullReferenceException)), "test#02");\r
                        }\r
                        \r
                        try {\r
                                Set.Relations.AddRange (new DataRelation [] {Relation});\r
-                               Fail ("test#03");\r
+                               Assert.Fail ("test#03");\r
                        } catch (Exception e) {\r
-                               AssertEquals ("test#04", typeof (NullReferenceException), e.GetType ());\r
+                               Assert.That (e, Is.TypeOf (typeof (NullReferenceException)), "test#04");\r
                        }\r
                        \r
                        Set.BeginInit ();\r
@@ -368,24 +369,24 @@ namespace MonoTests.System.Data
                        Set.EndInit ();\r
                        \r
                        DataRelation Test = null;\r
-                       AssertEquals ("test#01", 1, Mom.ChildRelations.Count);\r
-                       AssertEquals ("test#02", 0, Child.ChildRelations.Count);\r
-                       AssertEquals ("test#03", 0, Mom.ParentRelations.Count);\r
-                       AssertEquals ("test#04", 1, Child.ParentRelations.Count);\r
+                       Assert.That (Mom.ChildRelations.Count, Is.EqualTo(1), "test#01");\r
+                       Assert.That (Child.ChildRelations.Count, Is.EqualTo(0), "test#02");\r
+                       Assert.That (Mom.ParentRelations.Count, Is.EqualTo(0), "test#03");\r
+                       Assert.That (Child.ParentRelations.Count, Is.EqualTo(1), "test#04");\r
                                \r
                        Test = Child.ParentRelations [0];\r
-                       AssertEquals ("test#05", "Rel", Test.ToString ());\r
-                       AssertEquals ("test#06", "Rel", Test.RelationName);\r
-                       AssertEquals ("test#07", "Mom", Test.ParentTable.TableName);\r
+                       Assert.That (Test.ToString (), Is.EqualTo("Rel"), "test#05");\r
+                       Assert.That (Test.RelationName, Is.EqualTo("Rel"), "test#06");\r
+                       Assert.That (Test.ParentTable.TableName, Is.EqualTo("Mom"), "test#07");\r
                        \r
-                       AssertEquals ("test#08", true, Test.ParentKeyConstraint == null);\r
+                       Assert.That (Test.ParentKeyConstraint, Is.Null, "test#08");\r
                                                \r
-                       AssertEquals ("test#10", 1, Test.ParentColumns.Length);\r
-                       AssertEquals ("test#11", true, Test.Nested);\r
-                       AssertEquals ("test#12", 0, Test.ExtendedProperties.Count);\r
-                       AssertEquals ("test#13", "Child", Test.ChildTable.TableName);\r
-                       AssertEquals ("test#14", true, Test.ChildKeyConstraint == null);\r
-                       AssertEquals ("test#15", 1, Test.ChildColumns.Length);\r
+                       Assert.That (Test.ParentColumns.Length, Is.EqualTo(1), "test#10");\r
+                       Assert.That (Test.Nested, Is.True, "test#11");\r
+                       Assert.That (Test.ExtendedProperties.Count, Is.EqualTo(0), "test#12");\r
+                       Assert.That (Test.ChildTable.TableName, Is.EqualTo("Child"), "test#13");\r
+                       Assert.That (Test.ChildKeyConstraint, Is.Null, "test#14");\r
+                       Assert.That (Test.ChildColumns.Length, Is.EqualTo(1), "test#15");\r
                        \r
                }\r
 \r
@@ -396,61 +397,61 @@ namespace MonoTests.System.Data
                        Set.ReadXmlSchema ("Test/System.Data/store.xsd");\r
                        DataTable Table = Set.Tables [0];\r
                        \r
-                       AssertEquals ("test#01", false, Table.CaseSensitive);\r
-                       AssertEquals ("test#02", 1, Table.ChildRelations.Count);\r
-                       AssertEquals ("test#03", 0, Table.ParentRelations.Count);\r
-                       AssertEquals ("test#04", 1, Table.Constraints.Count);\r
-                       AssertEquals ("test#05", 1, Table.PrimaryKey.Length);\r
-                       AssertEquals ("test#06", 0, Table.Rows.Count);\r
-                       AssertEquals ("test#07", "bookstore", Table.TableName);\r
-                       AssertEquals ("test#08", 1, Table.Columns.Count);\r
+                       Assert.That (Table.CaseSensitive, Is.False, "test#01");\r
+                       Assert.That (Table.ChildRelations.Count, Is.EqualTo(1), "test#02");\r
+                       Assert.That (Table.ParentRelations.Count, Is.EqualTo(0), "test#03");\r
+                       Assert.That (Table.Constraints.Count, Is.EqualTo(1), "test#04");\r
+                       Assert.That (Table.PrimaryKey.Length, Is.EqualTo(1), "test#05");\r
+                       Assert.That (Table.Rows.Count, Is.EqualTo(0), "test#06");\r
+                       Assert.That (Table.TableName, Is.EqualTo("bookstore"), "test#07");\r
+                       Assert.That (Table.Columns.Count, Is.EqualTo(1), "test#08");\r
                                                \r
                        DataRelation Relation = Table.ChildRelations [0];\r
-                       AssertEquals ("test#09", 1, Relation.ChildColumns.Length);\r
-                       AssertEquals ("test#10", "bookstore_book", Relation.ChildKeyConstraint.ConstraintName);\r
-                       AssertEquals ("test#11", 1, Relation.ChildKeyConstraint.Columns.Length);\r
-                       AssertEquals ("test#12", "book", Relation.ChildTable.TableName);\r
-                       AssertEquals ("test#13", "NewDataSet", Relation.DataSet.DataSetName);\r
-                       AssertEquals ("test#14", 0, Relation.ExtendedProperties.Count);\r
-                       AssertEquals ("test#15", true, Relation.Nested);\r
-                       AssertEquals ("test#16", 1, Relation.ParentColumns.Length);\r
-                       AssertEquals ("test#17", "Constraint1", Relation.ParentKeyConstraint.ConstraintName);\r
-                       AssertEquals ("test#18", "bookstore", Relation.ParentTable.TableName);\r
-                       AssertEquals ("test#19", "bookstore_book", Relation.RelationName);\r
+                       Assert.That (Relation.ChildColumns.Length, Is.EqualTo(1), "test#09");\r
+                       Assert.That (Relation.ChildKeyConstraint.ConstraintName, Is.EqualTo("bookstore_book"), "test#10");\r
+                       Assert.That (Relation.ChildKeyConstraint.Columns.Length, Is.EqualTo(1), "test#11");\r
+                       Assert.That (Relation.ChildTable.TableName, Is.EqualTo("book"), "test#12");\r
+                       Assert.That (Relation.DataSet.DataSetName, Is.EqualTo("NewDataSet"), "test#13");\r
+                       Assert.That (Relation.ExtendedProperties.Count, Is.EqualTo(0), "test#14");\r
+                       Assert.That (Relation.Nested, Is.True, "test#15");\r
+                       Assert.That (Relation.ParentColumns.Length, Is.EqualTo(1), "test#16");\r
+                       Assert.That (Relation.ParentKeyConstraint.ConstraintName, Is.EqualTo("Constraint1"), "test#17");\r
+                       Assert.That (Relation.ParentTable.TableName, Is.EqualTo("bookstore"), "test#18");\r
+                       Assert.That (Relation.RelationName, Is.EqualTo("bookstore_book"), "test#19");\r
 \r
                        Table = Set.Tables [1];\r
                        \r
-                       AssertEquals ("test#20", false, Table.CaseSensitive);\r
-                       AssertEquals ("test#21", 1, Table.ChildRelations.Count);\r
-                       AssertEquals ("test#22", 1, Table.ParentRelations.Count);\r
-                       AssertEquals ("test#23", 2, Table.Constraints.Count);\r
-                       AssertEquals ("test#24", 1, Table.PrimaryKey.Length);\r
-                       AssertEquals ("test#25", 0, Table.Rows.Count);\r
-                       AssertEquals ("test#26", "book", Table.TableName);\r
-                       AssertEquals ("test#27", 5, Table.Columns.Count);\r
+                       Assert.That (Table.CaseSensitive, Is.False, "test#20");\r
+                       Assert.That (Table.ChildRelations.Count, Is.EqualTo(1), "test#21");\r
+                       Assert.That (Table.ParentRelations.Count, Is.EqualTo(1), "test#22");\r
+                       Assert.That (Table.Constraints.Count, Is.EqualTo(2), "test#23");\r
+                       Assert.That (Table.PrimaryKey.Length, Is.EqualTo(1), "test#24");\r
+                       Assert.That (Table.Rows.Count, Is.EqualTo(0), "test#25");\r
+                       Assert.That (Table.TableName, Is.EqualTo("book"), "test#26");\r
+                       Assert.That (Table.Columns.Count, Is.EqualTo(5), "test#27");\r
                \r
                        Relation = Table.ChildRelations [0];\r
-                       AssertEquals ("test#28", 1, Relation.ChildColumns.Length);\r
-                       AssertEquals ("test#29", "book_author", Relation.ChildKeyConstraint.ConstraintName);\r
-                       AssertEquals ("test#30", 1, Relation.ChildKeyConstraint.Columns.Length);\r
-                       AssertEquals ("test#31", "author", Relation.ChildTable.TableName);\r
-                       AssertEquals ("test#32", "NewDataSet", Relation.DataSet.DataSetName);\r
-                       AssertEquals ("test#33", 0, Relation.ExtendedProperties.Count);\r
-                       AssertEquals ("test#34", true, Relation.Nested);\r
-                       AssertEquals ("test#35", 1, Relation.ParentColumns.Length);\r
-                       AssertEquals ("test#36", "Constraint1", Relation.ParentKeyConstraint.ConstraintName);\r
-                       AssertEquals ("test#37", "book", Relation.ParentTable.TableName);\r
-                       AssertEquals ("test#38", "book_author", Relation.RelationName);\r
+                       Assert.That (Relation.ChildColumns.Length, Is.EqualTo(1), "test#28");\r
+                       Assert.That (Relation.ChildKeyConstraint.ConstraintName, Is.EqualTo("book_author"), "test#29");\r
+                       Assert.That (Relation.ChildKeyConstraint.Columns.Length, Is.EqualTo(1), "test#30");\r
+                       Assert.That (Relation.ChildTable.TableName, Is.EqualTo("author"), "test#31");\r
+                       Assert.That (Relation.DataSet.DataSetName, Is.EqualTo("NewDataSet"), "test#32");\r
+                       Assert.That (Relation.ExtendedProperties.Count, Is.EqualTo(0), "test#33");\r
+                       Assert.That (Relation.Nested, Is.True, "test#34");\r
+                       Assert.That (Relation.ParentColumns.Length, Is.EqualTo(1), "test#35");\r
+                       Assert.That (Relation.ParentKeyConstraint.ConstraintName, Is.EqualTo("Constraint1"), "test#36");\r
+                       Assert.That (Relation.ParentTable.TableName, Is.EqualTo("book"), "test#37");\r
+                       Assert.That (Relation.RelationName, Is.EqualTo("book_author"), "test#38");\r
                        \r
                        Table = Set.Tables [2];\r
-                       AssertEquals ("test#39", false, Table.CaseSensitive);\r
-                       AssertEquals ("test#40", 0, Table.ChildRelations.Count);\r
-                       AssertEquals ("test#41", 1, Table.ParentRelations.Count);\r
-                       AssertEquals ("test#42", 1, Table.Constraints.Count);\r
-                       AssertEquals ("test#43", 0, Table.PrimaryKey.Length);\r
-                       AssertEquals ("test#44", 0, Table.Rows.Count);\r
-                       AssertEquals ("test#45", "author", Table.TableName);\r
-                       AssertEquals ("test#46", 3, Table.Columns.Count);\r
+                       Assert.That (Table.CaseSensitive, Is.False, "test#39");\r
+                       Assert.That (Table.ChildRelations.Count, Is.EqualTo(0), "test#40");\r
+                       Assert.That (Table.ParentRelations.Count, Is.EqualTo(1), "test#41");\r
+                       Assert.That (Table.Constraints.Count, Is.EqualTo(1), "test#42");\r
+                       Assert.That (Table.PrimaryKey.Length, Is.EqualTo(0), "test#43");\r
+                       Assert.That (Table.Rows.Count, Is.EqualTo(0), "test#44");\r
+                       Assert.That (Table.TableName, Is.EqualTo("author"), "test#45");\r
+                       Assert.That (Table.Columns.Count, Is.EqualTo(3), "test#46");\r
                }\r
                \r
                [Test]\r
@@ -482,16 +483,16 @@ namespace MonoTests.System.Data
                        \r
                        DataRow Row = Mom.Rows [1];                     \r
                        TempRow = Row.GetChildRows ("Rel") [0];\r
-                       AssertEquals ("test#01", "Dick", TempRow [0]);\r
-                       AssertEquals ("test#02", "10", TempRow [1].ToString ());\r
+                       Assert.That (TempRow [0], Is.EqualTo("Dick"), "test#01");\r
+                       Assert.That (TempRow [1].ToString (), Is.EqualTo("10"), "test#02");\r
                        TempRow = TempRow.GetParentRow ("Rel");\r
-                       AssertEquals ("test#03", "teresa", TempRow [0]);\r
-                       AssertEquals ("test#04", "Dick", TempRow [1]);\r
+                       Assert.That (TempRow [0], Is.EqualTo("teresa"), "test#03");\r
+                       Assert.That (TempRow [1], Is.EqualTo("Dick"), "test#04");\r
                        \r
                        Row = Child.Rows [0];\r
                        TempRow = Row.GetParentRows ("Rel") [0];\r
-                       AssertEquals ("test#05", "teresa", TempRow [0]);\r
-                       AssertEquals ("test#06", "john", TempRow [1]);                                          \r
+                       Assert.That (TempRow [0], Is.EqualTo("teresa"), "test#05");\r
+                       Assert.That (TempRow [1], Is.EqualTo("john"), "test#06");                                               \r
                }\r
 \r
         }\r
index 49ce21be7e1a0f68e14a3b707101c82860ff2307..8482f4bcf8a872cf41383f2dea4989d6a2abb597 100644 (file)
 //
 
 using NUnit.Framework;
+using NUnit.Framework.SyntaxHelpers;
 using System;
 using System.Data;
 
 namespace MonoTests.System.Data
 {
        [TestFixture]
-       public class UniqueConstraintTest : Assertion
+       public class UniqueConstraintTest
        {
                private DataTable _table;
 
@@ -66,10 +67,10 @@ namespace MonoTests.System.Data
                                //to a DataTable
                                cst = new UniqueConstraint(new DataColumn(""));
 
-                               Fail("Failed to throw ArgumentException.");
+                               Assert.Fail("Failed to throw ArgumentException.");
                        } 
                        catch (Exception e) {
-                               AssertEquals ("test#02", typeof (ArgumentException), e.GetType ());
+                               Assert.That (e, Is.TypeOf (typeof (ArgumentException)), "test#02");
                                // Never premise English.
                                // AssertEquals ("test#03", "Column must belong to a table.", e.Message);
                         }        
@@ -80,7 +81,7 @@ namespace MonoTests.System.Data
                                cst = new UniqueConstraint((DataColumn)null);
                        }
                         catch (Exception e) {
-                               AssertEquals ("test#05", typeof (NullReferenceException), e.GetType ());
+                                Assert.That (e, Is.TypeOf (typeof (NullReferenceException)), "test#05");
                                // Never premise English.
                                 //AssertEquals ("test#06", "Object reference not set to an instance of an object.", e.Message);
                         }
@@ -91,12 +92,12 @@ namespace MonoTests.System.Data
                                //InvalidConstraintException is thrown by msft ver
                                cst = new UniqueConstraint(new DataColumn [] {});
 
-                               Fail("B1: Failed to throw InvalidConstraintException.");
+                               Assert.Fail("B1: Failed to throw InvalidConstraintException.");
                        }
                        catch (InvalidConstraintException) {}
                        catch (AssertionException exc) {throw exc;}
                        catch {
-                               Fail("A3: Wrong Exception type.");
+                               Assert.Fail("A3: Wrong Exception type.");
                        }
 
                        DataTable dt = new DataTable("Table1");
@@ -115,12 +116,12 @@ namespace MonoTests.System.Data
                                cst = new UniqueConstraint(new DataColumn [] { 
                                                 dt.Columns[0], dt2.Columns[0]});
 
-                               Fail("B2: Failed to throw InvalidConstraintException");
+                               Assert.Fail("B2: Failed to throw InvalidConstraintException");
                        }
                        catch (InvalidConstraintException) {}
                        catch (AssertionException exc) {throw exc;}
                        catch {
-                               Fail("A4: Wrong Exception type.");
+                               Assert.Fail("A4: Wrong Exception type.");
                        }
                        
 
@@ -137,7 +138,7 @@ namespace MonoTests.System.Data
                                cst = new UniqueConstraint(_table.Columns[0]);
                        }
                        catch (Exception exc) {
-                               Fail("A1: Failed to ctor. " + exc.ToString());
+                               Assert.Fail("A1: Failed to ctor. " + exc.ToString());
                        }
 
                        
@@ -146,35 +147,32 @@ namespace MonoTests.System.Data
                                                _table.Columns[0], _table.Columns[1]});
                        }
                        catch (Exception exc) {
-                               Fail("A2: Failed to ctor. " + exc.ToString());
+                               Assert.Fail("A2: Failed to ctor. " + exc.ToString());
                        }
 
                        
                        //table is set on ctor
                        cst = new UniqueConstraint(_table.Columns[0]);
                        
-                       AssertSame("B1", cst.Table, _table);
+                       Assert.That (cst.Table, Is.SameAs(_table), "B1");
 
                        //table is set on ctor
                        cst = new UniqueConstraint( new DataColumn [] {
                                      _table.Columns[0], _table.Columns[1]});
-                       AssertSame ("B2", cst.Table, _table);
+                       Assert.That (cst.Table, Is.SameAs(_table), "B2");
 
                        cst = new UniqueConstraint("MyName",_table.Columns[0],true);
 
                        //Test ctor parm set for ConstraintName & IsPrimaryKey
-                       AssertEquals("ConstraintName not set in ctor.", 
-                               "MyName", cst.ConstraintName);
-                        AssertEquals("IsPrimaryKey already set.",
-                                false, cst.IsPrimaryKey);
+                       Assert.That (cst.ConstraintName, Is.EqualTo("MyName"), "ConstraintName not set in ctor.");
+                        Assert.That (cst.IsPrimaryKey, Is.False, "IsPrimaryKey already set.");
                 
                        _table.Constraints.Add (cst);
 
-                        AssertEquals("IsPrimaryKey not set set.",
-                                true, cst.IsPrimaryKey);
+                        Assert.That (cst.IsPrimaryKey, Is.True, "IsPrimaryKey not set set.");
                        
-                       AssertEquals("PrimaryKey not set.", 1, _table.PrimaryKey.Length);
-                       AssertEquals("Not unigue.", true, _table.PrimaryKey [0].Unique);
+                       Assert.That (_table.PrimaryKey.Length, Is.EqualTo(1), "PrimaryKey not set.");
+                       Assert.That (_table.PrimaryKey [0].Unique, Is.True, "Not unigue.");
 
                }
 
@@ -182,18 +180,18 @@ namespace MonoTests.System.Data
                public void Unique ()                             
                {                                                     
                        UniqueConstraint U = new UniqueConstraint (_table.Columns [0]);
-                       AssertEquals ("test#01", false, _table.Columns [0].Unique); 
+                       Assert.That (_table.Columns [0].Unique, Is.False, "test#01"); 
                        
                         U = new UniqueConstraint (new DataColumn [] {_table.Columns [0],_table.Columns [1]});     
                        
-                        AssertEquals ("test#02", false, _table.Columns [0].Unique);
-                        AssertEquals ("test#03", false, _table.Columns [1].Unique);
-                        AssertEquals ("test#04", false, _table.Columns [2].Unique);
+                       Assert.That (_table.Columns [0].Unique, Is.False, "test#02");
+                        Assert.That (_table.Columns [1].Unique, Is.False, "test#03");
+                        Assert.That (_table.Columns [2].Unique, Is.False, "test#04");
                        
                         _table.Constraints.Add (U);
-                        AssertEquals ("test#05", false, _table.Columns [0].Unique);
-                        AssertEquals ("test#06", false, _table.Columns [1].Unique);
-                        AssertEquals ("test#07", false, _table.Columns [2].Unique);
+                        Assert.That (_table.Columns [0].Unique, Is.False, "test#05");
+                        Assert.That (_table.Columns [1].Unique, Is.False, "test#06");
+                        Assert.That (_table.Columns [2].Unique, Is.False, "test#07");
                 }                                                     
                
                [Test]
@@ -207,19 +205,19 @@ namespace MonoTests.System.Data
                        UniqueConstraint cst4 = new UniqueConstraint(_table.Columns[2]);
                        
                        //true
-                       Assert(cst.Equals(cst2) == true);
+                       Assert.That (cst.Equals(cst2), Is.True, "A0");
                        
                        //false
-                       Assert("A1", cst.Equals(23) == false);
-                       Assert("A2", cst.Equals(cst3) == false);
-                       Assert("A3", cst3.Equals(cst) == false);
-                       Assert("A4", cst.Equals(cst4) == false);
+                       Assert.That (cst.Equals(23), Is.False, "A1");
+                       Assert.That (cst.Equals(cst3), Is.False, "A2");
+                       Assert.That (cst3.Equals(cst), Is.False, "A3");
+                       Assert.That (cst.Equals(cst4), Is.False, "A4");
 
                        //true
-                       Assert("HashEquals", cst.GetHashCode() == cst2.GetHashCode());
+                       Assert.That (cst.GetHashCode(), Is.EqualTo(cst2.GetHashCode()), "HashEquals");
 
                        //false
-                       Assert("Hash Not Equals", (cst.GetHashCode() == cst3.GetHashCode()) == false);
+                       Assert.That (cst.GetHashCode(), Is.Not.EqualTo(cst3.GetHashCode()), "Hash Not Equals");
                }
 
                [Test]