Merge branch 'nunit25/2011-04-11' of https://github.com/DavidS/mono into DavidS-nunit...
authorZoltan Varga <vargaz@gmail.com>
Mon, 11 Apr 2011 21:39:06 +0000 (23:39 +0200)
committerZoltan Varga <vargaz@gmail.com>
Mon, 11 Apr 2011 21:39:06 +0000 (23:39 +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..10af5ada60fa1f47fc26c5f900b654be9bd68463 100644 (file)
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-
-
 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;
                private Constraint _constraint2;
 
                [SetUp]
-               public void GetReady() 
+               public void GetReady ()
                {
                        //Setup DataTable
-                       _table = new DataTable("TestTable");
-                       _table.Columns.Add("Col1",typeof(int));
-                       _table.Columns.Add("Col2",typeof(int));
-                       _table.Columns.Add("Col3",typeof(int));
+                       _table = new DataTable ("TestTable");
+                       _table.Columns.Add ("Col1", typeof(int));
+                       _table.Columns.Add ("Col2", typeof(int));
+                       _table.Columns.Add ("Col3", typeof(int));
 
-                       _table2 = new DataTable("TestTable");
-                       _table2.Columns.Add("Col1",typeof(int));
-                       _table2.Columns.Add("Col2",typeof(int));
+                       _table2 = new DataTable ("TestTable");
+                       _table2.Columns.Add ("Col1", typeof(int));
+                       _table2.Columns.Add ("Col2", typeof(int));
 
                        //Use UniqueConstraint to test Constraint Base Class
-                       _constraint1 = new UniqueConstraint(_table.Columns[0],false); 
-                       _constraint2 = new UniqueConstraint(_table.Columns[1],false); 
+                       _constraint1 = new UniqueConstraint (_table.Columns [0], false); 
+                       _constraint2 = new UniqueConstraint (_table.Columns [1], false); 
 
                        // not sure why this is needed since a new _table was just created
                        // for us, but this Clear() keeps the tests from throwing
                        // an exception when the Add() is called.
-                       _table.Constraints.Clear();
+                       _table.Constraints.Clear ();
                }
 
                [Test]
-               public void Add()
+               public void Add ()
                {
                        ConstraintCollection col = _table.Constraints;
-                       col.Add(_constraint1);
-                       col.Add(_constraint2);
+                       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]
-               public void AddExceptions()
+               public void AddExceptions ()
                {
                        ConstraintCollection col = _table.Constraints;
                        
                        //null
-                       try 
-                       {
-                               col.Add(null);
-                               Fail("B1: Failed to throw ArgumentNullException.");
-                       }
-                       catch (ArgumentNullException) {}
-                       catch (AssertionException exc) {throw exc;}
-                       catch 
-                       {
-                               Fail("A1: Wrong exception type");
+                       try {
+                               col.Add (null);
+                               Assert.Fail ("B1: Failed to throw ArgumentNullException.");
+                       } catch (ArgumentNullException) {
+                       } catch (AssertionException exc) {
+                               throw exc;
+                       } catch {
+                               Assert.Fail ("A1: Wrong exception type");
                        }
 
                        //duplicate name
-                       try 
-                       {
+                       try {
                                _constraint1.ConstraintName = "Dog";
                                _constraint2.ConstraintName = "dog"; //case insensitive
-                               col.Add(_constraint1);
-                               col.Add(_constraint2);
+                               col.Add (_constraint1);
+                               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);
@@ -115,328 +112,302 @@ namespace MonoTests.System.Data
                        catch (DuplicateNameException) {
                        }
 #endif
-                       catch (AssertionException exc) {throw exc;}
+                       catch (AssertionException exc) {
+                               throw exc;
+                       }
 /* 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
-                       try 
-                       {
-                               col.Add(_constraint1);
+                       try {
+                               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);
-                       }
-                       catch (ArgumentException) {
+                       } catch (ArgumentException) {
 #if NET_1_1
 #else
                                throw;
 #endif
-                       }
-                       catch (AssertionException exc) {throw exc;}
-                       catch 
-                       {
-                               Fail("A3: Wrong exception type");
+                       } catch (AssertionException exc) {
+                               throw exc;
+                       } catch {
+                               Assert.Fail ("A3: Wrong exception type");
                        }
                }
 
                [Test]
-               public void Indexer()
+               public void Indexer ()
                {
-                       Constraint c1 = new UniqueConstraint(_table.Columns[0]);
-                       Constraint c2 = new UniqueConstraint(_table.Columns[1]);
+                       Constraint c1 = new UniqueConstraint (_table.Columns [0]);
+                       Constraint c2 = new UniqueConstraint (_table.Columns [1]);
 
                        c1.ConstraintName = "first";
                        c2.ConstraintName = "second";
 
 
-                       _table.Constraints.Add(c1);
-                       _table.Constraints.Add(c2);
+                       _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
 
                }
 
                [Test]
-               public void IndexOf()
+               public void IndexOf ()
                {
-                       Constraint c1 = new UniqueConstraint(_table.Columns[0]);
-                       Constraint c2 = new UniqueConstraint(_table.Columns[1]);
+                       Constraint c1 = new UniqueConstraint (_table.Columns [0]);
+                       Constraint c2 = new UniqueConstraint (_table.Columns [1]);
 
                        c1.ConstraintName = "first";
                        c2.ConstraintName = "second";
 
-                       _table.Constraints.Add(c1);
-                       _table.Constraints.Add(c2);
+                       _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]
-               public void Contains()
+               public void Contains ()
                {
-                       Constraint c1 = new UniqueConstraint(_table.Columns[0]);
-                       Constraint c2 = new UniqueConstraint(_table.Columns[1]);
+                       Constraint c1 = new UniqueConstraint (_table.Columns [0]);
+                       Constraint c2 = new UniqueConstraint (_table.Columns [1]);
 
                        c1.ConstraintName = "first";
                        c2.ConstraintName = "second";
 
-                       _table.Constraints.Add(c1);
+                       _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]
-               public void IndexerFailures()
+               public void IndexerFailures ()
                {
-                       _table.Constraints.Add(new UniqueConstraint(_table.Columns[0]));
+                       _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.");
-                       }
-                       catch (IndexOutOfRangeException) {}
-                       catch (AssertionException exc) {throw exc;}
-                       catch 
-                       {
-                               Fail("A1: Wrong exception type");
+                       try {
+                               Constraint c = _table.Constraints [_table.Constraints.Count];
+                               Assert.Fail ("B1: Failed to throw IndexOutOfRangeException.");
+                       } catch (IndexOutOfRangeException) {
+                       } catch (AssertionException exc) {
+                               throw exc;
+                       } catch {
+                               Assert.Fail ("A1: Wrong exception type");
                        }
 
                        //Index too low
-                       try 
-                       {
-                               Constraint c = _table.Constraints[-1];
-                               Fail("B2: Failed to throw IndexOutOfRangeException.");
-                       }
-                       catch (IndexOutOfRangeException) {}
-                       catch (AssertionException exc) {throw exc;}
-                       catch 
-                       {
-                               Fail("A2: Wrong exception type");
+                       try {
+                               Constraint c = _table.Constraints [-1];
+                               Assert.Fail ("B2: Failed to throw IndexOutOfRangeException.");
+                       } catch (IndexOutOfRangeException) {
+                       } catch (AssertionException exc) {
+                               throw exc;
+                       } catch {
+                               Assert.Fail ("A2: Wrong exception type");
                        }       
-
                }
 
                [Test]
-               public void AddFkException1()
+               public void AddFkException1 ()
                {
-                       DataSet ds = new DataSet();
-                       ds.Tables.Add(_table);
+                       DataSet ds = new DataSet ();
+                       ds.Tables.Add (_table);
                        _table2.TableName = "TestTable2";
-                       ds.Tables.Add(_table2);
+                       ds.Tables.Add (_table2);
 
-                       _table.Rows.Add(new object [] {1});
-                       _table.Rows.Add(new object [] {1});
+                       _table.Rows.Add (new object [] {1});
+                       _table.Rows.Add (new object [] {1});
 
                        //FKC: can't create unique constraint because duplicate values already exist
-                       try
-                       {
-                               ForeignKeyConstraint fkc = new ForeignKeyConstraint( _table.Columns[0],
-                                                                                       _table2.Columns[0]);
+                       try {
+                               ForeignKeyConstraint fkc = new ForeignKeyConstraint (_table.Columns [0],
+                                                                                       _table2.Columns [0]);
                                
-                               _table2.Constraints.Add(fkc);   //should throw                  
-                               Fail("B1: Failed to throw ArgumentException.");
-                       }
-                       catch (ArgumentException) {}
-                       catch (AssertionException exc) {throw exc;}
-                       catch (Exception exc)
-                       {
-                               Fail("A1: Wrong Exception type. " + exc.ToString());
+                               _table2.Constraints.Add (fkc);  //should throw                  
+                               Assert.Fail ("B1: Failed to throw ArgumentException.");
+                       } catch (ArgumentException) {
+                       } catch (AssertionException exc) {
+                               throw exc;
+                       } catch (Exception exc) {
+                               Assert.Fail ("A1: Wrong Exception type. " + exc.ToString ());
                        }
-
-
                }
 
-
                [Test]
-               public void AddFkException2()
+               public void AddFkException2 ()
                {
                        //Foreign key rules only work when the tables
                        //are apart of the dataset
-                       DataSet ds = new DataSet();
-                       ds.Tables.Add(_table);
+                       DataSet ds = new DataSet ();
+                       ds.Tables.Add (_table);
                        _table2.TableName = "TestTable2";
-                       ds.Tables.Add(_table2);
+                       ds.Tables.Add (_table2);
 
-                       _table.Rows.Add(new object [] {1});
+                       _table.Rows.Add (new object [] {1});
                        
                        // will need a matching parent value in 
                        // _table
-                       _table2.Rows.Add(new object [] {3}); 
+                       _table2.Rows.Add (new object [] {3}); 
                                                                
 
                        //FKC: no matching parent value
-                       try
-                       {
-                               ForeignKeyConstraint fkc = new ForeignKeyConstraint( _table.Columns[0],
-                                       _table2.Columns[0]);
+                       try {
+                               ForeignKeyConstraint fkc = new ForeignKeyConstraint (_table.Columns [0],
+                                       _table2.Columns [0]);
                                
-                               _table2.Constraints.Add(fkc);   //should throw                  
-                               Fail("B1: Failed to throw ArgumentException.");
-                       }
-                       catch (ArgumentException) {}
-                       catch (AssertionException exc) {throw exc;}
-                       catch (Exception exc)
-                       {
-                               Fail("A1: Wrong Exception type. " + exc.ToString());
+                               _table2.Constraints.Add (fkc);  //should throw                  
+                               Assert.Fail ("B1: Failed to throw ArgumentException.");
+                       } catch (ArgumentException) {
+                       } catch (AssertionException exc) {
+                               throw exc;
+                       } catch (Exception exc) {
+                               Assert.Fail ("A1: Wrong Exception type. " + exc.ToString ());
                        }
-
-
                }
 
-
                [Test]
-               public void AddUniqueExceptions()
+               public void AddUniqueExceptions ()
                {
                        
 
                        //UC: can't create unique constraint because duplicate values already exist
-                       try
-                       {
-                               _table.Rows.Add(new object [] {1});
-                               _table.Rows.Add(new object [] {1});
-                               UniqueConstraint uc = new UniqueConstraint( _table.Columns[0]);
+                       try {
+                               _table.Rows.Add (new object [] {1});
+                               _table.Rows.Add (new object [] {1});
+                               UniqueConstraint uc = new UniqueConstraint (_table.Columns [0]);
                                
-                               _table.Constraints.Add(uc);     //should throw                  
-                               Fail("B1: Failed to throw ArgumentException.");
-                       }
-                       catch (ArgumentException) {}
-                       catch (AssertionException exc) {throw exc;}
-                       catch (Exception exc)
-                       {
-                               Fail("A1: Wrong Exception type. " + exc.ToString());
+                               _table.Constraints.Add (uc);    //should throw                  
+                               Assert.Fail ("B1: Failed to throw ArgumentException.");
+                       } catch (ArgumentException) {
+                       } catch (AssertionException exc) {
+                               throw exc;
+                       } catch (Exception exc) {
+                               Assert.Fail ("A1: Wrong Exception type. " + exc.ToString ());
                        }
                }
 
                [Test]
-                //Tests AddRange (), CanRemove (), RemoveAt (), Remove (), Exceptions of  Remove(), and Clear ()
-                public void AddRemoveTest ()
-                {
-                        AddRange ();
-//                      CanRemove (); This test is ignored
-                        Remove ();
-//                      RemoveAt (); This test is ignored
+               //Tests AddRange (), CanRemove (), RemoveAt (), Remove (), Exceptions of  Remove(), and Clear ()
+               public void AddRemoveTest ()
+               {
+                       AddRange ();
+                       //CanRemove (); This test is ignored
+                       Remove ();
+                       //RemoveAt (); This test is ignored
 
                        // This test is expected to be failed, so don't reuse it.
-//                        RemoveExceptions ();
-                        _table.Constraints.Remove (_table.Constraints [0]);
+                       //RemoveExceptions ();
+                       _table.Constraints.Remove (_table.Constraints [0]);
 
                        Clear ();
-                }
+               }
 
                [Test]
-               public void AddRange()
+               public void AddRange ()
                {
                        _constraint1.ConstraintName = "UK1";
-                        _constraint2.ConstraintName = "UK12";
+                       _constraint2.ConstraintName = "UK12";
                                                                                                     
-                        ForeignKeyConstraint _constraint3 = new ForeignKeyConstraint ("FK2", _table.Columns [0],
+                       ForeignKeyConstraint _constraint3 = new ForeignKeyConstraint ("FK2", _table.Columns [0],
                                         _table2.Columns [0]);
-                        UniqueConstraint _constraint4=new UniqueConstraint("UK2", _table2.Columns [1]);
+                       UniqueConstraint _constraint4 = new UniqueConstraint ("UK2", _table2.Columns [1]);
                                                                                                     
-                        // Add the constraints.
-                        Constraint [] constraints = {_constraint1, _constraint2};
-                        _table.Constraints.AddRange (constraints);
+                       // Add the constraints.
+                       Constraint [] constraints = {_constraint1, _constraint2};
+                       _table.Constraints.AddRange (constraints);
                                                                                                                                                                                                          
-                        Constraint [] constraints1 = {_constraint3, _constraint4};
-                        _table2.Constraints.AddRange (constraints1);
+                       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");
                }
                
                [Test]
                [Category ("NotDotNet")]
                // Even after EndInit(), MS.NET does not fill Table property
                // on UniqueConstraint.
-               public void TestAddRange2()
-                {
-                        DataTable table = new DataTable ("Table");
-                        DataColumn column1 = new DataColumn ("col1");
-                        DataColumn column2 = new DataColumn ("col2");
-                        DataColumn column3 = new DataColumn ("col3");
-                        table.Columns.Add (column1);
-                        table.Columns.Add (column2);
-                        table.Columns.Add (column3);
-                        string []columnNames = {"col1", "col2", "col3"};
+               public void TestAddRange2 ()
+               {
+                       DataTable table = new DataTable ("Table");
+                       DataColumn column1 = new DataColumn ("col1");
+                       DataColumn column2 = new DataColumn ("col2");
+                       DataColumn column3 = new DataColumn ("col3");
+                       table.Columns.Add (column1);
+                       table.Columns.Add (column2);
+                       table.Columns.Add (column3);
+                       string [] columnNames = {"col1", "col2", "col3"};
                                                                                                     
-                        Constraint []constraints = new Constraint[3];
-                        constraints [0] = new UniqueConstraint ("Unique1",column1);
-                        constraints [1] = new UniqueConstraint ("Unique2",column2);
-                        constraints [2] = new UniqueConstraint ("Unique3", columnNames, true);
+                       Constraint [] constraints = new Constraint[3];
+                       constraints [0] = new UniqueConstraint ("Unique1", column1);
+                       constraints [1] = new UniqueConstraint ("Unique2", column2);
+                       constraints [2] = new UniqueConstraint ("Unique3", columnNames, true);
                                                                                                     
-                        table.BeginInit();
-                        //Console.WriteLine(table.InitStatus == DataTable.initStatus.BeginInit);
-                        table.Constraints.AddRange (constraints);
+                       table.BeginInit ();
+                       //Console.WriteLine(table.InitStatus == DataTable.initStatus.BeginInit);
+                       table.Constraints.AddRange (constraints);
                                                                                                     
-                        //Check the table property of UniqueConstraint Object
-                        try{
-                                Assertion.AssertNull ("#01", constraints [2].Table);
-                        }
-                        catch (Exception e) {
-                                Assertion.Assert ("#A02", "System.NullReferenceException".Equals (e.GetType().ToString()));
-                        }
+                       //Check the table property of UniqueConstraint Object
+                       try {
+                               Assert.That (constraints [2].Table, Is.Null, "#A01");
+                       } catch (Exception e) {
+                               Assert.That (e, Is.TypeOf (typeof(NullReferenceException)), "#A02");
+                       }
 
-                       table.EndInit();
+                       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()
+               public void Clear ()
                {
-                       try {
-                               _table.Constraints.Clear (); //Clear all constraints
-                                AssertEquals ("A1", 0, _table.Constraints.Count); //No constraints should remain
-                                _table2.Constraints.Clear ();
-                                AssertEquals ("A2", 0, _table2.Constraints.Count);
-                        }
-                        catch (Exception e) {
-                                Console.WriteLine (e);
-                        }
-
+                       try {
+                               _table.Constraints.Clear (); //Clear all constraints
+                               Assert.That (_table.Constraints.Count, Is.EqualTo (0), "A1"); //No constraints should remain
+                               _table2.Constraints.Clear ();
+                               Assert.That (_table2.Constraints.Count, Is.EqualTo (0), "A2"); //No constraints should remain
+                       } catch (Exception e) {
+                               Console.WriteLine (e);
+                       }
                }
 
                [Test]
                [Ignore ("This never works on MS.NET (and it should not)")]
-               public void CanRemove()
+               public void CanRemove ()
                {
-                       AssertEquals ("A1", false, _table.Constraints.CanRemove (_table.Constraints [0]));
-
+                       Assert.That (_table.Constraints.CanRemove (_table.Constraints [0]), Is.False, "A1");
                }
 
                [Test]
-               public void CollectionChanged()
+               public void CollectionChanged ()
                {
                }
 #if false
@@ -458,28 +429,26 @@ namespace MonoTests.System.Data
 
                //[Test]
                [Ignore ("MS.NET fails this test (and it should fail)")]
-               public void Remove()
+               public void Remove ()
                {
                        _table2.Constraints.Remove (_table2.Constraints [1]); //Remove constraint and again add it
-                        AssertEquals ("A1", 1, _table2.Constraints.Count);                      
-                        UniqueConstraint _constraint4 = new UniqueConstraint ("UK2", _table2.Columns [1]);                                                                               
-                        // Add the constraints.
-                        Constraint [] constraints = {_constraint4};
-                        _table2.Constraints.AddRange (constraints);
+                       Assert.That (_table2.Constraints.Count, Is.EqualTo (1), "A1");
+                       UniqueConstraint _constraint4 = new UniqueConstraint ("UK2", _table2.Columns [1]);                                                                               
+                       // Add the constraints.
+                       Constraint [] constraints = {_constraint4};
+                       _table2.Constraints.AddRange (constraints);
                }
 
                [Test]
-               public void RemoveExceptions()
+               public void RemoveExceptions ()
                {
                        try {
-                                //Remove constraint that cannot be removed
-                                _table.Constraints.Remove (_table.Constraints [0]);
-                               Fail ("A1");
+                               //Remove constraint that cannot be removed
+                               _table.Constraints.Remove (_table.Constraints [0]);
+                               Assert.Fail ("A1");
                        } catch (Exception e) {
-                               AssertEquals ("A2", typeof (IndexOutOfRangeException), e.GetType ());
-                        }
-                }
-
+                               Assert.That (e, Is.TypeOf (typeof(IndexOutOfRangeException)), "A2");
+                       }
+               }
        }
-       
 }
index 777e5dd7f906079b1d9f86c3b69fcf6726c34f92..b8011577bd39aa5fc2f01c7b9fd2afe864d48d23 100644 (file)
@@ -31,8 +31,8 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-
 using NUnit.Framework;
+using NUnit.Framework.SyntaxHelpers;
 using System;
 using System.Data;
 
@@ -55,33 +55,35 @@ namespace MonoTests.System.Data
 //     }
 
        [TestFixture]
-       public class ConstraintTest : Assertion
+       public class ConstraintTest
        {
                private DataTable _table;
                private Constraint _constraint1;
                private Constraint _constraint2;
 
                [SetUp]
-               public void GetReady() {
+               public void GetReady ()
+               {
 
                        //Setup DataTable
-                       _table = new DataTable("TestTable");
+                       _table = new DataTable ("TestTable");
 
-                       _table.Columns.Add("Col1",typeof(int));
-                       _table.Columns.Add("Col2",typeof(int));
+                       _table.Columns.Add ("Col1", typeof(int));
+                       _table.Columns.Add ("Col2", typeof(int));
 
                        //Use UniqueConstraint to test Constraint Base Class
-                       _constraint1 = new UniqueConstraint(_table.Columns[0],false); 
-                       _constraint2 = new UniqueConstraint(_table.Columns[1],false); 
+                       _constraint1 = new UniqueConstraint (_table.Columns [0], false); 
+                       _constraint2 = new UniqueConstraint (_table.Columns [1], false); 
 
                        // not sure why this is needed since a new _table was just created
                        // for us, but this Clear() keeps the tests from throwing
                        // an exception when the Add() is called.
-                       _table.Constraints.Clear();
+                       _table.Constraints.Clear ();
                }  
-               
+
                [Test]
-               public void SetConstraintNameNullOrEmptyExceptions() {
+               public void SetConstraintNameNullOrEmptyExceptions ()
+               {
                        bool exceptionCaught = false;
                        string name = null;
 
@@ -89,8 +91,10 @@ namespace MonoTests.System.Data
 
                        for (int i = 0; i <= 1; i++) {
                                exceptionCaught = false;
-                               if (0 == i) name = null;
-                               if (1 == i) name = String.Empty;
+                               if (0 == i)
+                                       name = null;
+                               if (1 == i)
+                                       name = String.Empty;
        
                                try {
                                
@@ -99,16 +103,13 @@ namespace MonoTests.System.Data
                                        //or empty while the constraint is part of the
                                        //collection
                                        _constraint1.ConstraintName = name; 
-                               }
-                               catch (ArgumentException){ 
+                               } catch (ArgumentException) { 
                                        exceptionCaught = true;
-                               }
-                               catch {
-                                       Fail("Wrong exception type thrown.");
+                               } catch {
+                                       Assert.Fail ("Wrong exception type thrown.");
                                }
                                
-                               Assert("Failed to throw exception.",
-                                       true == exceptionCaught);
+                               Assert.That (exceptionCaught, Is.True, "Failed to throw exception.");
                        }       
                }
 
@@ -119,29 +120,32 @@ namespace MonoTests.System.Data
                        _constraint1.ConstraintName = "Dog";
                        _constraint2.ConstraintName = "Cat";
 
-                       _table.Constraints.Add(_constraint1);
-                       _table.Constraints.Add(_constraint2);
+                       _table.Constraints.Add (_constraint1);
+                       _table.Constraints.Add (_constraint2);
 
                        //Should throw DuplicateNameException
                        _constraint2.ConstraintName = "Dog";
                }
 
                [Test]
-               public void ToStringTest() {
+               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]
-               public void GetExtendedProperties() {
+               public void GetExtendedProperties ()
+               {
                        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..c4d5718928029e6d724cae0eb110cdec8360b994 100644 (file)
@@ -27,9 +27,8 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-
-
 using NUnit.Framework;
+using NUnit.Framework.SyntaxHelpers;
 using System;
 using System.Data;
 
@@ -37,341 +36,327 @@ namespace MonoTests.System.Data
 {
 
        [TestFixture]
-       public class DataRelationCollectionTest : Assertion 
+       public class DataRelationCollectionTest
        {
                DataSet _dataset;
-               DataTable _tblparent,_tblchild;
+               DataTable _tblparent, _tblchild;
                DataRelation _relation;
+
                [SetUp]
-               public void GetReady() 
+               public void GetReady ()
                {
-                       _dataset = new DataSet();
-                       _tblparent = new DataTable("Customer");
-                       _tblchild = new DataTable("Order");
-                       _dataset.Tables.Add(_tblchild);
-                       _dataset.Tables.Add(_tblparent);
-                       _dataset.Tables.Add("Item");
-                       _dataset.Tables["Customer"].Columns.Add("custid");
-                       _dataset.Tables["Customer"].Columns.Add("custname");
-                       _dataset.Tables["Order"].Columns.Add("oid");
-                       _dataset.Tables["Order"].Columns.Add("custid");
-                       _dataset.Tables["Order"].Columns.Add("itemid");
-                       _dataset.Tables["Order"].Columns.Add("desc");
-                       _dataset.Tables["Item"].Columns.Add("itemid");
-                       _dataset.Tables["Item"].Columns.Add("desc");
+                       _dataset = new DataSet ();
+                       _tblparent = new DataTable ("Customer");
+                       _tblchild = new DataTable ("Order");
+                       _dataset.Tables.Add (_tblchild);
+                       _dataset.Tables.Add (_tblparent);
+                       _dataset.Tables.Add ("Item");
+                       _dataset.Tables ["Customer"].Columns.Add ("custid");
+                       _dataset.Tables ["Customer"].Columns.Add ("custname");
+                       _dataset.Tables ["Order"].Columns.Add ("oid");
+                       _dataset.Tables ["Order"].Columns.Add ("custid");
+                       _dataset.Tables ["Order"].Columns.Add ("itemid");
+                       _dataset.Tables ["Order"].Columns.Add ("desc");
+                       _dataset.Tables ["Item"].Columns.Add ("itemid");
+                       _dataset.Tables ["Item"].Columns.Add ("desc");
                        
                }
-       
+
                [TearDown]
-               public void Clean() 
+               public void Clean ()
                {
-                       _dataset.Relations.Clear();
+                       _dataset.Relations.Clear ();
                }
-       
+
                [Test]
-               public void Add()
+               public void Add ()
                {
                        DataRelationCollection drcol = _dataset.Relations;
-                       DataColumn parentCol = _dataset.Tables["Customer"].Columns["custid"];
-                       DataColumn childCol = _dataset.Tables["Order"].Columns["custid"];
-                       DataRelation dr = new DataRelation("CustOrder",parentCol,childCol);
+                       DataColumn parentCol = _dataset.Tables ["Customer"].Columns ["custid"];
+                       DataColumn childCol = _dataset.Tables ["Order"].Columns ["custid"];
+                       DataRelation dr = new DataRelation ("CustOrder", parentCol, childCol);
                        
-                       drcol.Add(dr);
-                       AssertEquals("test#1","CustOrder",drcol[0].RelationName);
-                       drcol.Clear();
+                       drcol.Add (dr);
+                       Assert.That (drcol [0].RelationName, Is.EqualTo ("CustOrder"), "test#1");
+                       drcol.Clear ();
                        
-                       drcol.Add(parentCol,childCol);
-                       AssertEquals("test#2",1,drcol.Count);
-                       drcol.Clear();
+                       drcol.Add (parentCol, childCol);
+                       Assert.That (drcol.Count, Is.EqualTo (1), "test#2");
+                       drcol.Clear ();
                        
-                       drcol.Add("NewRelation",parentCol,childCol);
-                       AssertEquals("test#3","NewRelation",drcol[0].RelationName);
-                       drcol.Clear();
+                       drcol.Add ("NewRelation", parentCol, childCol);
+                       Assert.That (drcol [0].RelationName, Is.EqualTo ("NewRelation"), "test#3");
+                       drcol.Clear ();
                        
-                       drcol.Add("NewRelation",parentCol,childCol,false);
-                       AssertEquals("test#4",1,drcol.Count);
-                       drcol.Clear();
+                       drcol.Add ("NewRelation", parentCol, childCol, false);
+                       Assert.That (drcol.Count, Is.EqualTo (1), "test#4");
+                       drcol.Clear ();
                        
-                       drcol.Add("NewRelation",parentCol,childCol,true);
-                       AssertEquals("test#5",1,drcol.Count);
-                       drcol.Clear();
+                       drcol.Add ("NewRelation", parentCol, childCol, true);
+                       Assert.That (drcol.Count, Is.EqualTo (1), "test#5");
+                       drcol.Clear ();
                }
-               
+
                [Test]          
                [ExpectedException(typeof(ArgumentNullException))]
                [Ignore ("It does not pass under MS.NET")]
-               public void AddException1()
+               public void AddException1 ()
                {
                        DataRelationCollection drcol = _dataset.Relations;
                        DataRelation drnull = null;
-                       drcol.Add(drnull);
+                       drcol.Add (drnull);
                }
-               
+
                [Test]
                [ExpectedException(typeof(ArgumentException))]
-               public void AddException2()
+               public void AddException2 ()
                {
                        DataRelationCollection drcol = _dataset.Relations;
-                       DataRelation dr1= new DataRelation("CustOrder"
-                                                       ,_dataset.Tables["Customer"].Columns["custid"]
-                                                       ,_dataset.Tables["Order"].Columns["custid"]);
-                       drcol.Add(dr1);                 
-                       drcol.Add(dr1);
+                       DataRelation dr1 = new DataRelation ("CustOrder"
+                                                       , _dataset.Tables ["Customer"].Columns ["custid"]
+                                                       , _dataset.Tables ["Order"].Columns ["custid"]);
+                       drcol.Add (dr1);                        
+                       drcol.Add (dr1);
                }
-               
+
                [Test]
                [ExpectedException(typeof(DuplicateNameException))]
-               public void AddException3()
+               public void AddException3 ()
                {
                        DataRelationCollection drcol = _dataset.Relations;
-                       DataRelation dr1= new DataRelation("DuplicateName"
-                                                       ,_dataset.Tables["Customer"].Columns["custid"]
-                                                       ,_dataset.Tables["Order"].Columns["custid"]);
-                       DataRelation dr2 = new DataRelation("DuplicateName"
-                                                       ,_dataset.Tables["Item"].Columns["itemid"]
-                                                       ,_dataset.Tables["Order"].Columns["custid"]);
+                       DataRelation dr1 = new DataRelation ("DuplicateName"
+                                                       , _dataset.Tables ["Customer"].Columns ["custid"]
+                                                       , _dataset.Tables ["Order"].Columns ["custid"]);
+                       DataRelation dr2 = new DataRelation ("DuplicateName"
+                                                       , _dataset.Tables ["Item"].Columns ["itemid"]
+                                                       , _dataset.Tables ["Order"].Columns ["custid"]);
                        
-                       drcol.Add(dr1);                 
-                       drcol.Add(dr2);
+                       drcol.Add (dr1);                        
+                       drcol.Add (dr2);
                }
-               
-               
+
                [Test]
-               public void AddRange()
+               public void AddRange ()
                {
                        DataRelationCollection drcol = _dataset.Relations;
-                       DataRelation dr1= new DataRelation("CustOrder"
-                                                       ,_dataset.Tables["Customer"].Columns["custid"]
-                                                       ,_dataset.Tables["Order"].Columns["custid"]);
-                       DataRelation dr2 = new DataRelation("ItemOrder"
-                                                       ,_dataset.Tables["Item"].Columns["itemid"]
-                                                       ,_dataset.Tables["Order"].Columns["custid"]);
-                       drcol.AddRange(new DataRelation[] {dr1,dr2});
+                       DataRelation dr1 = new DataRelation ("CustOrder"
+                                                       , _dataset.Tables ["Customer"].Columns ["custid"]
+                                                       , _dataset.Tables ["Order"].Columns ["custid"]);
+                       DataRelation dr2 = new DataRelation ("ItemOrder"
+                                                       , _dataset.Tables ["Item"].Columns ["itemid"]
+                                                       , _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]
-               public void CanRemove()
+               public void CanRemove ()
                {
                        DataRelationCollection drcol = _dataset.Relations;
-                       DataColumn parentCol = _dataset.Tables["Customer"].Columns["custid"];
-                       DataColumn childCol = _dataset.Tables["Order"].Columns["custid"];
-                       DataRelation dr = new DataRelation("CustOrder",parentCol,childCol);
+                       DataColumn parentCol = _dataset.Tables ["Customer"].Columns ["custid"];
+                       DataColumn childCol = _dataset.Tables ["Order"].Columns ["custid"];
+                       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));
-                       DataRelation dr2 = new DataRelation("ItemOrder"
-                                               ,_dataset.Tables["Item"].Columns["itemid"]
-                                               ,_dataset.Tables["Order"].Columns["custid"]);
-                       AssertEquals("test#3",false,drcol.CanRemove(dr2));
+                       drcol.Add (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"]);
+                       Assert.That (drcol.CanRemove (dr2), Is.False, "test#3");
                }
-               
+
                [Test]
-               public void Clear()
+               public void Clear ()
                {
                        DataRelationCollection drcol = _dataset.Relations;
-                       DataColumn parentCol = _dataset.Tables["Customer"].Columns["custid"];
-                       DataColumn childCol = _dataset.Tables["Order"].Columns["custid"];
-                       drcol.Add(new DataRelation("CustOrder",parentCol,childCol));
-                       drcol.Add("ItemOrder",_dataset.Tables["Item"].Columns["itemid"]
-                                                                ,_dataset.Tables["Order"].Columns["itemid"]);
-                       drcol.Clear();
-                       AssertEquals("test#1",0,drcol.Count);
+                       DataColumn parentCol = _dataset.Tables ["Customer"].Columns ["custid"];
+                       DataColumn childCol = _dataset.Tables ["Order"].Columns ["custid"];
+                       drcol.Add (new DataRelation ("CustOrder", parentCol, childCol));
+                       drcol.Add ("ItemOrder", _dataset.Tables ["Item"].Columns ["itemid"]
+                                                                , _dataset.Tables ["Order"].Columns ["itemid"]);
+                       drcol.Clear ();
+                       Assert.That (drcol.Count, Is.EqualTo (0), "test#1");
                }
-               
+
                [Test]
-               public void Contains()
+               public void Contains ()
                {
                        DataRelationCollection drcol = _dataset.Relations;
-                       DataColumn parentCol = _dataset.Tables["Customer"].Columns["custid"];
-                       DataColumn childCol = _dataset.Tables["Order"].Columns["custid"];
-                       DataRelation dr = new DataRelation("CustOrder",parentCol,childCol);
+                       DataColumn parentCol = _dataset.Tables ["Customer"].Columns ["custid"];
+                       DataColumn childCol = _dataset.Tables ["Order"].Columns ["custid"];
+                       DataRelation dr = new DataRelation ("CustOrder", parentCol, childCol);
                        
-                       drcol.Add(dr);
-                       AssertEquals("test#1",true,drcol.Contains(dr.RelationName));
+                       drcol.Add (dr);
+                       Assert.That (drcol.Contains (dr.RelationName), Is.True, "test#1");
                        string drnull = "";
-                       AssertEquals("test#2",false,drcol.Contains(drnull));
-                       dr = new DataRelation("newRelation",childCol,parentCol);
-                       AssertEquals("test#3",false,drcol.Contains("NoSuchRelation"));
+                       Assert.That (drcol.Contains (drnull), Is.False, "test#2");
+                       dr = new DataRelation ("newRelation", childCol, parentCol);
+                       Assert.That (drcol.Contains ("NoSuchRelation"), Is.False, "test#3");
                }
-               
+
                [Test]
-               public void CopyTo()
+               public void CopyTo ()
                {
                        DataRelationCollection drcol = _dataset.Relations;
-                       drcol.Add("CustOrder"
-                                       ,_dataset.Tables["Customer"].Columns["custid"]
-                                       ,_dataset.Tables["Order"].Columns["custid"]);
-                       drcol.Add("ItemOrder"
-                                       ,_dataset.Tables["Item"].Columns["itemid"]
-                                       ,_dataset.Tables["Order"].Columns["custid"]);
+                       drcol.Add ("CustOrder"
+                                       , _dataset.Tables ["Customer"].Columns ["custid"]
+                                       , _dataset.Tables ["Order"].Columns ["custid"]);
+                       drcol.Add ("ItemOrder"
+                                       , _dataset.Tables ["Item"].Columns ["itemid"]
+                                       , _dataset.Tables ["Order"].Columns ["custid"]);
                        
                        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);
+                       drcol.CopyTo (array, 0);
+                       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);
+                       drcol.CopyTo (array1, 2);
+                       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]
-               public void Equals()
+               public void Equals ()
                {
                        DataRelationCollection drcol = _dataset.Relations;
-                       drcol.Add("CustOrder"
-                                       ,_dataset.Tables["Customer"].Columns["custid"]
-                                       ,_dataset.Tables["Order"].Columns["custid"]);
-                       drcol.Add("ItemOrder"
-                                       ,_dataset.Tables["Item"].Columns["itemid"]
-                                       ,_dataset.Tables["Order"].Columns["custid"]);
-                       DataSet newds = new DataSet();
+                       drcol.Add ("CustOrder"
+                                       , _dataset.Tables ["Customer"].Columns ["custid"]
+                                       , _dataset.Tables ["Order"].Columns ["custid"]);
+                       drcol.Add ("ItemOrder"
+                                       , _dataset.Tables ["Item"].Columns ["itemid"]
+                                       , _dataset.Tables ["Order"].Columns ["custid"]);
+                       DataSet newds = new DataSet ();
                        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]
-               public void IndexOf()
+               public void IndexOf ()
                {
                        DataRelationCollection drcol = _dataset.Relations;
-                       DataRelation dr1= new DataRelation("CustOrder"
-                                                       ,_dataset.Tables["Customer"].Columns["custid"]
-                                                       ,_dataset.Tables["Order"].Columns["custid"]);
-                       DataRelation dr2 = new DataRelation("ItemOrder"
-                                                       ,_dataset.Tables["Item"].Columns["itemid"]
-                                                       ,_dataset.Tables["Order"].Columns["custid"]);
-                       drcol.Add(dr1);
-                       drcol.Add(dr2);
+                       DataRelation dr1 = new DataRelation ("CustOrder"
+                                                       , _dataset.Tables ["Customer"].Columns ["custid"]
+                                                       , _dataset.Tables ["Order"].Columns ["custid"]);
+                       DataRelation dr2 = new DataRelation ("ItemOrder"
+                                                       , _dataset.Tables ["Item"].Columns ["itemid"]
+                                                       , _dataset.Tables ["Order"].Columns ["custid"]);
+                       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_"));
-                       DataRelation newdr = new DataRelation("newdr"
-                                                                               ,_dataset.Tables["Customer"].Columns["custid"]
-                                                                               ,_dataset.Tables["Order"].Columns["custid"]);
+                       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]
-               public void Remove()
+               public void Remove ()
                {
                        DataRelationCollection drcol = _dataset.Relations;
-                       DataRelation dr1= new DataRelation("CustOrder"
-                                                       ,_dataset.Tables["Customer"].Columns["custid"]
-                                                       ,_dataset.Tables["Order"].Columns["custid"]);
-                       DataRelation dr2 = new DataRelation("ItemOrder"
-                                                       ,_dataset.Tables["Item"].Columns["itemid"]
-                                                       ,_dataset.Tables["Order"].Columns["custid"]);
-                       drcol.Add(dr1);
-                       drcol.Add(dr2);
+                       DataRelation dr1 = new DataRelation ("CustOrder"
+                                                       , _dataset.Tables ["Customer"].Columns ["custid"]
+                                                       , _dataset.Tables ["Order"].Columns ["custid"]);
+                       DataRelation dr2 = new DataRelation ("ItemOrder"
+                                                       , _dataset.Tables ["Item"].Columns ["itemid"]
+                                                       , _dataset.Tables ["Order"].Columns ["custid"]);
+                       drcol.Add (dr1);
+                       drcol.Add (dr2);
                        
-                       drcol.Remove(dr1);
-                       AssertEquals("test#1", false, drcol.Contains(dr1.RelationName));
-                       drcol.Add(dr1);
+                       drcol.Remove (dr1);
+                       Assert.That (drcol.Contains (dr1.RelationName), Is.False, "test#1");
+                       drcol.Add (dr1);
                        
-                       drcol.Remove("CustOrder");
-                       AssertEquals("test#2", false, drcol.Contains("CustOrder"));
-                       drcol.Add(dr1);
+                       drcol.Remove ("CustOrder");
+                       Assert.That (drcol.Contains ("CustOrder"), Is.False, "test#2");
+                       drcol.Add (dr1);
                        
                        DataRelation drnull = null;
-                       drcol.Remove(drnull);
+                       drcol.Remove (drnull);
                        
-                       DataRelation newdr = new DataRelation("newdr"
-                                                                               ,_dataset.Tables["Customer"].Columns["custid"]
-                                                                               ,_dataset.Tables["Order"].Columns["custid"]);
-                       try
-                       {
-                               drcol.Remove(newdr);
-                               Fail("Err: removed relation which not part of collection");
+                       DataRelation newdr = new DataRelation ("newdr"
+                                                               , _dataset.Tables ["Customer"].Columns ["custid"]
+                                                               , _dataset.Tables ["Order"].Columns ["custid"]);
+                       try {
+                               drcol.Remove (newdr);
+                               Assert.Fail ("Err: removed relation which not part of collection");
+                       } catch (Exception e) {
+                               Assert.That (e, Is.TypeOf (typeof(ArgumentException)), "test#4");
                        }
-                       catch (Exception e)
-                       {
-                               AssertEquals ("test#4", typeof(ArgumentException), e.GetType());
+                       try {
+                               drcol.Remove ("newdr");
+                               Assert.Fail ("Err: removed relation which not part of collection");
+                       } catch (ArgumentException e) {
                        }
-                       try
-                       {
-                               drcol.Remove("newdr");
-                               Fail("Err: removed relation which not part of collection");
-                       }
-                       catch (ArgumentException e)
-                       {
-                       }
-
-                       
                }
-               
+
                [Test]
-               public void RemoveAt()
+               public void RemoveAt ()
                {
                        DataRelationCollection drcol = _dataset.Relations;
-                       DataRelation dr1= new DataRelation("CustOrder"
-                                                       ,_dataset.Tables["Customer"].Columns["custid"]
-                                                       ,_dataset.Tables["Order"].Columns["custid"]);
-                       DataRelation dr2 = new DataRelation("ItemOrder"
-                                                       ,_dataset.Tables["Item"].Columns["itemid"]
-                                                       ,_dataset.Tables["Order"].Columns["custid"]);
-                       drcol.Add(dr1);
-                       drcol.Add(dr2);
+                       DataRelation dr1 = new DataRelation ("CustOrder"
+                                                       , _dataset.Tables ["Customer"].Columns ["custid"]
+                                                       , _dataset.Tables ["Order"].Columns ["custid"]);
+                       DataRelation dr2 = new DataRelation ("ItemOrder"
+                                                       , _dataset.Tables ["Item"].Columns ["itemid"]
+                                                       , _dataset.Tables ["Order"].Columns ["custid"]);
+                       drcol.Add (dr1);
+                       drcol.Add (dr2);
 
-                       try
-                       {
-                               drcol.RemoveAt(-1);
-                               Fail("the index was out of bound: must have failed");
-                       }
-                       catch(IndexOutOfRangeException e)
-                       {
-                       }
-                       try
-                       {
-                               drcol.RemoveAt(101);
-                               Fail("the index was out of bound: must have failed");
+                       try {
+                               drcol.RemoveAt (-1);
+                               Assert.Fail ("the index was out of bound: must have failed");
+                       } catch (IndexOutOfRangeException e) {
                        }
-                       catch(IndexOutOfRangeException e)
-                       {
+                       try {
+                               drcol.RemoveAt (101);
+                               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]
-               public void ToStringTest()
+               public void ToStringTest ()
                {
                        DataRelationCollection drcol = _dataset.Relations;
-                       DataRelation dr1= new DataRelation("CustOrder"
-                                                       ,_dataset.Tables["Customer"].Columns["custid"]
-                                                       ,_dataset.Tables["Order"].Columns["custid"]);
-                       drcol.Add(dr1); 
-                       AssertEquals("test#1","System.Data.DataRelationCollection",drcol.ToString());
-                       Console.WriteLine(drcol.ToString());
+                       DataRelation dr1 = new DataRelation ("CustOrder"
+                                                       , _dataset.Tables ["Customer"].Columns ["custid"]
+                                                       , _dataset.Tables ["Order"].Columns ["custid"]);
+                       drcol.Add (dr1);        
+                       Assert.That (drcol.ToString (), Is.EqualTo ("System.Data.DataRelationCollection"), "test#1");
+                       Console.WriteLine (drcol.ToString ());
                }
        }
 }
index 9988d11062a33cdc39d86ab5370e9da3502d4220..9c71d2aa51d432965e70fe54687b10d8410db91c 100644 (file)
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
 //\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
-        {\r
+       public class DataRelationTest\r
+       {\r
                private DataSet Set = null;\r
-               private DataTable Mom = null;\r
-               private DataTable Child = null;         \r
+               private DataTable Mom = null;\r
+               private DataTable Child = null;         \r
 \r
                [SetUp]\r
-                public void GetReady() \r
+               public void GetReady ()\r
                {\r
                        Set = new DataSet ();\r
                        Mom = new DataTable ("Mom");\r
@@ -65,77 +65,74 @@ namespace MonoTests.System.Data
                        Child.Columns.Add (Col3);\r
                        Child.Columns.Add (Col4);\r
                }  \r
-                \r
+\r
                [Test]\r
-                public void Foreign ()\r
-                {\r
+               public void Foreign ()\r
+               {\r
                        DataRelation Relation = new DataRelation ("Rel", Mom.Columns [1], Child.Columns [0]);\r
                        Set.Relations.Add (Relation);\r
 \r
-                       DataRow Row = Mom.NewRow ();\r
-                       Row [0] = "Teresa";\r
-                       Row [1] = "Jack";\r
-                       Mom.Rows.Add (Row);\r
+                       DataRow Row = Mom.NewRow ();\r
+                       Row [0] = "Teresa";\r
+                       Row [1] = "Jack";\r
+                       Mom.Rows.Add (Row);\r
                        \r
-                       Row = Mom.NewRow ();\r
-                       Row [0] = "Teresa";\r
-                       Row [1] = "Dick";\r
-                       Mom.Rows.Add (Row);\r
+                       Row = Mom.NewRow ();\r
+                       Row [0] = "Teresa";\r
+                       Row [1] = "Dick";\r
+                       Mom.Rows.Add (Row);\r
                        \r
-                       Row = Mom.NewRow ();\r
-                       Row [0] = "Mary";\r
-                       Row [1] = "Harry";\r
+                       Row = Mom.NewRow ();\r
+                       Row [0] = "Mary";\r
+                       Row [1] = "Harry";\r
                        \r
-                       Row = Child.NewRow ();\r
-                       Row [0] = "Jack";\r
-                       Row [1] = 16;\r
-                       Child.Rows.Add (Row);\r
+                       Row = Child.NewRow ();\r
+                       Row [0] = "Jack";\r
+                       Row [1] = 16;\r
+                       Child.Rows.Add (Row);\r
                        \r
-                       Row = Child.NewRow ();\r
-                       Row [0] = "Dick";\r
-                       Row [1] = 56;\r
-                       Child.Rows.Add (Row);\r
+                       Row = Child.NewRow ();\r
+                       Row [0] = "Dick";\r
+                       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
+                       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
-                       Row [1] = "Dick";\r
+                       Row = Mom.NewRow ();\r
+                       Row [0] = "Teresa";\r
+                       Row [1] = "Dick";\r
                        \r
-                       try {\r
-                               Mom.Rows.Add (Row);\r
-                               Fail ("test#03");\r
-                       } catch (Exception e) {\r
-                               AssertEquals ("test#04", typeof (ConstraintException), e.GetType ());\r
+                       try {\r
+                               Mom.Rows.Add (Row);\r
+                               Assert.Fail ("test#03");\r
+                       } catch (Exception e) {\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
-                       }                       \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
-                       \r
-                        Row = Child.NewRow ();                               \r
-                        Row [0] = "Jack";                                    \r
-                        Row [1] = 16;                                        \r
-                       \r
-                        try {                                                \r
-                                Child.Rows.Add (Row);                               \r
-                                Fail ("test#07");                                   \r
-                        } catch (Exception e) {                              \r
-                                AssertEquals ("test#08", typeof (InvalidConstraintException), e.GetType ());\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
-                        }                                                    \r
-\r
-                }\r
+                       Row [0] = "Teresa";                                  \r
+                       Row [1] = "Mich";                                    \r
+                       Mom.Rows.Add (Row);                                  \r
+                       Assert.That (Child.Rows.Count, Is.EqualTo (1), "test#06");\r
+                       \r
+                       Row = Child.NewRow ();                               \r
+                       Row [0] = "Jack";                                    \r
+                       Row [1] = 16;                                        \r
+                       \r
+                       try {                                                \r
+                               Child.Rows.Add (Row);                               \r
+                               Assert.Fail ("test#07");\r
+                       } catch (Exception e) {                              \r
+                               Assert.That (e, Is.TypeOf (typeof(InvalidConstraintException)), "test#08");\r
+                       }                                                    \r
+               }\r
 \r
                [Test]\r
                [ExpectedException (typeof(InvalidConstraintException))]\r
@@ -154,80 +151,77 @@ 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
-               \r
+\r
                [Test]\r
                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
+\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
-                       \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
                [Test]\r
                public void Creation ()\r
                {\r
-                       \r
                        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
+\r
                [Test]\r
                public void Creation2 ()\r
                {\r
@@ -259,7 +253,6 @@ namespace MonoTests.System.Data
                        Hubby.Columns.Add (Col7);\r
                        Hubby.Columns.Add (Col8);\r
                        \r
-                       \r
                        DataColumn [] Parents = new DataColumn [2];\r
                        Parents [0] = Col2;\r
                        Parents [1] = Col3;\r
@@ -270,10 +263,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,85 +275,82 @@ 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
+\r
                [Test]\r
                public void Creation3 ()\r
                {\r
-\r
                        DataRelation Relation = new DataRelation ("Rel", Mom.Columns [1], Child.Columns [0], false);\r
                        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
                [Test]\r
                public void Creation4 ()\r
                {\r
-                       \r
                        DataRelation Relation = new DataRelation ("Rel", "Mom", "Child", \r
                                                                  new string [] {"ChildName"},\r
                                                                  new string [] {"Name"}, true);\r
                        \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 +358,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,67 +386,66 @@ 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
+\r
                [Test]\r
                public void ChildRows ()\r
                {\r
-                       \r
                        DataRelation Relation = new DataRelation ("Rel", Mom.Columns [1], Child.Columns [0]);\r
                        Set.Relations.Add (Relation);\r
                        \r
@@ -482,17 +471,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
+       }\r
 }\r
index 49ce21be7e1a0f68e14a3b707101c82860ff2307..ae61651797d61f819043cd6a364b0a1d80d27cc9 100644 (file)
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-
 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;
 
                [SetUp]
-               public void GetReady() {
+               public void GetReady ()
+               {
 
                        //Setup DataTable
-                       _table = new DataTable("TestTable");
-                       _table.Columns.Add("Col1",typeof(int));
-                       _table.Columns.Add("Col2",typeof(int));
-                       _table.Columns.Add("Col3",typeof(int));
+                       _table = new DataTable ("TestTable");
+                       _table.Columns.Add ("Col1", typeof(int));
+                       _table.Columns.Add ("Col2", typeof(int));
+                       _table.Columns.Add ("Col3", typeof(int));
 
                }  
 
                [Test]
-               public void CtorExceptions() {
+               public void CtorExceptions ()
+               {
                        //UniqueConstraint(string name, DataColumn column, bool isPrimaryKey)
 
                        UniqueConstraint cst;
                        
                        //must have DataTable exception
-                       try{
+                       try {
                                //Should throw an ArgumentException
                                //Can only add DataColumns that are attached
                                //to a DataTable
-                               cst = new UniqueConstraint(new DataColumn(""));
+                               cst = new UniqueConstraint (new DataColumn (""));
 
-                               Fail("Failed to throw ArgumentException.");
-                       } 
-                       catch (Exception e) {
-                               AssertEquals ("test#02", typeof (ArgumentException), e.GetType ());
-                               // Never premise English.
-                               // AssertEquals ("test#03", "Column must belong to a table.", e.Message);
-                        }        
+                               Assert.Fail ("Failed to throw ArgumentException.");
+                       } catch (Exception e) {
+                               Assert.That (e, Is.TypeOf (typeof(ArgumentException)), "test#02");
+                       }        
 
                        //Null exception
                        try {
                                //Should throw argument null exception
-                               cst = new UniqueConstraint((DataColumn)null);
+                               cst = new UniqueConstraint ((DataColumn)null);
+                       } catch (Exception e) {
+                               Assert.That (e, Is.TypeOf (typeof(NullReferenceException)), "test#05");
                        }
-                        catch (Exception e) {
-                               AssertEquals ("test#05", typeof (NullReferenceException), e.GetType ());
-                               // Never premise English.
-                                //AssertEquals ("test#06", "Object reference not set to an instance of an object.", e.Message);
-                        }
                        
                        try {
                                //Should throw exception
                                //must have at least one valid column
                                //InvalidConstraintException is thrown by msft ver
-                               cst = new UniqueConstraint(new DataColumn [] {});
-
-                               Fail("B1: Failed to throw InvalidConstraintException.");
-                       }
-                       catch (InvalidConstraintException) {}
-                       catch (AssertionException exc) {throw exc;}
-                       catch {
-                               Fail("A3: Wrong Exception type.");
+                               cst = new UniqueConstraint (new DataColumn [] {});
+
+                               Assert.Fail ("B1: Failed to throw InvalidConstraintException.");
+                       } catch (InvalidConstraintException) {
+                       } catch (AssertionException exc) {
+                               throw exc;
+                       catch {
+                               Assert.Fail ("A3: Wrong Exception type.");
                        }
 
-                       DataTable dt = new DataTable("Table1");
-                       dt.Columns.Add("Col1",typeof(int));
-                       DataTable dt2 = new DataTable("Table2");
-                       dt2.Columns.Add("Col1",typeof(int));
+                       DataTable dt = new DataTable ("Table1");
+                       dt.Columns.Add ("Col1", typeof(int));
+                       DataTable dt2 = new DataTable ("Table2");
+                       dt2.Columns.Add ("Col1", typeof(int));
 
-                       DataSet ds = new DataSet();
-                       ds.Tables.Add(dt);
-                       ds.Tables.Add(dt2);
+                       DataSet ds = new DataSet ();
+                       ds.Tables.Add (dt);
+                       ds.Tables.Add (dt2);
 
                        //columns from two different tables.
                        try {
                                //next line should throw
                                //can't have columns from two different tables
-                               cst = new UniqueConstraint(new DataColumn [] { 
+                               cst = new UniqueConstraint (new DataColumn [] { 
                                                 dt.Columns[0], dt2.Columns[0]});
 
-                               Fail("B2: Failed to throw InvalidConstraintException");
-                       }
-                       catch (InvalidConstraintException) {}
-                       catch (AssertionException exc) {throw exc;}
-                       catch {
-                               Fail("A4: Wrong Exception type.");
+                               Assert.Fail ("B2: Failed to throw InvalidConstraintException");
+                       } catch (InvalidConstraintException) {
+                       } catch (AssertionException exc) {
+                               throw exc;
+                       catch {
+                               Assert.Fail ("A4: Wrong Exception type.");
                        }
-                       
-
-                       
                }
 
                [Test]
-               public void Ctor() {
-                       
+               public void Ctor ()
+               {
                        UniqueConstraint cst;
                
                        //Success case
                        try {
-                               cst = new UniqueConstraint(_table.Columns[0]);
-                       }
-                       catch (Exception exc) {
-                               Fail("A1: Failed to ctor. " + exc.ToString());
+                               cst = new UniqueConstraint (_table.Columns [0]);
+                       } catch (Exception exc) {
+                               Assert.Fail ("A1: Failed to ctor. " + exc.ToString ());
                        }
 
-                       
                        try {
-                               cst = new UniqueConstraintnew DataColumn [] {
+                               cst = new UniqueConstraint (new DataColumn [] {
                                                _table.Columns[0], _table.Columns[1]});
-                       }
-                       catch (Exception exc) {
-                               Fail("A2: Failed to ctor. " + exc.ToString());
+                       } catch (Exception exc) {
+                               Assert.Fail ("A2: Failed to ctor. " + exc.ToString ());
                        }
 
-                       
                        //table is set on ctor
-                       cst = new UniqueConstraint(_table.Columns[0]);
+                       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 UniqueConstraintnew DataColumn [] {
+                       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);
+                       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.");
                }
 
                [Test]
-               public void Unique ()                             
+               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]});     
+                       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);
-                }                                                     
-               
+                       _table.Constraints.Add (U);
+                       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]
-               public void EqualsAndHashCode() {
-                       UniqueConstraint cst = new UniqueConstraint( new DataColumn [] {
+               public void EqualsAndHashCode ()
+               {
+                       UniqueConstraint cst = new UniqueConstraint (new DataColumn [] {
                                        _table.Columns[0], _table.Columns[1]});
-                       UniqueConstraint cst2 = new UniqueConstraintnew DataColumn [] {
+                       UniqueConstraint cst2 = new UniqueConstraint (new DataColumn [] {
                                         _table.Columns[1], _table.Columns[0]});
 
-                       UniqueConstraint cst3 = new UniqueConstraint(_table.Columns[0]);
-                       UniqueConstraint cst4 = new UniqueConstraint(_table.Columns[2]);
+                       UniqueConstraint cst3 = new UniqueConstraint (_table.Columns [0]);
+                       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]