* Removed AllTests.cs and TheTests.cs
authorMartin Willemoes Hansen <mwh@mono-cvs.ximian.com>
Thu, 13 Mar 2003 18:16:01 +0000 (18:16 -0000)
committerMartin Willemoes Hansen <mwh@mono-cvs.ximian.com>
Thu, 13 Mar 2003 18:16:01 +0000 (18:16 -0000)
        * NUnit20ified NameTableTests.cs, SelectNodesTests.cs,
          XmlAttributeCollectionTests.cs, XmlAttributeTests.cs,
          XmlCDataSectionTests.cs, XmlCharacterDataTests.cs,
          XmlCommentTests.cs, XmlDeclarationTests.cs,
          XmlDocumentFragmentTests.cs, XmlDocumentTests.cs,
          XmlDocumentTypeTests.cs, XmlElementTests.cs,
          XmlEntityReferenceTests.cs, XmlNamespaceManagerTests.cs,
          XmlNodeListTests.cs, XmlNodeReaderTests.cs,
          XmlNodeTests.cs, XmlProcessingInstructionTests.cs,
          XmlSignificantWhitespaceTests.cs, XmlTextReaderTests.cs,
          XmlTextTests.cs, XmlTextWriterTests.cs,
          XmlWhiteSpaceTests.cs, XmlWriterTests.cs,
          XPathNavigatorEvaluateTests.cs, XPathNavigatorMatchesTests.cs,
          XPathNavigatorTests.cs, makefile.gnu, System.XML_linux_test.args
        * Commited Atsushi Eno changes to System.XML_test.build

svn path=/trunk/mcs/; revision=12472

33 files changed:
mcs/class/System.XML/Test/AllTests.cs [deleted file]
mcs/class/System.XML/Test/ChangeLog
mcs/class/System.XML/Test/NameTableTests.cs
mcs/class/System.XML/Test/SelectNodesTests.cs
mcs/class/System.XML/Test/System.XML_linux_test.args
mcs/class/System.XML/Test/System.XML_test.build
mcs/class/System.XML/Test/TheTests.cs [deleted file]
mcs/class/System.XML/Test/XPathNavigatorEvaluateTests.cs
mcs/class/System.XML/Test/XPathNavigatorMatchesTests.cs
mcs/class/System.XML/Test/XPathNavigatorTests.cs
mcs/class/System.XML/Test/XmlAttributeCollectionTests.cs
mcs/class/System.XML/Test/XmlAttributeTests.cs
mcs/class/System.XML/Test/XmlCDataSectionTests.cs
mcs/class/System.XML/Test/XmlCharacterDataTests.cs
mcs/class/System.XML/Test/XmlCommentTests.cs
mcs/class/System.XML/Test/XmlDeclarationTests.cs
mcs/class/System.XML/Test/XmlDocumentFragmentTests.cs
mcs/class/System.XML/Test/XmlDocumentTests.cs
mcs/class/System.XML/Test/XmlDocumentTypeTests.cs
mcs/class/System.XML/Test/XmlElementTests.cs
mcs/class/System.XML/Test/XmlEntityReferenceTests.cs
mcs/class/System.XML/Test/XmlNamespaceManagerTests.cs
mcs/class/System.XML/Test/XmlNodeListTests.cs
mcs/class/System.XML/Test/XmlNodeReaderTests.cs
mcs/class/System.XML/Test/XmlNodeTests.cs
mcs/class/System.XML/Test/XmlProcessingInstructionTests.cs
mcs/class/System.XML/Test/XmlSignificantWhitespaceTests.cs
mcs/class/System.XML/Test/XmlTextReaderTests.cs
mcs/class/System.XML/Test/XmlTextTests.cs
mcs/class/System.XML/Test/XmlTextWriterTests.cs
mcs/class/System.XML/Test/XmlWhiteSpaceTests.cs
mcs/class/System.XML/Test/XmlWriterTests.cs
mcs/class/System.XML/Test/makefile.gnu

diff --git a/mcs/class/System.XML/Test/AllTests.cs b/mcs/class/System.XML/Test/AllTests.cs
deleted file mode 100644 (file)
index 3e03dd5..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-// Author:
-//   Mario Martinez (mariom925@home.com)
-//
-// (C) Ximian, Inc.  http://www.ximian.com
-//
-
-using NUnit.Framework;
-
-namespace MonoTests.System.Xml
-{
-       /// <summary>
-       ///   Combines all unit tests for the System.XML.dll assembly
-       ///   into one test suite.
-       /// </summary>
-       public class AllTests : TestCase
-       {
-               public AllTests (string name) : base (name) {}
-
-               public static ITest Suite {
-                       get {
-                               TestSuite suite =  new TestSuite ();
-                               suite.AddTest (new TestSuite (typeof (XmlProcessingInstructionTests)));
-                               suite.AddTest (new TestSuite (typeof (XmlTextTests)));
-                               suite.AddTest (new TestSuite (typeof (XmlTextReaderTests)));
-                               suite.AddTest (new TestSuite (typeof (XmlWriterTests)));
-                               suite.AddTest (new TestSuite (typeof (XmlTextWriterTests)));
-                               suite.AddTest (new TestSuite (typeof (XmlNodeReaderTests)));
-                               suite.AddTest (new TestSuite (typeof (XmlNamespaceManagerTests)));
-                               suite.AddTest (new TestSuite (typeof (XmlAttributeTests)));
-                               suite.AddTest (new TestSuite (typeof (XmlAttributeCollectionTests)));
-                               suite.AddTest (new TestSuite (typeof (XmlDocumentTests)));
-                               suite.AddTest (new TestSuite (typeof (XmlDocumentFragmentTests)));
-                               suite.AddTest (new TestSuite (typeof (NameTableTests)));
-                               suite.AddTest (new TestSuite (typeof (XmlElementTests)));
-                               suite.AddTest (new TestSuite (typeof (XmlEntityReferenceTests)));
-                               suite.AddTest (new TestSuite (typeof (XmlNodeTests)));
-                               suite.AddTest (new TestSuite (typeof (XmlNodeListTests)));
-                               suite.AddTest (new TestSuite (typeof (XmlCharacterDataTests)));
-                               suite.AddTest (new TestSuite (typeof (XmlCommentTests)));
-                               suite.AddTest (new TestSuite (typeof (XmlCDataSectionTests)));
-                               suite.AddTest (new TestSuite (typeof (XmlWhitespaceTests)));
-                               suite.AddTest (new TestSuite (typeof (XmlSignificantWhitespaceTests)));
-                               suite.AddTest (new TestSuite (typeof (XmlDeclarationTests)));
-                               suite.AddTest (new TestSuite (typeof (XmlDocumentTypeTests)));
-                               suite.AddTest (new TestSuite (typeof (XPathNavigatorTests)));
-                               suite.AddTest (new TestSuite (typeof (SelectNodesTests)));
-                               suite.AddTest (new TestSuite (typeof (XPathNavigatorMatchesTests)));
-                               suite.AddTest (new TestSuite (typeof (XPathNavigatorEvaluateTests)));
-                               return suite;
-                       }
-               }
-       }
-}
index 3065e4dcc541b629d4dcc62771da11d431088941..e3d9ced73d4405e06498b51f4fe2503e1ffd108a 100644 (file)
@@ -1,3 +1,21 @@
+2003-03-13  Martin Willemoes Hansen <mwh@sysrq.dk>
+       * Removed AllTests.cs and TheTests.cs
+       * NUnit20ified NameTableTests.cs, SelectNodesTests.cs,
+          XmlAttributeCollectionTests.cs, XmlAttributeTests.cs,
+          XmlCDataSectionTests.cs, XmlCharacterDataTests.cs,
+          XmlCommentTests.cs, XmlDeclarationTests.cs,
+          XmlDocumentFragmentTests.cs, XmlDocumentTests.cs,
+          XmlDocumentTypeTests.cs, XmlElementTests.cs,
+          XmlEntityReferenceTests.cs, XmlNamespaceManagerTests.cs,
+          XmlNodeListTests.cs, XmlNodeReaderTests.cs,
+          XmlNodeTests.cs, XmlProcessingInstructionTests.cs,
+          XmlSignificantWhitespaceTests.cs, XmlTextReaderTests.cs,
+          XmlTextTests.cs, XmlTextWriterTests.cs,
+          XmlWhiteSpaceTests.cs, XmlWriterTests.cs,
+          XPathNavigatorEvaluateTests.cs, XPathNavigatorMatchesTests.cs,
+          XPathNavigatorTests.cs, makefile.gnu, System.XML_linux_test.args 
+       * Commited Atsushi Eno changes to System.XML_test.build
+       
 2003-02-16  Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
 
        * XmlDocumentTests.cs: added TestLoadExternalUri
index ee115132f44120e94e46ea7a1ce9af01ddfa1d60..0949aeb31761282b33f3c28ab2dafd587abaf82f 100755 (executable)
@@ -2,8 +2,10 @@
 // System.Xml.NameTableTests.cs
 //
 // Author: Duncan Mak (duncan@ximian.com)
+// Author: Martin Willemoes Hansen (mwh@sysrq.dk)
 //
 // (C) Ximian, Inc.
+// (C) 2003 Martin Willemoes Hansen
 //
 
 using System;
@@ -13,16 +15,13 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class NameTableTests : TestCase
+       [TestFixture]
+       public class NameTableTests
        {
                NameTable table;
                
-               public NameTableTests (string name)
-                       : base (name)
-               {
-               }
-
-               protected override void SetUp ()
+               [SetUp]
+               public void GetReady ()
                {
                        table = new NameTable ();
                }
@@ -30,42 +29,46 @@ namespace MonoTests.System.Xml
                //
                // Tests System.Xml.NameTable.Add (string)
                //              
-               public void TestAdd1 ()
+               [Test]
+               public void Add1 ()
                {
                        string add = "add1";
                        string testAdd = table.Add (add);
-                       AssertEquals (add, testAdd);
-                       AssertSame (add, testAdd);
+                       Assertion.AssertEquals (add, testAdd);
+                       Assertion.AssertSame (add, testAdd);
                }
 
                //
                // Tests System.Xml.NameTable.Add (char[], int, int)
                //              
-               public void TestAdd2 ()
+               [Test]
+               public void Add2 ()
                {
                        char[] test = new char [4] { 'a', 'd', 'd', '2' };
                        int index = 0;
                        int length = 3; // "add"                        
 
-                       AssertEquals ("add", table.Add (test, index, length));
+                       Assertion.AssertEquals ("add", table.Add (test, index, length));
                }
 
                //
                // Tests System.Xml.NameTable.Get (string)
                //
-               public void TestGet1 ()
+               [Test]
+               public void Get1 ()
                {
                        string get1 = "get1";
                        string testGet = table.Add (get1);                      
 
-                       AssertEquals (table.Get (get1), testGet);
-                       AssertSame (get1, testGet );
+                       Assertion.AssertEquals (table.Get (get1), testGet);
+                       Assertion.AssertSame (get1, testGet );
                }
 
                //
                // Tests System.Xml.NameTable.Get (char[], int, int)
                //
-               public void TestGet2 ()
+               [Test]
+               public void Get2 ()
                {                                               
                        char[] test = new char [4] { 'g', 'e', 't', '2' };
                        int index = 0; 
@@ -73,19 +76,20 @@ namespace MonoTests.System.Xml
                        
                        string testGet = table.Add (test, index, length);                       
 
-                       AssertEquals (table.Get (test, index, length), testGet);
+                       Assertion.AssertEquals (table.Get (test, index, length), testGet);
                }
 
                //
                // Tests System.Xml.NameTable.Get (char[], int, 0)
                //
-               public void TestGet3 ()
+               [Test]
+               public void Get3 ()
                {
                        char[] test = new char [4] { 't', 'e', 's', 't' };
                        int index = 0;
                        int length = 0;
 
-                       AssertEquals (table.Get (test, index, length), String.Empty);
+                       Assertion.AssertEquals (table.Get (test, index, length), String.Empty);
                }
        }
 }
index 3b66bf60026d25473b571746f04f4abfea20dfad..c0d3e8fc71decf030536df317eacf2a4ed23dde6 100644 (file)
@@ -1,12 +1,13 @@
 //
 // MonoTests.System.Xml.SelectNodesTests
 //
-// Author:
-//   Jason Diamond <jason@injektilo.org>
+// Author: Jason Diamond <jason@injektilo.org>
+// Author: Martin Willemoes Hansen <mwh@sysrq.dk>
 //
 // (C) 2002 Jason Diamond
+// (C) 2003 Martin Willemoes Hansen
 //
-\r
+
 using System;
 using System.Xml;
 
@@ -14,225 +15,246 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class SelectNodesTests : TestCase
+       [TestFixture]
+       public class SelectNodesTests
        {
-               public SelectNodesTests () : base ("MonoTests.System.Xml.SelectNodesTests testsuite") {}
-               public SelectNodesTests (string name) : base (name) {}
 
-               public void TestRoot ()
+               [Test]
+               public void Root ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo />");
                        XmlNodeList nodes = document.SelectNodes ("/");
-                       AssertEquals (1, nodes.Count);
-                       AssertSame (document, nodes [0]);
+                       Assertion.AssertEquals (1, nodes.Count);
+                       Assertion.AssertSame (document, nodes [0]);
                }
 
-               public void TestDocumentElement ()
+               [Test]
+               public void DocumentElement ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo />");
                        XmlNodeList nodes = document.SelectNodes ("/foo");
-                       AssertEquals (1, nodes.Count);
-                       AssertSame (document.DocumentElement, nodes [0]);
+                       Assertion.AssertEquals (1, nodes.Count);
+                       Assertion.AssertSame (document.DocumentElement, nodes [0]);
                }
 
-               public void TestBadDocumentElement ()
+               [Test]
+               public void BadDocumentElement ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo />");
                        XmlNodeList nodes = document.SelectNodes ("/bar");
-                       AssertEquals (0, nodes.Count);
+                       Assertion.AssertEquals (0, nodes.Count);
                }
 
-               public void TestElementWildcard ()
+               [Test]
+               public void ElementWildcard ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo><bar /><baz /></foo>");
                        XmlNodeList nodes = document.SelectNodes ("/foo/*");
-                       AssertEquals (2, nodes.Count);
-                       AssertSame (document.DocumentElement.ChildNodes [0], nodes [0]);
-                       AssertSame (document.DocumentElement.ChildNodes [1], nodes [1]);
+                       Assertion.AssertEquals (2, nodes.Count);
+                       Assertion.AssertSame (document.DocumentElement.ChildNodes [0], nodes [0]);
+                       Assertion.AssertSame (document.DocumentElement.ChildNodes [1], nodes [1]);
                }
 
-               public void TestOneChildElement ()
+               [Test]
+               public void OneChildElement ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo><bar /><baz /></foo>");
                        XmlNodeList nodes = document.SelectNodes ("/foo/bar");
-                       AssertEquals (1, nodes.Count);
-                       AssertSame (document.DocumentElement.ChildNodes [0], nodes [0]);
+                       Assertion.AssertEquals (1, nodes.Count);
+                       Assertion.AssertSame (document.DocumentElement.ChildNodes [0], nodes [0]);
                }
 
-               public void TestOneOtherChildElement ()
+               [Test]
+               public void OneOtherChildElement ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo><bar /><baz /></foo>");
                        XmlNodeList nodes = document.SelectNodes ("/foo/baz");
-                       AssertEquals (1, nodes.Count);
-                       AssertSame (document.DocumentElement.ChildNodes [1], nodes [0]);
+                       Assertion.AssertEquals (1, nodes.Count);
+                       Assertion.AssertSame (document.DocumentElement.ChildNodes [1], nodes [0]);
                }
 
-               public void TestTextNode ()
+               [Test]
+               public void TextNode ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo>bar</foo>");
                        XmlNodeList nodes = document.SelectNodes ("/foo/text()");
-                       AssertEquals (1, nodes.Count);
-                       AssertSame (document.DocumentElement.ChildNodes [0], nodes [0]);
+                       Assertion.AssertEquals (1, nodes.Count);
+                       Assertion.AssertSame (document.DocumentElement.ChildNodes [0], nodes [0]);
                }
 
-               public void TestSplitTextNodes ()
+               [Test]
+               public void SplitTextNodes ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo>bar<baz />quux</foo>");
                        XmlNodeList nodes = document.SelectNodes ("/foo/text()");
-                       AssertEquals (2, nodes.Count);
-                       AssertSame (document.DocumentElement.ChildNodes [0], nodes [0]);
-                       AssertSame (document.DocumentElement.ChildNodes [2], nodes [1]);
+                       Assertion.AssertEquals (2, nodes.Count);
+                       Assertion.AssertSame (document.DocumentElement.ChildNodes [0], nodes [0]);
+                       Assertion.AssertSame (document.DocumentElement.ChildNodes [2], nodes [1]);
                }
 
-               public void TestAbbreviatedParentAxis ()
+               [Test]
+               public void AbbreviatedParentAxis ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo><bar /></foo>");
                        XmlNodeList nodes = document.SelectNodes ("/foo/bar/..");
-                       AssertEquals (1, nodes.Count);
-                       AssertSame (document.DocumentElement, nodes [0]);
+                       Assertion.AssertEquals (1, nodes.Count);
+                       Assertion.AssertSame (document.DocumentElement, nodes [0]);
                }
 
-               public void TestFullParentAxis ()
+               [Test]
+               public void FullParentAxis ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo><bar /></foo>");
                        XmlNodeList nodes = document.SelectNodes ("/foo/bar/parent::node()");
-                       AssertEquals (1, nodes.Count);
-                       AssertSame (document.DocumentElement, nodes [0]);
+                       Assertion.AssertEquals (1, nodes.Count);
+                       Assertion.AssertSame (document.DocumentElement, nodes [0]);
                }
 
-               public void TestAbbreviatedAttributeAxis ()
+               [Test]
+               public void AbbreviatedAttributeAxis ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo bar='baz' />");
                        XmlNodeList nodes = document.SelectNodes ("/foo/@bar");
-                       AssertEquals (1, nodes.Count);
-                       AssertSame (document.DocumentElement.Attributes ["bar"], nodes [0]);
+                       Assertion.AssertEquals (1, nodes.Count);
+                       Assertion.AssertSame (document.DocumentElement.Attributes ["bar"], nodes [0]);
                }
 
-               public void TestFullAttributeAxis ()
+               [Test]
+               public void FullAttributeAxis ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo bar='baz' />");
                        XmlNodeList nodes = document.SelectNodes ("/foo/attribute::bar");
-                       AssertEquals (1, nodes.Count);
-                       AssertSame (document.DocumentElement.Attributes ["bar"], nodes [0]);
+                       Assertion.AssertEquals (1, nodes.Count);
+                       Assertion.AssertSame (document.DocumentElement.Attributes ["bar"], nodes [0]);
                }
 
-               public void TestAbbreviatedAttributeWildcard ()
+               [Test]
+               public void AbbreviatedAttributeWildcard ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo bar='baz' quux='quuux' />");
                        XmlNodeList nodes = document.SelectNodes ("/foo/@*");
-                       AssertEquals (2, nodes.Count);
+                       Assertion.AssertEquals (2, nodes.Count);
                        // are the attributes guanteed to be ordered in the node list?
-                       AssertSame (document.DocumentElement.Attributes ["bar"], nodes [0]);
-                       AssertSame (document.DocumentElement.Attributes ["quux"], nodes [1]);
+                       Assertion.AssertSame (document.DocumentElement.Attributes ["bar"], nodes [0]);
+                       Assertion.AssertSame (document.DocumentElement.Attributes ["quux"], nodes [1]);
                }
 
-               public void TestAttributeParent ()
+               [Test]
+               public void AttributeParent ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo bar='baz' />");
                        XmlNodeList nodes = document.SelectNodes ("/foo/@bar/..");
-                       AssertEquals (1, nodes.Count);
-                       AssertSame (document.DocumentElement, nodes [0]);
+                       Assertion.AssertEquals (1, nodes.Count);
+                       Assertion.AssertSame (document.DocumentElement, nodes [0]);
                }
                
-               public void TestUnionOperator ()
+               [Test]
+               public void UnionOperator ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo><bar /><baz /></foo>");
                        XmlNodeList nodes = document.SelectNodes ("/foo/bar|/foo/baz");
-                       AssertEquals (2, nodes.Count);
-                       AssertSame (document.DocumentElement.ChildNodes [0], nodes [0]);
-                       AssertSame (document.DocumentElement.ChildNodes [1], nodes [1]);
+                       Assertion.AssertEquals (2, nodes.Count);
+                       Assertion.AssertSame (document.DocumentElement.ChildNodes [0], nodes [0]);
+                       Assertion.AssertSame (document.DocumentElement.ChildNodes [1], nodes [1]);
                }
                
-               public void TestNodeWildcard ()
+               [Test]
+               public void NodeWildcard ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo><bar />baz<quux /></foo>");
                        XmlNodeList nodes = document.SelectNodes ("/foo/node()");
-                       AssertEquals (3, nodes.Count);
-                       AssertSame (document.DocumentElement.ChildNodes [0], nodes [0]);
-                       AssertSame (document.DocumentElement.ChildNodes [1], nodes [1]);
-                       AssertSame (document.DocumentElement.ChildNodes [2], nodes [2]);
+                       Assertion.AssertEquals (3, nodes.Count);
+                       Assertion.AssertSame (document.DocumentElement.ChildNodes [0], nodes [0]);
+                       Assertion.AssertSame (document.DocumentElement.ChildNodes [1], nodes [1]);
+                       Assertion.AssertSame (document.DocumentElement.ChildNodes [2], nodes [2]);
                }
 
-               public void TestPositionalPredicate ()
+               [Test]
+               public void PositionalPredicate ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo><bar>1</bar><bar>2</bar></foo>");
                        XmlNodeList nodes = document.SelectNodes ("/foo/bar[1]");
-                       AssertEquals (1, nodes.Count);
-                       AssertSame (document.DocumentElement.ChildNodes [0], nodes [0]);
+                       Assertion.AssertEquals (1, nodes.Count);
+                       Assertion.AssertSame (document.DocumentElement.ChildNodes [0], nodes [0]);
                }
 
-               public void TestAllFollowingSiblings ()
+               [Test]
+               public void AllFollowingSiblings ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo><bar /><baz /><quux /></foo>");
                        XmlNodeList nodes = document.SelectNodes ("/foo/bar/following-sibling::*");
-                       AssertEquals (2, nodes.Count);
-                       AssertSame (document.DocumentElement.ChildNodes [1], nodes [0]);
-                       AssertSame (document.DocumentElement.ChildNodes [2], nodes [1]);
+                       Assertion.AssertEquals (2, nodes.Count);
+                       Assertion.AssertSame (document.DocumentElement.ChildNodes [1], nodes [0]);
+                       Assertion.AssertSame (document.DocumentElement.ChildNodes [2], nodes [1]);
                }
 
-               public void TestFollowingSiblingBaz ()
+               [Test]
+               public void FollowingSiblingBaz ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo><bar /><baz /><quux /></foo>");
                        XmlNodeList nodes = document.SelectNodes ("/foo/bar/following-sibling::baz");
-                       AssertEquals (1, nodes.Count);
-                       AssertSame (document.DocumentElement.ChildNodes [1], nodes [0]);
+                       Assertion.AssertEquals (1, nodes.Count);
+                       Assertion.AssertSame (document.DocumentElement.ChildNodes [1], nodes [0]);
                }
 
-               public void TestFollowingSiblingQuux ()
+               [Test]
+               public void FollowingSiblingQuux ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo><bar /><baz /><quux /></foo>");
                        XmlNodeList nodes = document.SelectNodes ("/foo/bar/following-sibling::quux");
-                       AssertEquals (1, nodes.Count);
-                       AssertSame (document.DocumentElement.ChildNodes [2], nodes [0]);
+                       Assertion.AssertEquals (1, nodes.Count);
+                       Assertion.AssertSame (document.DocumentElement.ChildNodes [2], nodes [0]);
                }
 
-               public void TestUnion ()
+               [Test]
+               public void Union ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo />");
                        XmlNodeList nodes = document.SelectNodes ("(/foo) | (/foo)");
-                       AssertEquals (1, nodes.Count);  // bug #27548
-                       AssertSame (document.DocumentElement, nodes [0]);
+                       Assertion.AssertEquals (1, nodes.Count);        // bug #27548
+                       Assertion.AssertSame (document.DocumentElement, nodes [0]);
                }
 
-               public void TestAlphabetDigitMixedName ()
+               [Test]
+               public void AlphabetDigitMixedName ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo1 />");
                        XmlNodeList nodes = document.SelectNodes ("/foo1");
-                       AssertEquals (1, nodes.Count);
-                       AssertSame (document.DocumentElement, nodes [0]);
+                       Assertion.AssertEquals (1, nodes.Count);
+                       Assertion.AssertSame (document.DocumentElement, nodes [0]);
                }
 
-
-               public void TestNamespaceSelect()
+               [Test]
+               public void NamespaceSelect()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<root xmlns=\"urn:foo1:foo2\"/>");
                        XmlNamespaceManager nsmgr = new XmlNamespaceManager(document.NameTable);
                        nsmgr.AddNamespace("foons", "urn:foo1:foo2");
                        XmlNodeList nodes = document.SelectNodes ("/foons:root", nsmgr);
-                       AssertEquals (1, nodes.Count);
+                       Assertion.AssertEquals (1, nodes.Count);
                }
        }
 }
index 029f0962a45986dfb7112dfc5add3ecb670aa795..6525f0ae9012052d373cc79193aafbbea1c5752a 100644 (file)
@@ -1,10 +1,3 @@
---target library
--o System.XML_linux_test.dll
---noconfig
--r ../../lib/corlib.dll
--r ../../lib/System.dll
--r ../../../nunit/NUnitCore_mono.dll
-AllTests.cs
 NameTableTests.cs
 SelectNodesTests.cs
 XmlAttributeCollectionTests.cs
@@ -13,22 +6,22 @@ XmlCDataSectionTests.cs
 XmlCharacterDataTests.cs
 XmlCommentTests.cs
 XmlDeclarationTests.cs
-XmlDocumentTests.cs
 XmlDocumentFragmentTests.cs
+XmlDocumentTests.cs
 XmlDocumentTypeTests.cs
 XmlElementTests.cs
 XmlEntityReferenceTests.cs
 XmlNamespaceManagerTests.cs
 XmlNodeListTests.cs
-XmlNodeTests.cs
 XmlNodeReaderTests.cs
+XmlNodeTests.cs
 XmlProcessingInstructionTests.cs
 XmlSignificantWhitespaceTests.cs
 XmlTextReaderTests.cs
 XmlTextTests.cs
 XmlTextWriterTests.cs
-XmlWriterTests.cs
 XmlWhiteSpaceTests.cs
+XmlWriterTests.cs
 XPathNavigatorEvaluateTests.cs
-XPathNavigatorTests.cs
 XPathNavigatorMatchesTests.cs
+XPathNavigatorTests.cs
index 7e3e2b116e3909aff903cc9fbca6fd2a89dbc9c5..0c2628249a212dfbb44541f7e25848205ec8a604 100644 (file)
@@ -6,7 +6,7 @@
 
 <project name="System.XML_test" default="build">
        <property name="debug" value="false"/>
-       <property name="nunit_home" value="..\..\..\nunit"/>
+       <property name="nunit_home" value="..\..\..\nunit20"/>
 
        <target name="build">
        </target>
                        <arg value="/nowarn:1595"/>
                        <sources>
                                <includes name="**/*.cs"/>
+                               <excludes name="AllTests.cs"/>
                                <excludes name="TheTests.cs"/>
                        </sources>
-                       <references basedir="..\..\..\nunit">
-                               <includes name="NUnitCore.dll"/>
+                       <references basedir="..\..\..\nunit20">
+                               <includes name="NUnit.Framework.dll"/>
                        </references>
                        <arg value="/r:.\System.XML.dll"/>
                </csc>
        </target>
 
        <target name="test" depends="assemblies">
-               <exec program="..\..\..\nunit\NUnitConsole" commandline="MonoTests.System.Xml.AllTests,System.XML_test.dll" failonerror="false"/>
+               <exec program="..\..\..\nunit20\nunit-console.exe" commandline="System.XML_test.dll" failonerror="false"/>
        </target>
 
        <target name="clean">
diff --git a/mcs/class/System.XML/Test/TheTests.cs b/mcs/class/System.XML/Test/TheTests.cs
deleted file mode 100644 (file)
index 6537bed..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-using NUnit.Framework;
-using System;
-using System.Threading;
-using System.Globalization;
-
-namespace MonoTests.System.Xml
-{
-       public class RunXmlTextReaderTests : XmlTextReaderTests
-       {
-               protected override void RunTest ()
-               {
-                       TestEmptyElement ();
-                       TestEmptyElementWithWhitespace ();
-                       TestEmptyElementWithStartAndEndTag ();
-                       TestEmptyElementWithStartAndEndTagWithWhitespace ();
-                       TestNestedEmptyTag ();
-                       TestNestedText ();
-                       TestEmptyElementWithAttribute ();
-                       TestStartAndEndTagWithAttribute ();
-                       TestEmptyElementWithTwoAttributes ();
-                       TestProcessingInstructionBeforeDocumentElement ();
-                       TestCommentBeforeDocumentElement ();
-                       TestPredefinedEntities ();
-                       TestEntityReference ();
-                       TestEntityReferenceInsideText ();
-                       TestCharacterReferences ();
-                       TestEntityReferenceInAttribute ();
-                       TestPredefinedEntitiesInAttribute ();
-                       TestCharacterReferencesInAttribute ();
-                       TestCDATA ();
-                       TestEmptyElementInNamespace ();
-                       TestEmptyElementInDefaultNamespace ();
-                       TestChildElementInNamespace ();
-                       TestChildElementInDefaultNamespace ();
-                       TestAttributeInNamespace ();
-                       TestIsName ();
-                       TestIsNameToken ();
-               }
-       }
-}
-
-namespace MonoTests.System.Xml
-{
-       public class RunXmlNamespaceManagerTests : XmlNamespaceManagerTests
-       {
-               protected override void RunTest ()
-               {
-                       TestNewNamespaceManager ();
-                       TestAddNamespace ();
-                       TestPushScope ();
-                       TestPopScope ();
-               }
-       }
-}
-
-namespace MonoTests.System.Xml
-{
-       public class RunXmlDocumentTests : XmlDocumentTests
-       {
-               protected override void RunTest ()
-               {
-                       TestDocumentElement ();
-               }
-       }
-}
-
-namespace MonoTests
-{
-       public class RunAllTests
-       {
-               public static void AddAllTests (TestSuite suite)
-               {
-                       suite.AddTest (new MonoTests.System.Xml.RunXmlTextReaderTests ());
-                       suite.AddTest (new MonoTests.System.Xml.RunXmlNamespaceManagerTests ());
-                       suite.AddTest (new MonoTests.System.Xml.RunXmlDocumentTests ());
-               }
-       }
-}
-
-class MainApp
-{
-       public static void Main()
-       {
-               Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US");
-
-               TestResult result = new TestResult ();
-               TestSuite suite = new TestSuite ();
-               MonoTests.RunAllTests.AddAllTests (suite);
-               suite.Run (result);
-               MonoTests.MyTestRunner.Print (result);
-       }
-}
-
index a3001792bf5f85b53d686b8f8663f6e6a133bc47..a84107c5eeeb5770c0913b06e8995d1bc508ac9f 100644 (file)
@@ -1,10 +1,12 @@
 //
 // MonoTests.System.Xml.XPathNavigatorEvaluateTests
 //
-// Author:
+// Authors:
 //   Kral Ferch <kral_ferch@hotmail.com>
+//   Martin Willemoes Hansen <mwh@sysrq.dk>
 //
 // (C) 2002 Kral Ferch
+// (C) 2003 Martin Willemoes Hansen
 //
 
 using System;
@@ -15,11 +17,9 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class XPathNavigatorEvaluateTests : TestCase
+       [TestFixture]
+       public class XPathNavigatorEvaluateTests
        {
-               public XPathNavigatorEvaluateTests () : base ("MonoTests.System.Xml.XPathNavigatorEvaluateTests testsuite") {}
-               public XPathNavigatorEvaluateTests (string name) : base (name) {}
-
                XmlDocument document;
                XPathNavigator navigator;
                XmlDocument document2;
@@ -29,7 +29,8 @@ namespace MonoTests.System.Xml
                XPathExpression expression;
                XPathNodeIterator iterator;
 
-               protected override void SetUp ()
+               [SetUp]
+               public void GetReady ()
                {
                        document = new XmlDocument ();
                        document.LoadXml ("<foo><bar/><baz/><qux/><squonk/></foo>");
@@ -44,45 +45,48 @@ namespace MonoTests.System.Xml
                        navigator3 = document3.CreateNavigator ();
                }
 
-               // Testing Core Function Library functions defined at: http://www.w3.org/TR/xpath#corelib
-               public void TestCoreFunctionNodeSetLast ()
+               // Testing Core Funcetion Library functions defined at: http://www.w3.org/TR/xpath#corelib
+               [Test]
+               public void CoreFunctionNodeSetLast ()
                {
                        expression = navigator.Compile("last()");
                        iterator = navigator.Select("/foo");
-                       AssertEquals ("0", navigator.Evaluate ("last()").ToString());
-                       AssertEquals ("0", navigator.Evaluate (expression, null).ToString ());
-                       AssertEquals ("1", navigator.Evaluate (expression, iterator).ToString ());
+                       Assertion.AssertEquals ("0", navigator.Evaluate ("last()").ToString());
+                       Assertion.AssertEquals ("0", navigator.Evaluate (expression, null).ToString ());
+                       Assertion.AssertEquals ("1", navigator.Evaluate (expression, iterator).ToString ());
                        iterator = navigator.Select("/foo/*");
-                       AssertEquals ("4", navigator.Evaluate (expression, iterator).ToString ());
+                       Assertion.AssertEquals ("4", navigator.Evaluate (expression, iterator).ToString ());
                        
-                       AssertEquals("3", navigator2.Evaluate ("string(//bar[last()]/@baz)"));
+                       Assertion.AssertEquals("3", navigator2.Evaluate ("string(//bar[last()]/@baz)"));
                }
 
-               public void TestCoreFunctionNodeSetPosition ()
+               [Test]
+               public void CoreFunctionNodeSetPosition ()
                {
                        expression = navigator.Compile("position()");
                        iterator = navigator.Select("/foo");
-                       AssertEquals ("0", navigator.Evaluate ("position()").ToString ());
-                       AssertEquals ("0", navigator.Evaluate (expression, null).ToString ());
-                       AssertEquals ("0", navigator.Evaluate (expression, iterator).ToString ());
+                       Assertion.AssertEquals ("0", navigator.Evaluate ("position()").ToString ());
+                       Assertion.AssertEquals ("0", navigator.Evaluate (expression, null).ToString ());
+                       Assertion.AssertEquals ("0", navigator.Evaluate (expression, iterator).ToString ());
                        iterator = navigator.Select("/foo/*");
-                       AssertEquals ("0", navigator.Evaluate (expression, iterator).ToString ());
+                       Assertion.AssertEquals ("0", navigator.Evaluate (expression, iterator).ToString ());
                        iterator.MoveNext();
-                       AssertEquals ("1", navigator.Evaluate (expression, iterator).ToString ());
+                       Assertion.AssertEquals ("1", navigator.Evaluate (expression, iterator).ToString ());
                        iterator.MoveNext ();
-                       AssertEquals ("2", navigator.Evaluate (expression, iterator).ToString ());
+                       Assertion.AssertEquals ("2", navigator.Evaluate (expression, iterator).ToString ());
                        iterator.MoveNext ();
-                       AssertEquals ("3", navigator.Evaluate (expression, iterator).ToString ());
+                       Assertion.AssertEquals ("3", navigator.Evaluate (expression, iterator).ToString ());
                }
 
-               public void TestCoreFunctionNodeSetCount ()
+               [Test]
+               public void CoreFunctionNodeSetCount ()
                {
-                       AssertEquals ("5", navigator.Evaluate ("count(//*)").ToString ());
-                       AssertEquals ("1", navigator.Evaluate ("count(//foo)").ToString ());
-                       AssertEquals ("1", navigator.Evaluate ("count(/foo)").ToString ());
-                       AssertEquals ("1", navigator.Evaluate ("count(/foo/bar)").ToString ());
+                       Assertion.AssertEquals ("5", navigator.Evaluate ("count(//*)").ToString ());
+                       Assertion.AssertEquals ("1", navigator.Evaluate ("count(//foo)").ToString ());
+                       Assertion.AssertEquals ("1", navigator.Evaluate ("count(/foo)").ToString ());
+                       Assertion.AssertEquals ("1", navigator.Evaluate ("count(/foo/bar)").ToString ());
 
-                       AssertEquals ("3", navigator2.Evaluate ("count(//bar)").ToString ());
+                       Assertion.AssertEquals ("3", navigator2.Evaluate ("count(//bar)").ToString ());
                }
 
                public void saveTestCoreFunctionNodeSetID ()
@@ -96,28 +100,30 @@ namespace MonoTests.System.Xml
                                "<foo><bar baz='1' qux='hello' /><bar baz='2' qux='world' /></foo>");
                        navigator = document.CreateNavigator();
 
-                       AssertEquals ("hello", navigator.Evaluate ("string(id('1')/@qux)").ToString ());
-                       AssertEquals ("world", navigator.Evaluate ("string(id('2')/@qux)").ToString ());
+                       Assertion.AssertEquals ("hello", navigator.Evaluate ("string(id('1')/@qux)").ToString ());
+                       Assertion.AssertEquals ("world", navigator.Evaluate ("string(id('2')/@qux)").ToString ());
                }
 
-               public void TestCoreFunctionLocalName ()
+               [Test]
+               public void CoreFunctionLocalName ()
                {
-                       AssertEquals ("", navigator.Evaluate ("local-name()").ToString ());
-                       AssertEquals ("", navigator.Evaluate ("local-name(/bogus)").ToString ());
-                       AssertEquals ("foo", navigator.Evaluate ("local-name(/foo)").ToString ());
-                       AssertEquals ("bar", navigator3.Evaluate ("local-name(/foo/*)").ToString ());
+                       Assertion.AssertEquals ("", navigator.Evaluate ("local-name()").ToString ());
+                       Assertion.AssertEquals ("", navigator.Evaluate ("local-name(/bogus)").ToString ());
+                       Assertion.AssertEquals ("foo", navigator.Evaluate ("local-name(/foo)").ToString ());
+                       Assertion.AssertEquals ("bar", navigator3.Evaluate ("local-name(/foo/*)").ToString ());
                }
 
                // TODO:  umm.  Unable to make this return a namespace-uri so far...
-               public void TestCoreFunctionNamespaceURI ()
+               [Test]
+               public void CoreFunctionNamespaceURI ()
                {
                        document.LoadXml ("<foo:bar xmlns:foo='#foo'><foo:baz><foo:qux /></foo:baz></foo:bar>");
                        navigator = document.CreateNavigator ();
 
-                       AssertEquals ("", navigator.Evaluate ("namespace-uri()").ToString ());
-                       AssertEquals ("", navigator.Evaluate ("namespace-uri(/bogus)").ToString ());
-                       //AssertEquals("foo", navigator.Evaluate ("namespace-uri(/bar)").ToString ());
-                       AssertEquals ("", navigator2.Evaluate ("namespace-uri(//bar)").ToString ());
+                       Assertion.AssertEquals ("", navigator.Evaluate ("namespace-uri()").ToString ());
+                       Assertion.AssertEquals ("", navigator.Evaluate ("namespace-uri(/bogus)").ToString ());
+                       //Assertion.AssertEquals("foo", navigator.Evaluate ("namespace-uri(/bar)").ToString ());
+                       Assertion.AssertEquals ("", navigator2.Evaluate ("namespace-uri(//bar)").ToString ());
                }
 
                public void saveTestCoreFunctionString ()
@@ -125,88 +131,91 @@ namespace MonoTests.System.Xml
                        document.LoadXml ("<foo>hello<bar>world</bar><baz>how are you</baz></foo>");
                        navigator = document.CreateNavigator ();
 
-                       AssertEquals ("world", navigator.Evaluate ("string(/foo/*)").ToString ());
-                       AssertEquals ("NaN", navigator.Evaluate ("string(0 div 0)").ToString ());
+                       Assertion.AssertEquals ("world", navigator.Evaluate ("string(/foo/*)").ToString ());
+                       Assertion.AssertEquals ("NaN", navigator.Evaluate ("string(0 div 0)").ToString ());
                        
                        try {
                                navigator.Evaluate ("string(+0)");
-                               Fail ("Expected an XPathException to be thrown.");
+                               Assertion.Fail ("Expected an XPathException to be thrown.");
                        } catch (XPathException) {}
                        
-                       AssertEquals ("0", navigator.Evaluate ("string(-0)").ToString ());                      
-                       AssertEquals ("Infinity", navigator.Evaluate ("string(1 div 0)").ToString ());
-                       AssertEquals ("-Infinity", navigator.Evaluate ("string(-1 div 0)").ToString ());
-                       AssertEquals ("45", navigator.Evaluate ("string(45)").ToString ());
-                       AssertEquals ("-22", navigator.Evaluate ("string(-22)").ToString ());
-                       AssertEquals ("0.25", navigator.Evaluate ("string(.25)").ToString ());
-                       AssertEquals ("-0.25", navigator.Evaluate ("string(-.25)").ToString ());
-                       AssertEquals ("2", navigator.Evaluate ("string(2.0)").ToString ());
-                       AssertEquals ("2.01", navigator.Evaluate ("string(2.01)").ToString ());
-                       AssertEquals ("-3", navigator.Evaluate ("string(-3.0)").ToString ());
-                       AssertEquals ("3.45", navigator.Evaluate ("string(3.45)").ToString ());
+                       Assertion.AssertEquals ("0", navigator.Evaluate ("string(-0)").ToString ());                    
+                       Assertion.AssertEquals ("Infinity", navigator.Evaluate ("string(1 div 0)").ToString ());
+                       Assertion.AssertEquals ("-Infinity", navigator.Evaluate ("string(-1 div 0)").ToString ());
+                       Assertion.AssertEquals ("45", navigator.Evaluate ("string(45)").ToString ());
+                       Assertion.AssertEquals ("-22", navigator.Evaluate ("string(-22)").ToString ());
+                       Assertion.AssertEquals ("0.25", navigator.Evaluate ("string(.25)").ToString ());
+                       Assertion.AssertEquals ("-0.25", navigator.Evaluate ("string(-.25)").ToString ());
+                       Assertion.AssertEquals ("2", navigator.Evaluate ("string(2.0)").ToString ());
+                       Assertion.AssertEquals ("2.01", navigator.Evaluate ("string(2.01)").ToString ());
+                       Assertion.AssertEquals ("-3", navigator.Evaluate ("string(-3.0)").ToString ());
+                       Assertion.AssertEquals ("3.45", navigator.Evaluate ("string(3.45)").ToString ());
 
                        // Wonder what this will look like under a different platform.
-                       AssertEquals("0.33333333333333331", navigator.Evaluate ("string(1 div 3)").ToString ());
+                       Assertion.AssertEquals("0.33333333333333331", navigator.Evaluate ("string(1 div 3)").ToString ());
                }
 
-               public void TestCoreFunctionConcat ()
+               [Test]
+               public void CoreFunctionConcat ()
                {
                        try {
                                navigator.Evaluate ("concat()");
-                               Fail ("Expected an XPathException to be thrown.");
+                               Assertion.Fail ("Expected an XPathException to be thrown.");
                        } catch (XPathException) {}
 
                        try {
                                navigator.Evaluate ("concat('foo')");
-                               Fail ("Expected an XPathException to be thrown.");
+                               Assertion.Fail ("Expected an XPathException to be thrown.");
                        } catch (XPathException) {}
 
-                       AssertEquals ("foobar", navigator.Evaluate ("concat('foo', 'bar')").ToString ());
-                       AssertEquals ("foobarbaz", navigator.Evaluate ("concat('foo', 'bar', 'baz')").ToString ());
-                       AssertEquals ("foobarbazqux", navigator.Evaluate ("concat('foo', 'bar', 'baz', 'qux')").ToString ());
-                       AssertEquals ("foobarbazquxquux", navigator.Evaluate ("concat('foo', 'bar', 'baz', 'qux', 'quux')").ToString ());
+                       Assertion.AssertEquals ("foobar", navigator.Evaluate ("concat('foo', 'bar')").ToString ());
+                       Assertion.AssertEquals ("foobarbaz", navigator.Evaluate ("concat('foo', 'bar', 'baz')").ToString ());
+                       Assertion.AssertEquals ("foobarbazqux", navigator.Evaluate ("concat('foo', 'bar', 'baz', 'qux')").ToString ());
+                       Assertion.AssertEquals ("foobarbazquxquux", navigator.Evaluate ("concat('foo', 'bar', 'baz', 'qux', 'quux')").ToString ());
                }
 
-               public void TestCoreFunctionStartsWith ()
+               [Test]
+               public void CoreFunctionStartsWith ()
                {
                        try {
                                navigator.Evaluate ("starts-with()");
-                               Fail ("Expected an XPathException to be thrown.");
+                               Assertion.Fail ("Expected an XPathException to be thrown.");
                        } catch (XPathException) {}
 
                        try {
                                navigator.Evaluate ("starts-with('foo')");
-                               Fail ("Expected an XPathException to be thrown.");
+                               Assertion.Fail ("Expected an XPathException to be thrown.");
                        } catch (XPathException) {}
 
                        try {
                                navigator.Evaluate ("starts-with('foo', 'bar', 'baz')");
-                               Fail ("Expected an XPathException to be thrown.");
+                               Assertion.Fail ("Expected an XPathException to be thrown.");
                        } catch (XPathException) {}
 
-                       Assert ((bool)navigator.Evaluate ("starts-with('foobar', 'foo')"));
-                       Assert (!(bool)navigator.Evaluate ("starts-with('foobar', 'bar')"));
+                       Assertion.Assert ((bool)navigator.Evaluate ("starts-with('foobar', 'foo')"));
+                       Assertion.Assert (!(bool)navigator.Evaluate ("starts-with('foobar', 'bar')"));
                }
 
-               public void TestCoreFunctionContains ()
+               [Test]
+               public void CoreFunctionContains ()
                {
                        try {
                                navigator.Evaluate ("contains()");
-                               Fail ("Expected an XPathException to be thrown.");
+                               Assertion.Fail ("Expected an XPathException to be thrown.");
                        } catch (XPathException) {}
 
                        try {
                                navigator.Evaluate ("contains('foo')");
-                               Fail ("Expected an XPathException to be thrown.");
+                               Assertion.Fail ("Expected an XPathException to be thrown.");
                        } catch (XPathException) {}
 
                        try {
                                navigator.Evaluate ("contains('foobar', 'oob', 'baz')");
-                               Fail ("Expected an XPathException to be thrown.");
+                               Assertion.Fail ("Expected an XPathException to be thrown.");
                        } catch (XPathException) {}
 
-                       Assert ((bool)navigator.Evaluate ("contains('foobar', 'oob')"));
-                       Assert (!(bool)navigator.Evaluate ("contains('foobar', 'baz')"));
+                       Assertion.Assert ((bool)navigator.Evaluate ("contains('foobar', 'oob')"));
+                       Assertion.Assert (!(bool)navigator.Evaluate ("contains('foobar', 'baz')"));
                }
        }
 }
index a844d80c6b4ccb039ed2b7d306cc1d63d82ba525..fc31c85f5635dbd1e1cb7cb1d8f2fb3760f16d9a 100644 (file)
@@ -1,10 +1,12 @@
 //
 // MonoTests.System.Xml.XPathNavigatorMatchesTests
 //
-// Author:
+// Authors:
 //   Jason Diamond <jason@injektilo.org>
+//   Martin Willemoes Hansen <mwh@sysrq.dk>
 //
 // (C) 2002 Jason Diamond
+// (C) 2003 Martin Willemoes Hansen
 //
 
 using System;
@@ -15,101 +17,109 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class XPathNavigatorMatchesTests : TestCase
+       [TestFixture]
+       public class XPathNavigatorMatchesTests
        {
-               public XPathNavigatorMatchesTests () : base ("MonoTests.System.Xml.XPathNavigatorMatchesTests testsuite") {}
-               public XPathNavigatorMatchesTests (string name) : base (name) {}
-
-               public void TestMatchRoot ()
+               [Test]
+               public void MatchRoot ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo />");
                        XPathNavigator navigator = document.CreateNavigator ();
 
-                       Assert (navigator.Matches ("/"));
+                       Assertion.Assert (navigator.Matches ("/"));
                }
 
-               public void TestFalseMatchRoot ()
+               [Test]
+               public void FalseMatchRoot ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo />");
                        XPathNavigator navigator = document.CreateNavigator ();
 
-                       Assert (!navigator.Matches ("foo"));
+                       Assertion.Assert (!navigator.Matches ("foo"));
                }
 
-               public void TestMatchDocumentElement ()
+               [Test]
+               public void MatchDocumentElement ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo />");
                        XPathNavigator navigator = document.DocumentElement.CreateNavigator ();
 
-                       Assert (navigator.Matches ("foo"));
+                       Assertion.Assert (navigator.Matches ("foo"));
                }
 
-               public void TestMatchAbsoluteDocumentElement ()
+               [Test]
+               public void MatchAbsoluteDocumentElement ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo />");
                        XPathNavigator navigator = document.DocumentElement.CreateNavigator ();
 
-                       Assert (navigator.Matches ("/foo"));
+                       Assertion.Assert (navigator.Matches ("/foo"));
                }
 
-               public void TestMatchDocumentElementChild ()
+               [Test]
+               public void MatchDocumentElementChild ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo><bar /></foo>");
                        XPathNavigator navigator = document.DocumentElement.FirstChild.CreateNavigator ();
 
-                       Assert (navigator.Matches ("bar"));
-                       Assert (navigator.Matches ("foo/bar"));
+                       Assertion.Assert (navigator.Matches ("bar"));
+                       Assertion.Assert (navigator.Matches ("foo/bar"));
                }
 
-               public void TestMatchAttribute ()
+               [Test]
+               public void MatchAttribute ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo bar='baz' />");
                        XPathNavigator navigator = document.DocumentElement.Attributes[0].CreateNavigator ();
 
-                       Assert (navigator.Matches ("@bar"));
-                       Assert (navigator.Matches ("foo/@bar"));
+                       Assertion.Assert (navigator.Matches ("@bar"));
+                       Assertion.Assert (navigator.Matches ("foo/@bar"));
                }
 
-               public void TestSlashSlash ()
+               [Test]
+               public void SlashSlash ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo><bar><baz/></bar></foo>");
                        XPathNavigator navigator = document.DocumentElement.FirstChild.FirstChild.CreateNavigator ();
 
-                       Assert (navigator.Matches ("foo//baz"));
+                       Assertion.Assert (navigator.Matches ("foo//baz"));
                }
 
-               public void TestAbsoluteSlashSlash ()
+               [Test]
+               public void AbsoluteSlashSlash ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo><bar><baz/></bar></foo>");
                        XPathNavigator navigator = document.DocumentElement.FirstChild.FirstChild.CreateNavigator ();
 
-                       Assert (navigator.Matches ("//baz"));
+                       Assertion.Assert (navigator.Matches ("//baz"));
                }
 
-               public void TestMatchDocumentElementWithPredicate ()
+               [Test]
+               public void MatchDocumentElementWithPredicate ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo><bar /></foo>");
                        XPathNavigator navigator = document.DocumentElement.CreateNavigator ();
 
-                       Assert (navigator.Matches ("foo[bar]"));
+                       Assertion.Assert (navigator.Matches ("foo[bar]"));
                }
 
-               public void TestFalseMatchDocumentElementWithPredicate ()
+               [Test]
+               public void FalseMatchDocumentElementWithPredicate ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo><bar /></foo>");
                        XPathNavigator navigator = document.DocumentElement.CreateNavigator ();
 
-                       Assert (!navigator.Matches ("foo[baz]"));
+                       Assertion.Assert (!navigator.Matches ("foo[baz]"));
                }
        }
 }
index 837b92430e54604cb1c3fb28cc76b25c323ca0a7..daf439d2c290e34c99f9f11163cd39e6ca30a178 100644 (file)
@@ -1,10 +1,12 @@
 //
 // MonoTests.System.Xml.XPathNavigatorTests
 //
-// Author:
+// Authors:
 //   Jason Diamond <jason@injektilo.org>
+//   Martin Willemoes Hansen <mwh@sysrq.dk>
 //
 // (C) 2002 Jason Diamond
+// (C) 2003 Martin Willemoes Hansen
 //
 
 using System;
@@ -15,102 +17,106 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class XPathNavigatorTests : TestCase
+       [TestFixture]
+       public class XPathNavigatorTests
        {
-               public XPathNavigatorTests () : base ("MonoTests.System.Xml.XPathNavigatorTests testsuite") {}
-               public XPathNavigatorTests (string name) : base (name) {}
-
-               public void TestCreateNavigator ()
+               [Test]
+               public void CreateNavigator ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo />");
                        XPathNavigator navigator = document.CreateNavigator ();
-                       AssertNotNull (navigator);
+                       Assertion.AssertNotNull (navigator);
                }
 
-               public void TestPropertiesOnDocument ()
+               [Test]
+               public void PropertiesOnDocument ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo:bar xmlns:foo='#foo' />");
                        XPathNavigator navigator = document.CreateNavigator ();
                        
-                       AssertEquals (XPathNodeType.Root, navigator.NodeType);
-                       AssertEquals (String.Empty, navigator.Name);
-                       AssertEquals (String.Empty, navigator.LocalName);
-                       AssertEquals (String.Empty, navigator.NamespaceURI);
-                       AssertEquals (String.Empty, navigator.Prefix);
-                       Assert (!navigator.HasAttributes);
-                       Assert (navigator.HasChildren);
-                       Assert (!navigator.IsEmptyElement);
+                       Assertion.AssertEquals (XPathNodeType.Root, navigator.NodeType);
+                       Assertion.AssertEquals (String.Empty, navigator.Name);
+                       Assertion.AssertEquals (String.Empty, navigator.LocalName);
+                       Assertion.AssertEquals (String.Empty, navigator.NamespaceURI);
+                       Assertion.AssertEquals (String.Empty, navigator.Prefix);
+                       Assertion.Assert (!navigator.HasAttributes);
+                       Assertion.Assert (navigator.HasChildren);
+                       Assertion.Assert (!navigator.IsEmptyElement);
                }
 
-               public void TestPropertiesOnElement ()
+               [Test]
+               public void PropertiesOnElement ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo:bar xmlns:foo='#foo' />");
                        XPathNavigator navigator = document.DocumentElement.CreateNavigator ();
                        
-                       AssertEquals (XPathNodeType.Element, navigator.NodeType);
-                       AssertEquals ("foo:bar", navigator.Name);
-                       AssertEquals ("bar", navigator.LocalName);
-                       AssertEquals ("#foo", navigator.NamespaceURI);
-                       AssertEquals ("foo", navigator.Prefix);
-                       Assert (!navigator.HasAttributes);
-                       Assert (!navigator.HasChildren);
-                       Assert (navigator.IsEmptyElement);
+                       Assertion.AssertEquals (XPathNodeType.Element, navigator.NodeType);
+                       Assertion.AssertEquals ("foo:bar", navigator.Name);
+                       Assertion.AssertEquals ("bar", navigator.LocalName);
+                       Assertion.AssertEquals ("#foo", navigator.NamespaceURI);
+                       Assertion.AssertEquals ("foo", navigator.Prefix);
+                       Assertion.Assert (!navigator.HasAttributes);
+                       Assertion.Assert (!navigator.HasChildren);
+                       Assertion.Assert (navigator.IsEmptyElement);
                }
 
-               public void TestPropertiesOnAttribute ()
+               [Test]
+               public void PropertiesOnAttribute ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo bar:baz='quux' xmlns:bar='#bar' />");
                        XPathNavigator navigator = document.DocumentElement.GetAttributeNode("baz", "#bar").CreateNavigator ();
                        
-                       AssertEquals (XPathNodeType.Attribute, navigator.NodeType);
-                       AssertEquals ("bar:baz", navigator.Name);
-                       AssertEquals ("baz", navigator.LocalName);
-                       AssertEquals ("#bar", navigator.NamespaceURI);
-                       AssertEquals ("bar", navigator.Prefix);
-                       Assert (!navigator.HasAttributes);
-                       Assert (!navigator.HasChildren);
-                       Assert (!navigator.IsEmptyElement);
+                       Assertion.AssertEquals (XPathNodeType.Attribute, navigator.NodeType);
+                       Assertion.AssertEquals ("bar:baz", navigator.Name);
+                       Assertion.AssertEquals ("baz", navigator.LocalName);
+                       Assertion.AssertEquals ("#bar", navigator.NamespaceURI);
+                       Assertion.AssertEquals ("bar", navigator.Prefix);
+                       Assertion.Assert (!navigator.HasAttributes);
+                       Assertion.Assert (!navigator.HasChildren);
+                       Assertion.Assert (!navigator.IsEmptyElement);
                }
 
-               public void TestNavigation ()
+               [Test]
+               public void Navigation ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo><bar /><baz /></foo>");
                        XPathNavigator navigator = document.DocumentElement.CreateNavigator ();
                        
-                       AssertEquals ("foo", navigator.Name);
-                       Assert (navigator.MoveToFirstChild ());
-                       AssertEquals ("bar", navigator.Name);
-                       Assert (navigator.MoveToNext ());
-                       AssertEquals ("baz", navigator.Name);
-                       Assert (!navigator.MoveToNext ());
-                       AssertEquals ("baz", navigator.Name);
-                       Assert (navigator.MoveToPrevious ());
-                       AssertEquals ("bar", navigator.Name);
-                       Assert (!navigator.MoveToPrevious ());
-                       Assert (navigator.MoveToParent ());
-                       AssertEquals ("foo", navigator.Name);
+                       Assertion.AssertEquals ("foo", navigator.Name);
+                       Assertion.Assert (navigator.MoveToFirstChild ());
+                       Assertion.AssertEquals ("bar", navigator.Name);
+                       Assertion.Assert (navigator.MoveToNext ());
+                       Assertion.AssertEquals ("baz", navigator.Name);
+                       Assertion.Assert (!navigator.MoveToNext ());
+                       Assertion.AssertEquals ("baz", navigator.Name);
+                       Assertion.Assert (navigator.MoveToPrevious ());
+                       Assertion.AssertEquals ("bar", navigator.Name);
+                       Assertion.Assert (!navigator.MoveToPrevious ());
+                       Assertion.Assert (navigator.MoveToParent ());
+                       Assertion.AssertEquals ("foo", navigator.Name);
                        navigator.MoveToRoot ();
-                       AssertEquals (XPathNodeType.Root, navigator.NodeType);
-                       Assert (!navigator.MoveToParent ());
-                       AssertEquals (XPathNodeType.Root, navigator.NodeType);
-                       Assert (navigator.MoveToFirstChild ());
-                       AssertEquals ("foo", navigator.Name);
-                       Assert (navigator.MoveToFirst ());
-                       AssertEquals ("foo", navigator.Name);
-                       Assert (navigator.MoveToFirstChild ());
-                       AssertEquals ("bar", navigator.Name);
-                       Assert (navigator.MoveToNext ());
-                       AssertEquals ("baz", navigator.Name);
-                       Assert (navigator.MoveToFirst ());
-                       AssertEquals ("bar", navigator.Name);
+                       Assertion.AssertEquals (XPathNodeType.Root, navigator.NodeType);
+                       Assertion.Assert (!navigator.MoveToParent ());
+                       Assertion.AssertEquals (XPathNodeType.Root, navigator.NodeType);
+                       Assertion.Assert (navigator.MoveToFirstChild ());
+                       Assertion.AssertEquals ("foo", navigator.Name);
+                       Assertion.Assert (navigator.MoveToFirst ());
+                       Assertion.AssertEquals ("foo", navigator.Name);
+                       Assertion.Assert (navigator.MoveToFirstChild ());
+                       Assertion.AssertEquals ("bar", navigator.Name);
+                       Assertion.Assert (navigator.MoveToNext ());
+                       Assertion.AssertEquals ("baz", navigator.Name);
+                       Assertion.Assert (navigator.MoveToFirst ());
+                       Assertion.AssertEquals ("bar", navigator.Name);
                }
 
-               public void TestMoveToAndIsSamePosition ()
+               [Test]
+               public void MoveToAndIsSamePosition ()
                {
                        XmlDocument document1 = new XmlDocument ();
                        document1.LoadXml ("<foo><bar /></foo>");
@@ -121,52 +127,54 @@ namespace MonoTests.System.Xml
                        document2.LoadXml ("<foo><bar /></foo>");
                        XPathNavigator navigator2 = document2.DocumentElement.CreateNavigator ();
 
-                       AssertEquals ("foo", navigator1a.Name);
-                       Assert (navigator1a.MoveToFirstChild ());
-                       AssertEquals ("bar", navigator1a.Name);
+                       Assertion.AssertEquals ("foo", navigator1a.Name);
+                       Assertion.Assert (navigator1a.MoveToFirstChild ());
+                       Assertion.AssertEquals ("bar", navigator1a.Name);
 
-                       Assert (!navigator1b.IsSamePosition (navigator1a));
-                       AssertEquals ("foo", navigator1b.Name);
-                       Assert (navigator1b.MoveTo (navigator1a));
-                       Assert (navigator1b.IsSamePosition (navigator1a));
-                       AssertEquals ("bar", navigator1b.Name);
+                       Assertion.Assert (!navigator1b.IsSamePosition (navigator1a));
+                       Assertion.AssertEquals ("foo", navigator1b.Name);
+                       Assertion.Assert (navigator1b.MoveTo (navigator1a));
+                       Assertion.Assert (navigator1b.IsSamePosition (navigator1a));
+                       Assertion.AssertEquals ("bar", navigator1b.Name);
 
-                       Assert (!navigator2.IsSamePosition (navigator1a));
-                       AssertEquals ("foo", navigator2.Name);
-                       Assert (!navigator2.MoveTo (navigator1a));
-                       AssertEquals ("foo", navigator2.Name);
+                       Assertion.Assert (!navigator2.IsSamePosition (navigator1a));
+                       Assertion.AssertEquals ("foo", navigator2.Name);
+                       Assertion.Assert (!navigator2.MoveTo (navigator1a));
+                       Assertion.AssertEquals ("foo", navigator2.Name);
                }
 
-               public void TestAttributeNavigation ()
+               [Test]
+               public void AttributeNavigation ()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo bar='baz' quux='quuux' />");
                        XPathNavigator navigator = document.DocumentElement.CreateNavigator ();
 
-                       AssertEquals (XPathNodeType.Element, navigator.NodeType);
-                       AssertEquals ("foo", navigator.Name);
-                       Assert (navigator.MoveToFirstAttribute ());
-                       AssertEquals (XPathNodeType.Attribute, navigator.NodeType);
-                       AssertEquals ("bar", navigator.Name);
-                       AssertEquals ("baz", navigator.Value);
-                       Assert (navigator.MoveToNextAttribute ());
-                       AssertEquals (XPathNodeType.Attribute, navigator.NodeType);
-                       AssertEquals ("quux", navigator.Name);
-                       AssertEquals ("quuux", navigator.Value);
+                       Assertion.AssertEquals (XPathNodeType.Element, navigator.NodeType);
+                       Assertion.AssertEquals ("foo", navigator.Name);
+                       Assertion.Assert (navigator.MoveToFirstAttribute ());
+                       Assertion.AssertEquals (XPathNodeType.Attribute, navigator.NodeType);
+                       Assertion.AssertEquals ("bar", navigator.Name);
+                       Assertion.AssertEquals ("baz", navigator.Value);
+                       Assertion.Assert (navigator.MoveToNextAttribute ());
+                       Assertion.AssertEquals (XPathNodeType.Attribute, navigator.NodeType);
+                       Assertion.AssertEquals ("quux", navigator.Name);
+                       Assertion.AssertEquals ("quuux", navigator.Value);
                }
 
-               public void TestElementAndRootValues()
+               [Test]
+               public void ElementAndRootValues()
                {
                        XmlDocument document = new XmlDocument ();
                        document.LoadXml ("<foo><bar>baz</bar><quux>quuux</quux></foo>");
                        XPathNavigator navigator = document.DocumentElement.CreateNavigator ();
 
-                       AssertEquals (XPathNodeType.Element, navigator.NodeType);
-                       AssertEquals ("foo", navigator.Name);
-                       //AssertEquals ("bazquuux", navigator.Value);
+                       Assertion.AssertEquals (XPathNodeType.Element, navigator.NodeType);
+                       Assertion.AssertEquals ("foo", navigator.Name);
+                       //Assertion.AssertEquals ("bazquuux", navigator.Value);
 
                        navigator.MoveToRoot ();
-                       //AssertEquals ("bazquuux", navigator.Value);
+                       //Assertion.AssertEquals ("bazquuux", navigator.Value);
                }
        }
 }
index 774344fe106677b6f3a3202df4106a45461b69ae..bbbf5587d233c17e97ee311cf4670a519b44d765 100644 (file)
@@ -1,8 +1,10 @@
 // XmlAttributeCollectionTests.cs : Tests for the XmlAttributeCollection class
 //
 // Author: Matt Hunter <xrkune@tconl.com>
+// Author: Martin Willemoes Hansen <mwh@sysrq.dk>
 //
-// <c> 2002 Matt Hunter
+// (C) 2002 Matt Hunter
+// (C) 2003 Martin Willemoes Hansen
 
 using System;
 using System.Xml;
@@ -14,18 +16,19 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class XmlAttributeCollectionTests : TestCase
+       [TestFixture]
+       public class XmlAttributeCollectionTests
        {
-               public XmlAttributeCollectionTests() : base("MonoTests.System.Xml.XmlAttributeCollectionTests testsuite") { }
-               public XmlAttributeCollectionTests(string name) : base(name) { }
-
                private XmlDocument document;
 
-               protected override void SetUp()
+               [SetUp]
+               public void GetReady()
                {
                        document = new XmlDocument ();
                }
-               public void TestRemoveAll ()
+
+               [Test]
+               public void RemoveAll ()
                {
                        StringBuilder xml = new StringBuilder ();
                        xml.Append ("<?xml version=\"1.0\" ?><library><book type=\"non-fiction\" price=\"34.95\"> ");
@@ -40,10 +43,11 @@ namespace MonoTests.System.Xml
                        XmlElement xmlElement = xmlNode as XmlElement;
                        XmlAttributeCollection attributes = xmlElement.Attributes;
                        attributes.RemoveAll ();
-                       AssertEquals ("not all attributes removed.", false, xmlElement.HasAttribute ("type"));
+                       Assertion.AssertEquals ("not all attributes removed.", false, xmlElement.HasAttribute ("type"));
                }
 
-               public void TestAppend () 
+               [Test]
+               public void Append () 
                {
                        XmlDocument xmlDoc = new XmlDocument ();
                        XmlElement xmlEl = xmlDoc.CreateElement ("TestElement");
@@ -52,27 +56,29 @@ namespace MonoTests.System.Xml
                        XmlAttribute xmlAttribute3 = xmlNode as XmlAttribute;
                        XmlAttributeCollection attributeCol = xmlEl.Attributes;
                        xmlAttribute3 = attributeCol.Append (xmlAttribute3);
-                       AssertEquals ("attribute name not properly created.", true, xmlAttribute3.Name.Equals ("attr3"));
-                       AssertEquals ("attribute namespace not properly created.", true, xmlAttribute3.NamespaceURI.Equals ("namespace1"));
+                       Assertion.AssertEquals ("attribute name not properly created.", true, xmlAttribute3.Name.Equals ("attr3"));
+                       Assertion.AssertEquals ("attribute namespace not properly created.", true, xmlAttribute3.NamespaceURI.Equals ("namespace1"));
                }
 
-               public void TestCopyTo () 
+               [Test]
+               public void CopyTo () 
                {
                        XmlDocument xmlDoc = new XmlDocument ();
                        xmlDoc.LoadXml("<root a1='garnet' a2='amethyst' a3='Bloodstone' a4='diamond' a5='emerald' a6='pearl' a7='ruby' a8='sapphire' a9='moonstone' a10='opal' a11='topaz' a12='turquoize' />");
                        XmlAttributeCollection col = xmlDoc.DocumentElement.Attributes;
                        XmlAttribute[] array = new XmlAttribute[24];
                        col.CopyTo(array, 0);
-                       AssertEquals("garnet", array[0].Value);
-                       AssertEquals("moonstone", array[8].Value);
-                       AssertEquals("turquoize", array[11].Value);
+                       Assertion.AssertEquals("garnet", array[0].Value);
+                       Assertion.AssertEquals("moonstone", array[8].Value);
+                       Assertion.AssertEquals("turquoize", array[11].Value);
                        col.CopyTo(array, 12);
-                       AssertEquals("garnet", array[12].Value);
-                       AssertEquals("moonstone", array[20].Value);
-                       AssertEquals("turquoize", array[23].Value);
+                       Assertion.AssertEquals("garnet", array[12].Value);
+                       Assertion.AssertEquals("moonstone", array[20].Value);
+                       Assertion.AssertEquals("turquoize", array[23].Value);
                }
 
-               public void TestSetNamedItem ()
+               [Test]
+               public void SetNamedItem ()
                {
                        XmlDocument xmlDoc = new XmlDocument ();
                        xmlDoc.LoadXml("<root />");
@@ -82,17 +88,18 @@ namespace MonoTests.System.Xml
                        XmlAttribute attr = xmlDoc.CreateAttribute("b3");
                        attr.Value = "bloodstone";
                        col.SetNamedItem(attr);
-                       AssertEquals("SetNamedItem.Normal", "bloodstone", el.GetAttribute("b3"));
+                       Assertion.AssertEquals("SetNamedItem.Normal", "bloodstone", el.GetAttribute("b3"));
 
                        attr = xmlDoc.CreateAttribute("b3");
                        attr.Value = "aquamaline";
                        col.SetNamedItem(attr);
-                       AssertEquals("SetNamedItem.Override", "aquamaline", el.GetAttribute("b3"));
-                       AssertEquals("SetNamedItem.Override.Count.1", 1, el.Attributes.Count);
-                       AssertEquals("SetNamedItem.Override.Count.2", 1, col.Count);
+                       Assertion.AssertEquals("SetNamedItem.Override", "aquamaline", el.GetAttribute("b3"));
+                       Assertion.AssertEquals("SetNamedItem.Override.Count.1", 1, el.Attributes.Count);
+                       Assertion.AssertEquals("SetNamedItem.Override.Count.2", 1, col.Count);
                }
 
-               public void TestInsertBeforeAfterPrepend () 
+               [Test]
+               public void InsertBeforeAfterPrepend () 
                {
                        XmlDocument xmlDoc = new XmlDocument ();
                        xmlDoc.LoadXml("<root b2='amethyst' />");
@@ -101,34 +108,35 @@ namespace MonoTests.System.Xml
                        XmlAttribute attr = xmlDoc.CreateAttribute("b1");
                        attr.Value = "garnet";
                        col.InsertAfter(attr, null);
-                       AssertEquals("InsertAfterNull", "garnet", el.GetAttributeNode("b1").Value);
-                       AssertEquals("InsertAfterNull.Pos", el.GetAttribute("b1"), col[0].Value);
+                       Assertion.AssertEquals("InsertAfterNull", "garnet", el.GetAttributeNode("b1").Value);
+                       Assertion.AssertEquals("InsertAfterNull.Pos", el.GetAttribute("b1"), col[0].Value);
 
                        attr = xmlDoc.CreateAttribute("b3");
                        attr.Value = "bloodstone";
                        col.InsertAfter(attr, el.GetAttributeNode("b2"));
-                       AssertEquals("InsertAfterAttr", "bloodstone", el.GetAttributeNode("b3").Value);
-                       AssertEquals("InsertAfterAttr.Pos", el.GetAttribute("b3"), col[2].Value);
+                       Assertion.AssertEquals("InsertAfterAttr", "bloodstone", el.GetAttributeNode("b3").Value);
+                       Assertion.AssertEquals("InsertAfterAttr.Pos", el.GetAttribute("b3"), col[2].Value);
 
                        attr = xmlDoc.CreateAttribute("b4");
                        attr.Value = "diamond";
                        col.InsertBefore(attr, null);
-                       AssertEquals("InsertBeforeNull", "diamond", el.GetAttributeNode("b4").Value);
-                       AssertEquals("InsertBeforeNull.Pos", el.GetAttribute("b4"), col[3].Value);
+                       Assertion.AssertEquals("InsertBeforeNull", "diamond", el.GetAttributeNode("b4").Value);
+                       Assertion.AssertEquals("InsertBeforeNull.Pos", el.GetAttribute("b4"), col[3].Value);
 
                        attr = xmlDoc.CreateAttribute("warning");
                        attr.Value = "mixed modern and traditional;-)";
                        col.InsertBefore(attr, el.GetAttributeNode("b1"));
-                       AssertEquals("InsertBeforeAttr", "mixed modern and traditional;-)", el.GetAttributeNode("warning").Value);
-                       AssertEquals("InsertBeforeAttr.Pos", el.GetAttributeNode("warning").Value, col[0].Value);
+                       Assertion.AssertEquals("InsertBeforeAttr", "mixed modern and traditional;-)", el.GetAttributeNode("warning").Value);
+                       Assertion.AssertEquals("InsertBeforeAttr.Pos", el.GetAttributeNode("warning").Value, col[0].Value);
 
                        attr = xmlDoc.CreateAttribute("about");
                        attr.Value = "lists of birthstone.";
                        col.Prepend(attr);
-                       AssertEquals("Prepend", "lists of birthstone.", col[0].Value);
+                       Assertion.AssertEquals("Prepend", "lists of birthstone.", col[0].Value);
                }
 
-               public void TestRemove ()
+               [Test]
+               public void Remove ()
                {
                        XmlDocument xmlDoc = new XmlDocument ();
                        xmlDoc.LoadXml("<root a1='garnet' a2='amethyst' a3='bloodstone' a4='diamond' a5='emerald' a6='pearl' a7='ruby' a8='sapphire' a9='moonstone' a10='opal' a11='topaz' a12='turquoize' />");
@@ -137,13 +145,13 @@ namespace MonoTests.System.Xml
 
                        // Remove
                        XmlAttribute attr = col.Remove(el.GetAttributeNode("a12"));
-                       AssertEquals("Remove", 11, col.Count);
-                       AssertEquals("Remove.Removed", "a12", attr.Name);
+                       Assertion.AssertEquals("Remove", 11, col.Count);
+                       Assertion.AssertEquals("Remove.Removed", "a12", attr.Name);
 
                        // RemoveAt
                        attr = col.RemoveAt(5);
-                       AssertEquals("RemoveAt", null, el.GetAttributeNode("a6"));
-                       AssertEquals("Remove.Removed", "pearl", attr.Value);
+                       Assertion.AssertEquals("RemoveAt", null, el.GetAttributeNode("a6"));
+                       Assertion.AssertEquals("Remove.Removed", "pearl", attr.Value);
                }
        }
 }
index 404be564fec3fdb8173ad201dda403191afabc6a..2148808dfd82166c21d0bd35fc1820bc89d6111e 100644 (file)
@@ -1,8 +1,10 @@
 // XmlAttributeTests.cs : Tests for the XmlAttribute class
 //
 // Author: Mike Kestner <mkestner@speakeasy.net>
+// Author: Martin Willemoes Hansen <mwh@sysrq.dk>
 //
-// <c> 2002 Mike Kestner
+// (C) 2002 Mike Kestner
+// (C) 2003 Martin Willemoes Hansen
 
 using System;
 using System.Xml;
@@ -11,104 +13,114 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class XmlAttributeTests : TestCase
+       [TestFixture]
+       public class XmlAttributeTests
        {
-               public XmlAttributeTests () : base("MonoTests.System.Xml.XmlAttributeTests testsuite") { }
-               public XmlAttributeTests (string name) : base(name) { }
-
                XmlDocument doc;
                XmlAttribute attr;
 
-               protected override void SetUp()
+               [SetUp]
+               public void GetReady()
                {
                        doc = new XmlDocument ();
                        attr = doc.CreateAttribute ("attr1");
                        attr.Value = "val1";
                }
 
-               public void TestAttributes ()
+               [Test]
+               public void Attributes ()
                {
-                       AssertNull (attr.Attributes);
+                       Assertion.AssertNull (attr.Attributes);
                }
 
-               public void TestAttributeInnerAndOuterXml ()
+               [Test]
+               public void AttributeInnerAndOuterXml ()
                {
                        attr = doc.CreateAttribute ("foo", "bar", "http://abc.def");
                        attr.Value = "baz";
-                       AssertEquals ("baz", attr.InnerXml);
-                       AssertEquals ("foo:bar=\"baz\"", attr.OuterXml);
+                       Assertion.AssertEquals ("baz", attr.InnerXml);
+                       Assertion.AssertEquals ("foo:bar=\"baz\"", attr.OuterXml);
                }
 
-               public void TestAttributeWithNoValue ()
+               [Test]
+               public void AttributeWithNoValue ()
                {
                        XmlAttribute attribute = doc.CreateAttribute ("name");
-                       AssertEquals (String.Empty, attribute.Value);
-                       Assert (!attribute.HasChildNodes);
-                       AssertNull (attribute.FirstChild);
-                       AssertNull (attribute.LastChild);
-                       AssertEquals (0, attribute.ChildNodes.Count);
+                       Assertion.AssertEquals (String.Empty, attribute.Value);
+                       Assertion.Assert (!attribute.HasChildNodes);
+                       Assertion.AssertNull (attribute.FirstChild);
+                       Assertion.AssertNull (attribute.LastChild);
+                       Assertion.AssertEquals (0, attribute.ChildNodes.Count);
                }
 
-               public void TestAttributeWithValue ()
+               [Test]
+               public void AttributeWithValue ()
                {
                        XmlAttribute attribute = doc.CreateAttribute ("name");
                        attribute.Value = "value";
-                       AssertEquals ("value", attribute.Value);
-                       Assert (attribute.HasChildNodes);
-                       AssertNotNull (attribute.FirstChild);
-                       AssertNotNull (attribute.LastChild);
-                       AssertEquals (1, attribute.ChildNodes.Count);
-                       AssertEquals (XmlNodeType.Text, attribute.ChildNodes [0].NodeType);
-                       AssertEquals ("value", attribute.ChildNodes [0].Value);
+                       Assertion.AssertEquals ("value", attribute.Value);
+                       Assertion.Assert (attribute.HasChildNodes);
+                       Assertion.AssertNotNull (attribute.FirstChild);
+                       Assertion.AssertNotNull (attribute.LastChild);
+                       Assertion.AssertEquals (1, attribute.ChildNodes.Count);
+                       Assertion.AssertEquals (XmlNodeType.Text, attribute.ChildNodes [0].NodeType);
+                       Assertion.AssertEquals ("value", attribute.ChildNodes [0].Value);
                }
 
-               public void TestHasChildNodes ()
+               [Test]
+               public void HasChildNodes ()
                {
-                       Assert (attr.HasChildNodes);
+                       Assertion.Assert (attr.HasChildNodes);
                }
 
-               public void TestName ()
+               [Test]
+               public void Name ()
                {
-                       AssertEquals ("attr1", attr.Name);
+                       Assertion.AssertEquals ("attr1", attr.Name);
                }
 
-               public void TestNodeType ()
+               [Test]
+               public void NodeType ()
                {
-                       AssertEquals (XmlNodeType.Attribute, attr.NodeType);
+                       Assertion.AssertEquals (XmlNodeType.Attribute, attr.NodeType);
                }
 
-               public void TestOwnerDocument ()
+               [Test]
+               public void OwnerDocument ()
                {
-                       AssertSame (doc, attr.OwnerDocument);
+                       Assertion.AssertSame (doc, attr.OwnerDocument);
                }
 
-               public void TestParentNode ()
+               [Test]
+               public void ParentNode ()
                {
-                       AssertNull ("Attr parents not allowed", attr.ParentNode);
+                       Assertion.AssertNull ("Attr parents not allowed", attr.ParentNode);
                }
 
-               public void TestValue ()
+               [Test]
+               public void Value ()
                {
-                       AssertEquals ("val1", attr.Value);
+                       Assertion.AssertEquals ("val1", attr.Value);
                }
 
-               public void TestSetInnerTextAndXml ()
+               [Test]
+               public void SetInnerTextAndXml ()
                {
                        string original = doc.OuterXml;
                        doc.LoadXml ("<root name='value' />");
                        XmlNodeChangedEventHandler eh = new XmlNodeChangedEventHandler (OnSetInnerText);
                        try {
                                doc.DocumentElement.Attributes ["name"].InnerText = "a&b";
-                               AssertEquals ("setInnerText", "a&b", doc.DocumentElement.Attributes ["name"].Value);
+                               Assertion.AssertEquals ("setInnerText", "a&b", doc.DocumentElement.Attributes ["name"].Value);
                                doc.DocumentElement.Attributes ["name"].InnerXml = "a&amp;b";
-                               AssertEquals ("setInnerXml", "a&b", doc.DocumentElement.Attributes ["name"].Value);
+                               Assertion.AssertEquals ("setInnerXml", "a&b", doc.DocumentElement.Attributes ["name"].Value);
 
                                doc.NodeChanged += eh;
                                doc.DocumentElement.Attributes ["name"].InnerText = "fire";
                                // If you failed to pass it, then the reason may be loop of event.
-                               AssertEquals ("setInnerText.Event", "event was fired", doc.DocumentElement.GetAttribute ("appended"));
+                               Assertion.AssertEquals ("setInnerText.Event", "event was fired", doc.DocumentElement.GetAttribute ("appended"));
                        } catch(Exception ex) {
-                               Fail(ex.Message);
+                               Assertion.Fail(ex.Message);
                        } finally {
                                doc.LoadXml (original);
                                doc.NodeChanged -= eh;
index dad1050fcf6902f5cf2cbe764c91cdcf61e98195..cca227cbfdc6fcf983dfcfd850d376bab9862a02 100755 (executable)
@@ -1,10 +1,12 @@
 //
 // System.Xml.XmlCDataSectionTests.cs
 //
-// Author:
+// Authors:
 //     Duncan Mak  (duncan@ximian.com)
+//      Martin Willemoes Hansen (mwh@sysrq.dk)
 //
 // (C) Ximian, Inc.
+// (C) 2003 Martin Willemoes Hansen
 //
 
 using System;
@@ -14,7 +16,8 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class XmlCDataSectionTests : TestCase
+       [TestFixture]
+       public class XmlCDataSectionTests
        {
                XmlDocument document;
                XmlCDataSection section;
@@ -22,77 +25,74 @@ namespace MonoTests.System.Xml
                XmlNode deep;
                XmlNode shallow;
 
-               public XmlCDataSectionTests ()
-                       : base ("MonoTests.System.Xml.XmlCDataSectionTests testsuite")
-               {
-               }
-
-               public XmlCDataSectionTests (string name)
-                       : base (name)
-               {
-               }
-
-               protected override void SetUp ()
+               [SetUp]
+               public void GetReady ()
                {
                        document = new XmlDocument ();
                        document.LoadXml ("<root><foo></foo></root>");
                        section = document.CreateCDataSection ("CDataSection");
                }
 
-               internal void TestXmlNodeBaseProperties (XmlNode original, XmlNode cloned)
+               internal void XmlNodeBaseProperties (XmlNode original, XmlNode cloned)
                {
-                       // AssertEquals (original.nodetype + " was incorrectly cloned.",
+                       // Assertion.AssertEquals (original.nodetype + " was incorrectly cloned.",
                        //               original.baseuri, cloned.baseuri);                     
-                       AssertNull (cloned.ParentNode);
-                        Assert ("Copies, not pointers", !Object.ReferenceEquals (original,cloned));
+                       Assertion.AssertNull (cloned.ParentNode);
+                        Assertion.Assert ("Copies, not pointers", !Object.ReferenceEquals (original,cloned));
                }
               
-               public void TestXmlCDataSectionInnerAndOuterXml ()
+               [Test]
+               public void XmlCDataSectionInnerAndOuterXml ()
                {
                        section = document.CreateCDataSection ("foo");
-                       AssertEquals (String.Empty, section.InnerXml);
-                       AssertEquals ("<![CDATA[foo]]>", section.OuterXml);
+                       Assertion.AssertEquals (String.Empty, section.InnerXml);
+                       Assertion.AssertEquals ("<![CDATA[foo]]>", section.OuterXml);
                }
 
-               public void TestXmlCDataSectionName ()
+               [Test]
+               public void XmlCDataSectionName ()
                {
-                       AssertEquals (section.NodeType + " Name property broken",
+                       Assertion.AssertEquals (section.NodeType + " Name property broken",
                                      section.Name, "#cdata-section");
                }
 
-               public void TestXmlCDataSectionLocalName ()
+               [Test]
+               public void XmlCDataSectionLocalName ()
                {
-                       AssertEquals (section.NodeType + " LocalName property broken",
+                       Assertion.AssertEquals (section.NodeType + " LocalName property broken",
                                      section.LocalName, "#cdata-section");
                }
 
-               public void TestXmlCDataSectionNodeType ()
+               [Test]
+               public void XmlCDataSectionNodeType ()
                {
-                       AssertEquals ("XmlCDataSection NodeType property broken",
+                       Assertion.AssertEquals ("XmlCDataSection NodeType property broken",
                                      section.NodeType.ToString (), "CDATA");
                }
 
-               public void TestXmlCDataSectionIsReadOnly ()
+               [Test]
+               public void XmlCDataSectionIsReadOnly ()
                {
-                       AssertEquals ("XmlCDataSection IsReadOnly property broken",
+                       Assertion.AssertEquals ("XmlCDataSection IsReadOnly property broken",
                                      section.IsReadOnly, false);
                }
 
-               public void TestXmlCDataSectionCloneNode ()
+               [Test]
+               public void XmlCDataSectionCloneNode ()
                {
                        original = section;
 
                        shallow = section.CloneNode (false); // shallow
-                       TestXmlNodeBaseProperties (original, shallow);
-                       AssertEquals ("Value incorrectly cloned",
+                       XmlNodeBaseProperties (original, shallow);
+                       Assertion.AssertEquals ("Value incorrectly cloned",
                                      original.Value, shallow.Value);
                        
                        deep = section.CloneNode (true); // deep
-                       TestXmlNodeBaseProperties (original, deep);
-                       AssertEquals ("Value incorrectly cloned",
+                       XmlNodeBaseProperties (original, deep);
+                       Assertion.AssertEquals ("Value incorrectly cloned",
                                       original.Value, deep.Value);
 
-                        AssertEquals ("deep cloning differs from shallow cloning",
+                        Assertion.AssertEquals ("deep cloning differs from shallow cloning",
                                      deep.OuterXml, shallow.OuterXml);
                }
        }
index 1fbe0b8295cfebbaa491e5915a47bffb92fc4fa5..1e6e5ffdf5538bf68f017daffb284163d5a631c3 100644 (file)
@@ -1,10 +1,11 @@
 //
 // System.Xml.XmlTextWriterTests
 //
-// Author:
-//   Kral Ferch <kral_ferch@hotmail.com>
+// Author: Kral Ferch <kral_ferch@hotmail.com>
+// Author: Martin Willemoes Hansen <mwh@sysrq.dk>
 //
 // (C) 2002 Kral Ferch
+// (C) 2003 Martin Willemoes Hansen
 //
 
 using System;
@@ -14,17 +15,16 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class XmlCharacterDataTests : TestCase
+       [TestFixture]
+       public class XmlCharacterDataTests
        {
-               public XmlCharacterDataTests () : base ("MonoTests.System.Xml.XmlCharacterDataTests testsuite") {}
-               public XmlCharacterDataTests (string name) : base (name) {}
-
                XmlDocument document;
                XmlComment comment;
                bool changed;
                bool changing;
 
-               protected override void SetUp ()
+               [SetUp]
+               public void GetReady ()
                {
                        document = new XmlDocument ();
                        document.NodeChanged += new XmlNodeChangedEventHandler (this.EventNodeChanged);
@@ -42,74 +42,77 @@ namespace MonoTests.System.Xml
                        changing = true;
                }
 
-               public void TestAppendData ()
+               [Test]
+               public void AppendData ()
                {
                        changed = false;
                        changing = false;
                        comment.AppendData ("bar");
-                       Assert (changed);
-                       Assert (changing);
-                       AssertEquals ("foobar", comment.Data);
+                       Assertion.Assert (changed);
+                       Assertion.Assert (changing);
+                       Assertion.AssertEquals ("foobar", comment.Data);
 
                        comment.Value = "foo";
                        comment.AppendData (null);
-                       AssertEquals ("foo", comment.Data);
+                       Assertion.AssertEquals ("foo", comment.Data);
                }
 
-               public void TestDeleteData ()
+               [Test]
+               public void DeleteData ()
                {
                        comment.Value = "bar";
                        changed = false;
                        changing = false;
                        comment.DeleteData (1, 1);
-                       Assert (changed);
-                       Assert (changing);
-                       AssertEquals ("br", comment.Data);
+                       Assertion.Assert (changed);
+                       Assertion.Assert (changing);
+                       Assertion.AssertEquals ("br", comment.Data);
 
                        try 
                        {
                                comment.Value = "foo";
                                comment.DeleteData(-1, 1);
-                               Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+                               Assertion.Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
                        } 
                        catch (ArgumentOutOfRangeException) {}
 
                        comment.Value = "foo";
                        comment.DeleteData(1, 5);
-                       AssertEquals("f", comment.Data);
+                       Assertion.AssertEquals("f", comment.Data);
 
                        comment.Value = "foo";
                        comment.DeleteData(3, 10);
-                       AssertEquals("foo", comment.Data);
+                       Assertion.AssertEquals("foo", comment.Data);
                }
 
-               public void TestInsertData ()
+               [Test]
+               public void InsertData ()
                {
                        comment.Value = "foobaz";
                        changed = false;
                        changing = false;
                        comment.InsertData (3, "bar");
-                       Assert (changed);
-                       Assert (changing);
-                       AssertEquals ("foobarbaz", comment.Data);
+                       Assertion.Assert (changed);
+                       Assertion.Assert (changing);
+                       Assertion.AssertEquals ("foobarbaz", comment.Data);
 
                        try 
                        {
                                comment.Value = "foo";
                                comment.InsertData (-1, "bar");
-                               Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+                               Assertion.Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
                        } 
                        catch (ArgumentOutOfRangeException) {}
 
                        comment.Value = "foo";
                        comment.InsertData (3, "bar");
-                       AssertEquals ("foobar", comment.Data);
+                       Assertion.AssertEquals ("foobar", comment.Data);
 
                        try 
                        {
                                comment.Value = "foo";
                                comment.InsertData (4, "bar");
-                               Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+                               Assertion.Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
                        } 
                        catch (ArgumentOutOfRangeException) {}
 
@@ -117,33 +120,34 @@ namespace MonoTests.System.Xml
                        {
                                comment.Value = "foo";
                                comment.InsertData (1, null);
-                               Fail ("Expected an ArgumentNullException to be thrown.");
+                               Assertion.Fail ("Expected an ArgumentNullException to be thrown.");
                        } 
                        catch (ArgumentNullException) {}
                }
 
-               public void TestReplaceData ()
+               [Test]
+               public void ReplaceData ()
                {
                        changed = false;
                        changing = false;
                        comment.ReplaceData (0, 3, "bar");
-                       Assert (changed);
-                       Assert (changing);
-                       AssertEquals ("bar", comment.Data);
+                       Assertion.Assert (changed);
+                       Assertion.Assert (changing);
+                       Assertion.AssertEquals ("bar", comment.Data);
 
                        comment.Value = "foo";
                        comment.ReplaceData (2, 3, "bar");
-                       AssertEquals ("fobar", comment.Data);
+                       Assertion.AssertEquals ("fobar", comment.Data);
 
                        comment.Value = "foo";
                        comment.ReplaceData (3, 3, "bar");
-                       AssertEquals ("foobar", comment.Data);
+                       Assertion.AssertEquals ("foobar", comment.Data);
 
                        try 
                        {
                                comment.Value = "foo";
                                comment.ReplaceData (4, 3, "bar");
-                               Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+                               Assertion.Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
                        } 
                        catch (ArgumentOutOfRangeException) {}
 
@@ -151,23 +155,23 @@ namespace MonoTests.System.Xml
                        {
                                comment.Value = "foo";
                                comment.ReplaceData (-1, 3, "bar");
-                               Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+                               Assertion.Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
                        } 
                        catch (ArgumentOutOfRangeException) {}
 
                        comment.Value = "foo";
                        comment.ReplaceData (0, 2, "bar");
-                       AssertEquals ("baro", comment.Data);
+                       Assertion.AssertEquals ("baro", comment.Data);
 
                        comment.Value = "foo";
                        comment.ReplaceData (0, 5, "bar");
-                       AssertEquals ("bar", comment.Data);
+                       Assertion.AssertEquals ("bar", comment.Data);
 
                        try 
                        {
                                comment.Value = "foo";
                                comment.ReplaceData (1, 1, null);
-                               Fail ("Expected an ArgumentNullException to be thrown.");
+                               Assertion.Fail ("Expected an ArgumentNullException to be thrown.");
                        } 
                        catch (ArgumentNullException) {}
                }
index 77ff9abe1b7ac9ec9b2abd22eae752b7bd02eb55..0bcbbb2a1e463a86b89727221c528c2856387d56 100755 (executable)
@@ -1,10 +1,11 @@
 //
 // System.Xml.XmlCommentTests.cs
 //
-// Author:
-//     Duncan Mak  (duncan@ximian.com)
+// Author: Duncan Mak  (duncan@ximian.com)
+// Author: Martin Willemoes Hansen (mwh@sysrq.dk)
 //
 // (C) Ximian, Inc.
+// (C) 2003 Martin Willemoes Hansen
 //
 
 using System;
@@ -14,7 +15,8 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class XmlCommentTests : TestCase
+       [TestFixture]
+       public class XmlCommentTests
        {
                XmlDocument document;
                XmlComment comment;
@@ -22,73 +24,76 @@ namespace MonoTests.System.Xml
                XmlNode deep;
                XmlNode shallow;
 
-               public XmlCommentTests () : base ("MonoTests.System.Xml.XmlCommentTests testsuite") {}
-
-               public XmlCommentTests (string name) : base (name) {}
-
-               protected override void SetUp ()
+               [SetUp]
+               public void GetReady ()
                {
                        document = new XmlDocument ();
                }
 
-               public void TestXmlCommentCloneNode ()
+               [Test]
+               public void XmlCommentCloneNode ()
                {
                        document.LoadXml ("<root><foo></foo></root>");
                        comment = document.CreateComment ("Comment");
                        original = comment;
 
                        shallow = comment.CloneNode (false); // shallow
-                       TestXmlNodeBaseProperties (original, shallow);
+                       XmlNodeBaseProperties (original, shallow);
                        
                        deep = comment.CloneNode (true); // deep
-                       TestXmlNodeBaseProperties (original, deep);
-                       AssertEquals ("Value incorrectly cloned",
+                       XmlNodeBaseProperties (original, deep);
+                       Assertion.AssertEquals ("Value incorrectly cloned",
                                original.Value, deep.Value);
 
-                       AssertEquals ("deep cloning differs from shallow cloning",
+                       Assertion.AssertEquals ("deep cloning differs from shallow cloning",
                                deep.OuterXml, shallow.OuterXml);
                }
 
-               public void TestXmlCommentInnerAndOuterXml ()
+               [Test]
+               public void XmlCommentInnerAndOuterXml ()
                {
                        comment = document.CreateComment ("foo");
-                       AssertEquals (String.Empty, comment.InnerXml);
-                       AssertEquals ("<!--foo-->", comment.OuterXml);
+                       Assertion.AssertEquals (String.Empty, comment.InnerXml);
+                       Assertion.AssertEquals ("<!--foo-->", comment.OuterXml);
                }
 
-               public void TestXmlCommentIsReadOnly ()
+               [Test]
+               public void XmlCommentIsReadOnly ()
                {
                        document.LoadXml ("<root><foo></foo></root>");
                        comment = document.CreateComment ("Comment");
-                       AssertEquals ("XmlComment IsReadOnly property broken",
+                       Assertion.AssertEquals ("XmlComment IsReadOnly property broken",
                                comment.IsReadOnly, false);
                }
 
-               public void TestXmlCommentLocalName ()
+               [Test]
+               public void XmlCommentLocalName ()
                {
                        document.LoadXml ("<root><foo></foo></root>");
                        comment = document.CreateComment ("Comment");
-                       AssertEquals (comment.NodeType + " LocalName property broken",
+                       Assertion.AssertEquals (comment.NodeType + " LocalName property broken",
                                      comment.LocalName, "#comment");
                }
 
-               public void TestXmlCommentName ()
+               [Test]
+               public void XmlCommentName ()
                {
                        document.LoadXml ("<root><foo></foo></root>");
                        comment = document.CreateComment ("Comment");
-                       AssertEquals (comment.NodeType + " Name property broken",
+                       Assertion.AssertEquals (comment.NodeType + " Name property broken",
                                comment.Name, "#comment");
                }
 
-               public void TestXmlCommentNodeType ()
+               [Test]
+               public void XmlCommentNodeType ()
                {
                        document.LoadXml ("<root><foo></foo></root>");
                        comment = document.CreateComment ("Comment");
-                       AssertEquals ("XmlComment NodeType property broken",
+                       Assertion.AssertEquals ("XmlComment NodeType property broken",
                                      comment.NodeType.ToString (), "Comment");
                }
 
-               internal void TestXmlNodeBaseProperties (XmlNode original, XmlNode cloned)
+               internal void XmlNodeBaseProperties (XmlNode original, XmlNode cloned)
                {
                        document.LoadXml ("<root><foo></foo></root>");
                        comment = document.CreateComment ("Comment");
@@ -96,11 +101,11 @@ namespace MonoTests.System.Xml
                        //                      assertequals (original.nodetype + " was incorrectly cloned.",
                        //                                    original.baseuri, cloned.baseuri);                        
 
-                       AssertNull (cloned.ParentNode);
-                       AssertEquals ("Value incorrectly cloned",
+                       Assertion.AssertNull (cloned.ParentNode);
+                       Assertion.AssertEquals ("Value incorrectly cloned",
                                original.Value, cloned.Value);
 
-                       Assert ("Copies, not pointers", !Object.ReferenceEquals (original,cloned));
+                       Assertion.Assert ("Copies, not pointers", !Object.ReferenceEquals (original,cloned));
                }
        
        }
index 5445f9ae6242cb6c79f78529fb2c9b723ce0399c..d9467de7cffd41bc107b1869b9944d030e70a4a5 100755 (executable)
@@ -1,10 +1,11 @@
 //
 // System.Xml.XmlDeclarationTests.cs
 //
-// Author:
-//     Duncan Mak  (duncan@ximian.com)
+// Author: Duncan Mak  (duncan@ximian.com)
+// Author: Martin Willemoes Hansen (mwh@sysrq.dk)
 //
 // (C) Ximian, Inc.
+// (C) 2003 Martin Willemoes Hansen
 //
 
 using System;
@@ -14,55 +15,54 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class XmlDeclarationTests : TestCase
+       [TestFixture]
+       public class XmlDeclarationTests
        {
-
                XmlDocument document;
                XmlDeclaration declaration;
                
-               public XmlDeclarationTests () : base ("MonoTests.System.Xml.XmlDeclarationTests testsuite") {}
-               
-               public XmlDeclarationTests (string name) : base (name) {}
-
-               protected override void SetUp ()
+               [SetUp]
+               public void GetReady ()
                {
                        document = new XmlDocument ();
                        document.LoadXml ("<foo><bar></bar></foo>");
                        declaration = document.CreateXmlDeclaration ("1.0", null, null);
                }
 
-               public void TestInnerAndOuterXml ()
+               [Test]
+               public void InnerAndOuterXml ()
                {
                        declaration = document.CreateXmlDeclaration ("1.0", null, null);
-                       AssertEquals (String.Empty, declaration.InnerXml);
-                       AssertEquals ("<?xml version=\"1.0\"?>", declaration.OuterXml);
+                       Assertion.AssertEquals (String.Empty, declaration.InnerXml);
+                       Assertion.AssertEquals ("<?xml version=\"1.0\"?>", declaration.OuterXml);
 
                        declaration = document.CreateXmlDeclaration ("1.0", "doesn't check", null);
-                       AssertEquals (String.Empty, declaration.InnerXml);
-                       AssertEquals ("<?xml version=\"1.0\" encoding=\"doesn't check\"?>", declaration.OuterXml);
+                       Assertion.AssertEquals (String.Empty, declaration.InnerXml);
+                       Assertion.AssertEquals ("<?xml version=\"1.0\" encoding=\"doesn't check\"?>", declaration.OuterXml);
 
                        declaration = document.CreateXmlDeclaration ("1.0", null, "yes");
-                       AssertEquals (String.Empty, declaration.InnerXml);
-                       AssertEquals ("<?xml version=\"1.0\" standalone=\"yes\"?>", declaration.OuterXml);
+                       Assertion.AssertEquals (String.Empty, declaration.InnerXml);
+                       Assertion.AssertEquals ("<?xml version=\"1.0\" standalone=\"yes\"?>", declaration.OuterXml);
 
                        declaration = document.CreateXmlDeclaration ("1.0", "foo", "no");
-                       AssertEquals (String.Empty, declaration.InnerXml);
-                       AssertEquals ("<?xml version=\"1.0\" encoding=\"foo\" standalone=\"no\"?>", declaration.OuterXml);
+                       Assertion.AssertEquals (String.Empty, declaration.InnerXml);
+                       Assertion.AssertEquals ("<?xml version=\"1.0\" encoding=\"foo\" standalone=\"no\"?>", declaration.OuterXml);
                }
 
-               internal void TestXmlNodeBaseProperties (XmlNode original, XmlNode cloned)
+               internal void XmlNodeBaseProperties (XmlNode original, XmlNode cloned)
                {
 //                     assertequals (original.nodetype + " was incorrectly cloned.",
 //                                   original.baseuri, cloned.baseuri);                        
-                       AssertNull (cloned.ParentNode);
+                       Assertion.AssertNull (cloned.ParentNode);
 
-                       AssertEquals ("Value incorrectly cloned",
+                       Assertion.AssertEquals ("Value incorrectly cloned",
                                      original.Value, cloned.Value);
                        
-                        Assert ("Copies, not pointers", !Object.ReferenceEquals (original,cloned));
+                        Assertion.Assert ("Copies, not pointers", !Object.ReferenceEquals (original,cloned));
                }
 
-               public void TestConstructor ()
+               [Test]
+               public void Constructor ()
                {
                        try {
                                XmlDeclaration broken = document.CreateXmlDeclaration ("2.0", null, null);
@@ -70,83 +70,89 @@ namespace MonoTests.System.Xml
                                return;
 
                        } catch (Exception e) {
-                               Fail("first arg null, wrong exception: " + e.ToString());
+                               Assertion.Fail("first arg null, wrong exception: " + e.ToString());
                        }
                }
 
-               public void TestNodeType ()
+               [Test]
+               public void NodeType ()
                {
-                       AssertEquals ("incorrect NodeType returned", XmlNodeType.XmlDeclaration, declaration.NodeType);
+                       Assertion.AssertEquals ("incorrect NodeType returned", XmlNodeType.XmlDeclaration, declaration.NodeType);
                }
 
-               public void TestNames ()
+               [Test]
+               public void Names ()
                {
-                       AssertEquals ("Name is incorrect", "xml", declaration.Name);
-                       AssertEquals ("LocalName is incorrect", "xml", declaration.LocalName);
+                       Assertion.AssertEquals ("Name is incorrect", "xml", declaration.Name);
+                       Assertion.AssertEquals ("LocalName is incorrect", "xml", declaration.LocalName);
                }
 
-               public void TestEncodingProperty ()
+               [Test]
+               public void EncodingProperty ()
                {
                        XmlDeclaration d1 = document.CreateXmlDeclaration ("1.0", "foo", null);
-                       AssertEquals ("Encoding property", "foo", d1.Encoding);
+                       Assertion.AssertEquals ("Encoding property", "foo", d1.Encoding);
 
                        XmlDeclaration d2 = document.CreateXmlDeclaration ("1.0", null, null);
-                       AssertEquals ("null Encoding property", String.Empty, d2.Encoding);
+                       Assertion.AssertEquals ("null Encoding property", String.Empty, d2.Encoding);
                }
 
-               public void TestStandaloneProperty ()
+               [Test]
+               public void StandaloneProperty ()
                {
                        XmlDeclaration d1 = document.CreateXmlDeclaration ("1.0", null, "yes");
-                       AssertEquals ("Yes standalone property", "yes", d1.Standalone);
+                       Assertion.AssertEquals ("Yes standalone property", "yes", d1.Standalone);
 
                        XmlDeclaration d2 = document.CreateXmlDeclaration ("1.0", null, "no");
-                       AssertEquals ("No standalone property", "no", d2.Standalone);
+                       Assertion.AssertEquals ("No standalone property", "no", d2.Standalone);
 
                        XmlDeclaration d3 = document.CreateXmlDeclaration ("1.0", null, null);
-                       AssertEquals ("null Standalone property", String.Empty, d3.Standalone);
+                       Assertion.AssertEquals ("null Standalone property", String.Empty, d3.Standalone);
                }
 
-               public void TestValueProperty ()
+               [Test]
+               public void ValueProperty ()
                {
                        string expected = "version=\"1.0\" encoding=\"ISO-8859-1\" standalone=\"yes\"" ;
 
                        XmlDeclaration d = document.CreateXmlDeclaration ("1.0", "ISO-8859-1", "yes");
-                       AssertEquals ("Value property", expected, d.Value);
+                       Assertion.AssertEquals ("Value property", expected, d.Value);
 
                        d.Value = expected;
-                       AssertEquals ("Value round-trip", expected, d.Value);
+                       Assertion.AssertEquals ("Value round-trip", expected, d.Value);
 
                        d.Value = "   " + expected;
-                       AssertEquals ("Value round-trip (padded)", expected, d.Value);
+                       Assertion.AssertEquals ("Value round-trip (padded)", expected, d.Value);
 
                        d.Value = "version=\"1.0\"     encoding=\"ISO-8859-1\" standalone=\"yes\"" ;
-                       AssertEquals ("Value round-trip (padded 2)", expected, d.Value);
+                       Assertion.AssertEquals ("Value round-trip (padded 2)", expected, d.Value);
 
                        d.Value = "version=\"1.0\"\tencoding=\"ISO-8859-1\" standalone=\"yes\"" ;
-                       AssertEquals ("Value round-trip (\\t)", expected, d.Value);
+                       Assertion.AssertEquals ("Value round-trip (\\t)", expected, d.Value);
 
                        d.Value = "version=\"1.0\"\n    encoding=\"ISO-8859-1\" standalone=\"yes\"" ;
-                       AssertEquals ("Value round-trip (\\n)", expected, d.Value);
+                       Assertion.AssertEquals ("Value round-trip (\\n)", expected, d.Value);
 
                        d.Value = "version=\"1.0\"    encoding  =   \"ISO-8859-1\" standalone = \"yes\"" ;
-                       AssertEquals ("Value round-trip (spaces)", expected, d.Value);
+                       Assertion.AssertEquals ("Value round-trip (spaces)", expected, d.Value);
 
                        d.Value = "version='1.0' encoding='ISO-8859-1' standalone='yes'" ;
-                       AssertEquals ("Value round-trip ('s)", expected, d.Value);
+                       Assertion.AssertEquals ("Value round-trip ('s)", expected, d.Value);
 
                }
 
-               public void TestXmlCommentCloneNode ()
+               [Test]
+               public void XmlCommentCloneNode ()
                {
                        XmlNode original = declaration;
 
                        XmlNode shallow = declaration.CloneNode (false); // shallow
-                       TestXmlNodeBaseProperties (original, shallow);
+                       XmlNodeBaseProperties (original, shallow);
                        
                        XmlNode deep = declaration.CloneNode (true); // deep
-                       TestXmlNodeBaseProperties (original, deep);
+                       XmlNodeBaseProperties (original, deep);
 
-                        AssertEquals ("deep cloning differs from shallow cloning",
+                        Assertion.AssertEquals ("deep cloning differs from shallow cloning",
                                      deep.OuterXml, shallow.OuterXml);
                }
        }
index 4c9699f5dcb3a36d394b35af003f86595923ac54..d184af78f8d14e3f6c677e9186b5552220ae5365 100755 (executable)
@@ -2,8 +2,10 @@
 // System.Xml.XmlDocumentFragment.cs
 //
 // Author: Atsushi Enomoto (ginga@kit.hi-ho.ne.jp)
+// Author: Martin Willemoes Hansen (mwh@sysrq.dk)
 //
 // (C) 2002 Atsushi Enomoto
+// (C) 2003 Martin Willemoes Hansen
 //
 
 using System;
@@ -13,29 +15,23 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class XmlDocumentFragmentTests : TestCase
+       [TestFixture]
+       public class XmlDocumentFragmentTests
        {
                XmlDocument document;
                XmlDocumentFragment fragment;
-               
-               public XmlDocumentFragmentTests (string name)
-                       : base (name)
-               {
-               }
-
-               protected override void SetUp ()
-               {
-               }
 
-               public void TestConstructor ()
+               [Test]
+               public void Constructor ()
                {
                        XmlDocument d = new XmlDocument ();
                        XmlDocumentFragment df = d.CreateDocumentFragment ();
-                       AssertEquals ("#Constructor.NodeName", "#document-fragment", df.Name);
-                       AssertEquals ("#Constructor.NodeType", XmlNodeType.DocumentFragment, df.NodeType);
+                       Assertion.AssertEquals ("#Constructor.NodeName", "#document-fragment", df.Name);
+                       Assertion.AssertEquals ("#Constructor.NodeType", XmlNodeType.DocumentFragment, df.NodeType);
                }
 
-               public void TestAppendChildToFragment ()
+               [Test]
+               public void AppendChildToFragment ()
                {
                        document = new XmlDocument ();
                        fragment = document.CreateDocumentFragment ();
@@ -45,12 +41,13 @@ namespace MonoTests.System.Xml
 
                        // appending element to fragment
                        fragment.AppendChild (el);
-                       AssertNotNull ("#AppendChildToFragment.Element", fragment.FirstChild);
-                       AssertNotNull ("#AppendChildToFragment.Element.Children", fragment.FirstChild.FirstChild);
-                       AssertEquals ("#AppendChildToFragment.Element.Child.Text", "Test Paragraph", fragment.FirstChild.FirstChild.Value);
+                       Assertion.AssertNotNull ("#AppendChildToFragment.Element", fragment.FirstChild);
+                       Assertion.AssertNotNull ("#AppendChildToFragment.Element.Children", fragment.FirstChild.FirstChild);
+                       Assertion.AssertEquals ("#AppendChildToFragment.Element.Child.Text", "Test Paragraph", fragment.FirstChild.FirstChild.Value);
                }
 
-               public void TestAppendFragmentToElement ()
+               [Test]
+               public void AppendFragmentToElement ()
                {
                        document = new XmlDocument ();
                        fragment = document.CreateDocumentFragment ();
@@ -61,13 +58,14 @@ namespace MonoTests.System.Xml
 
                        // appending fragment to element
                        body.AppendChild (fragment);
-                       AssertNotNull ("#AppendFragmentToElement.Exist", body.FirstChild);
-                       AssertEquals ("#AppendFragmentToElement.ChildIsElement", XmlNodeType.Element, body.FirstChild.NodeType);
-                       AssertEquals ("#AppendFragmentToElement.FirstChild", "p", body.FirstChild.Name);
-                       AssertEquals ("#AppendFragmentToElement.LastChild", "div", body.LastChild.Name);
+                       Assertion.AssertNotNull ("#AppendFragmentToElement.Exist", body.FirstChild);
+                       Assertion.AssertEquals ("#AppendFragmentToElement.ChildIsElement", XmlNodeType.Element, body.FirstChild.NodeType);
+                       Assertion.AssertEquals ("#AppendFragmentToElement.FirstChild", "p", body.FirstChild.Name);
+                       Assertion.AssertEquals ("#AppendFragmentToElement.LastChild", "div", body.LastChild.Name);
                }
 
-               public void TestGetInnerXml ()
+               [Test]
+               public void GetInnerXml ()
                {
                        // this will be also tests of TestWriteTo()/TestWriteContentTo()
 
@@ -76,18 +74,19 @@ namespace MonoTests.System.Xml
                        fragment.AppendChild (document.CreateElement ("foo"));
                        fragment.AppendChild (document.CreateElement ("bar"));
                        fragment.AppendChild (document.CreateElement ("baz"));
-                       AssertEquals ("#Simple", "<foo /><bar /><baz />", fragment.InnerXml);
+                       Assertion.AssertEquals ("#Simple", "<foo /><bar /><baz />", fragment.InnerXml);
                }
 
-               public void TestSetInnerXml ()
+               [Test]
+               public void SetInnerXml ()
                {
                        document = new XmlDocument ();
                        fragment = document.CreateDocumentFragment ();
                        fragment.InnerXml = "<foo /><bar><child /></bar><baz />";
-                       AssertEquals ("foo", fragment.FirstChild.Name);
-                       AssertEquals ("bar", fragment.FirstChild.NextSibling.Name);
-                       AssertEquals ("child", fragment.FirstChild.NextSibling.FirstChild.Name);
-                       AssertEquals ("baz", fragment.LastChild.Name);
+                       Assertion.AssertEquals ("foo", fragment.FirstChild.Name);
+                       Assertion.AssertEquals ("bar", fragment.FirstChild.NextSibling.Name);
+                       Assertion.AssertEquals ("child", fragment.FirstChild.NextSibling.FirstChild.Name);
+                       Assertion.AssertEquals ("baz", fragment.LastChild.Name);
                }
        }
 }
index 897090db9fe8fd3b1ae98d43987a5c935f29a60e..94404d252b1b47b9c0c28d93adb7f6142d0ba4b1 100644 (file)
@@ -4,8 +4,10 @@
 // Authors:
 //   Jason Diamond <jason@injektilo.org>
 //   Kral Ferch <kral_ferch@hotmail.com>
+//   Martin Willemoes Hansen <mwh@sysrq.dk>
 //
 // (C) 2002 Jason Diamond, Kral Ferch
+// (C) 2003 Martin Willemoes Hansen
 //
 
 using System;
@@ -18,11 +20,9 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class XmlDocumentTests : TestCase
+       [TestFixture]
+       public class XmlDocumentTests
        {
-               public XmlDocumentTests () : base ("MonoTests.System.Xml.XmlDocumentTests testsuite") {}
-               public XmlDocumentTests (string name) : base (name) {}
-
                private XmlDocument document;
                private ArrayList eventStrings = new ArrayList();
 
@@ -81,189 +81,197 @@ namespace MonoTests.System.Xml
                        throw new Exception ("don't remove the element.");
                }
 
-               protected override void SetUp ()
+               [SetUp]
+               public void GetReady ()
                {
                        document = new XmlDocument ();
                        document.PreserveWhitespace = true;
                }
 
-               public void TestCreateNodeNodeTypeNameEmptyParams ()
+               [Test]
+               public void CreateNodeNodeTypeNameEmptyParams ()
                {
                        XmlNode node;
 
                        try {
                                node = document.CreateNode (null, null, null);
-                               Fail ("Expected an ArgumentException to be thrown.");
+                               Assertion.Fail ("Expected an ArgumentException to be thrown.");
                        } catch (ArgumentException) {}
 
                        try {
                                node = document.CreateNode ("attribute", null, null);
-                               Fail ("Expected a NullReferenceException to be thrown.");
+                               Assertion.Fail ("Expected a NullReferenceException to be thrown.");
                        } catch (NullReferenceException) {}
 
                        try {
                                node = document.CreateNode ("attribute", "", null);
-                               Fail ("Expected an ArgumentException to be thrown.");
+                               Assertion.Fail ("Expected an ArgumentException to be thrown.");
                        } catch (ArgumentException) {}
 
                        try {
                                node = document.CreateNode ("element", null, null);
-                               Fail ("Expected a NullReferenceException to be thrown.");
+                               Assertion.Fail ("Expected a NullReferenceException to be thrown.");
                        } catch (NullReferenceException) {}
 
                        try {
                                node = document.CreateNode ("element", "", null);
-                               Fail ("Expected an ArgumentException to be thrown.");
+                               Assertion.Fail ("Expected an ArgumentException to be thrown.");
                        } catch (ArgumentException) {}
 
                        try {
                                node = document.CreateNode ("entityreference", null, null);
-                               Fail ("Expected a NullReferenceException to be thrown.");
+                               Assertion.Fail ("Expected a NullReferenceException to be thrown.");
                        } catch (NullReferenceException) {}
                }
 
-               public void TestCreateNodeInvalidXmlNodeType ()
+               [Test]
+               public void CreateNodeInvalidXmlNodeType ()
                {
                        XmlNode node;
 
                        try {
                                node = document.CreateNode (XmlNodeType.EndElement, null, null);
-                               Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+                               Assertion.Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
                        } catch (ArgumentOutOfRangeException) {}
 
                        try {
                                node = document.CreateNode (XmlNodeType.EndEntity, null, null);
-                               Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+                               Assertion.Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
                        } catch (ArgumentOutOfRangeException) {}
 
                        try {
                                node = document.CreateNode (XmlNodeType.Entity, null, null);
-                               Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+                               Assertion.Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
                        } catch (ArgumentOutOfRangeException) {}
 
                        try {
                                node = document.CreateNode (XmlNodeType.None, null, null);
-                               Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+                               Assertion.Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
                        } catch (ArgumentOutOfRangeException) {}
 
                        try {
                                node = document.CreateNode (XmlNodeType.Notation, null, null);
-                               Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
+                               Assertion.Fail ("Expected an ArgumentOutOfRangeException to be thrown.");
                        } catch (ArgumentOutOfRangeException) {}
 
                        // TODO:  undocumented allowable type.
                        node = document.CreateNode (XmlNodeType.XmlDeclaration, null, null);
-                       AssertEquals (XmlNodeType.XmlDeclaration, node.NodeType);
+                       Assertion.AssertEquals (XmlNodeType.XmlDeclaration, node.NodeType);
                }
 
-               public void TestCreateNodeWhichParamIsUsed ()
+               [Test]
+               public void CreateNodeWhichParamIsUsed ()
                {
                        XmlNode node;
 
                        // No constructor params for Document, DocumentFragment.
 
                        node = document.CreateNode (XmlNodeType.CDATA, "a", "b", "c");
-                       AssertEquals (String.Empty, ((XmlCDataSection)node).Value);
+                       Assertion.AssertEquals (String.Empty, ((XmlCDataSection)node).Value);
 
                        node = document.CreateNode (XmlNodeType.Comment, "a", "b", "c");
-                       AssertEquals (String.Empty, ((XmlComment)node).Value);
+                       Assertion.AssertEquals (String.Empty, ((XmlComment)node).Value);
 
                        node = document.CreateNode (XmlNodeType.DocumentType, "a", "b", "c");
-                       AssertNull (((XmlDocumentType)node).Value);
+                       Assertion.AssertNull (((XmlDocumentType)node).Value);
 
 // TODO: add this back in to test when it's implemented.
 //                     node = document.CreateNode (XmlNodeType.EntityReference, "a", "b", "c");
-//                     AssertNull (((XmlEntityReference)node).Value);
+//                     Assertion.AssertNull (((XmlEntityReference)node).Value);
 
                        node = document.CreateNode (XmlNodeType.ProcessingInstruction, "a", "b", "c");
-                       AssertEquals (String.Empty, ((XmlProcessingInstruction)node).Value);
+                       Assertion.AssertEquals (String.Empty, ((XmlProcessingInstruction)node).Value);
 
                        node = document.CreateNode (XmlNodeType.SignificantWhitespace, "a", "b", "c");
-                       AssertEquals (String.Empty, ((XmlSignificantWhitespace)node).Value);
+                       Assertion.AssertEquals (String.Empty, ((XmlSignificantWhitespace)node).Value);
 
                        node = document.CreateNode (XmlNodeType.Text, "a", "b", "c");
-                       AssertEquals (String.Empty, ((XmlText)node).Value);
+                       Assertion.AssertEquals (String.Empty, ((XmlText)node).Value);
 
                        node = document.CreateNode (XmlNodeType.Whitespace, "a", "b", "c");
-                       AssertEquals (String.Empty, ((XmlWhitespace)node).Value);
+                       Assertion.AssertEquals (String.Empty, ((XmlWhitespace)node).Value);
 
                        node = document.CreateNode (XmlNodeType.XmlDeclaration, "a", "b", "c");
-                       AssertEquals ("version=\"1.0\"", ((XmlDeclaration)node).Value);
+                       Assertion.AssertEquals ("version=\"1.0\"", ((XmlDeclaration)node).Value);
                }
 
-               public void TestCreateNodeNodeTypeName ()
+               [Test]
+               public void CreateNodeNodeTypeName ()
                {
                        XmlNode node;
 
                        try {
                                node = document.CreateNode ("foo", null, null);
-                               Fail ("Expected an ArgumentException to be thrown.");
+                               Assertion.Fail ("Expected an ArgumentException to be thrown.");
                        } catch (ArgumentException) {}
 
                        node = document.CreateNode("attribute", "foo", null);
-                       AssertEquals (XmlNodeType.Attribute, node.NodeType);
+                       Assertion.AssertEquals (XmlNodeType.Attribute, node.NodeType);
 
                        node = document.CreateNode("cdatasection", null, null);
-                       AssertEquals (XmlNodeType.CDATA, node.NodeType);
+                       Assertion.AssertEquals (XmlNodeType.CDATA, node.NodeType);
 
                        node = document.CreateNode("comment", null, null);
-                       AssertEquals (XmlNodeType.Comment, node.NodeType);
+                       Assertion.AssertEquals (XmlNodeType.Comment, node.NodeType);
 
                        node = document.CreateNode("document", null, null);
-                       AssertEquals (XmlNodeType.Document, node.NodeType);
+                       Assertion.AssertEquals (XmlNodeType.Document, node.NodeType);
                        // TODO: test which constructor this ended up calling,
                        // i.e. reuse underlying NameTable or not?
 
 // TODO: add this back in to test when it's implemented.
 //                     node = document.CreateNode("documentfragment", null, null);
-//                     AssertEquals (XmlNodeType.DocumentFragment, node.NodeType);
+//                     Assertion.AssertEquals (XmlNodeType.DocumentFragment, node.NodeType);
 
                        node = document.CreateNode("documenttype", null, null);
-                       AssertEquals (XmlNodeType.DocumentType, node.NodeType);
+                       Assertion.AssertEquals (XmlNodeType.DocumentType, node.NodeType);
 
                        node = document.CreateNode("element", "foo", null);
-                       AssertEquals (XmlNodeType.Element, node.NodeType);
+                       Assertion.AssertEquals (XmlNodeType.Element, node.NodeType);
 
 // TODO: add this back in to test when it's implemented.
 //                     node = document.CreateNode("entityreference", "foo", null);
-//                     AssertEquals (XmlNodeType.EntityReference, node.NodeType);
+//                     Assertion.AssertEquals (XmlNodeType.EntityReference, node.NodeType);
 
                        node = document.CreateNode("processinginstruction", null, null);
-                       AssertEquals (XmlNodeType.ProcessingInstruction, node.NodeType);
+                       Assertion.AssertEquals (XmlNodeType.ProcessingInstruction, node.NodeType);
 
                        node = document.CreateNode("significantwhitespace", null, null);
-                       AssertEquals (XmlNodeType.SignificantWhitespace, node.NodeType);
+                       Assertion.AssertEquals (XmlNodeType.SignificantWhitespace, node.NodeType);
 
                        node = document.CreateNode("text", null, null);
-                       AssertEquals (XmlNodeType.Text, node.NodeType);
+                       Assertion.AssertEquals (XmlNodeType.Text, node.NodeType);
 
                        node = document.CreateNode("whitespace", null, null);
-                       AssertEquals (XmlNodeType.Whitespace, node.NodeType);
+                       Assertion.AssertEquals (XmlNodeType.Whitespace, node.NodeType);
                }
 
-               public void TestDocumentElement ()
+               [Test]
+               public void DocumentElement ()
                {
-                       AssertNull (document.DocumentElement);
+                       Assertion.AssertNull (document.DocumentElement);
                        XmlElement element = document.CreateElement ("foo", "bar", "http://foo/");
-                       AssertNotNull (element);
+                       Assertion.AssertNotNull (element);
 
-                       AssertEquals ("foo", element.Prefix);
-                       AssertEquals ("bar", element.LocalName);
-                       AssertEquals ("http://foo/", element.NamespaceURI);
+                       Assertion.AssertEquals ("foo", element.Prefix);
+                       Assertion.AssertEquals ("bar", element.LocalName);
+                       Assertion.AssertEquals ("http://foo/", element.NamespaceURI);
 
-                       AssertEquals ("foo:bar", element.Name);
+                       Assertion.AssertEquals ("foo:bar", element.Name);
 
-                       AssertSame (element, document.AppendChild (element));
+                       Assertion.AssertSame (element, document.AppendChild (element));
 
-                       AssertSame (element, document.DocumentElement);
+                       Assertion.AssertSame (element, document.DocumentElement);
                }
 
-               public void TestDocumentEmpty()
+               [Test]
+               public void DocumentEmpty()
                {
-                       AssertEquals ("Incorrect output for empty document.", "", document.OuterXml);
+                       Assertion.AssertEquals ("Incorrect output for empty document.", "", document.OuterXml);
                }
 
-               public void TestEventNodeChanged()
+               [Test]
+               public void EventNodeChanged()
                {
                        XmlElement element;
                        XmlComment comment;
@@ -274,19 +282,19 @@ namespace MonoTests.System.Xml
                        document.AppendChild (document.CreateElement ("foo"));
                        comment = document.CreateComment ("bar");
                        document.DocumentElement.AppendChild (comment);
-                       AssertEquals ("<!--bar-->", document.DocumentElement.InnerXml);
+                       Assertion.AssertEquals ("<!--bar-->", document.DocumentElement.InnerXml);
                        comment.Value = "baz";
-                       Assert (eventStrings.Contains ("NodeChanged, Change, <!--baz-->, foo, foo"));
-                       AssertEquals ("<!--baz-->", document.DocumentElement.InnerXml);
+                       Assertion.Assert (eventStrings.Contains ("NodeChanged, Change, <!--baz-->, foo, foo"));
+                       Assertion.AssertEquals ("<!--baz-->", document.DocumentElement.InnerXml);
 
                        // Node that isn't part of the document but created by the document.
                        element = document.CreateElement ("foo");
                        comment = document.CreateComment ("bar");
                        element.AppendChild (comment);
-                       AssertEquals ("<!--bar-->", element.InnerXml);
+                       Assertion.AssertEquals ("<!--bar-->", element.InnerXml);
                        comment.Value = "baz";
-                       Assert (eventStrings.Contains ("NodeChanged, Change, <!--baz-->, foo, foo"));
-                       AssertEquals ("<!--baz-->", element.InnerXml);
+                       Assertion.Assert (eventStrings.Contains ("NodeChanged, Change, <!--baz-->, foo, foo"));
+                       Assertion.AssertEquals ("<!--baz-->", element.InnerXml);
 
 /*
  TODO:  Insert this when XmlNode.InnerText() and XmlNode.InnerXml() have been implemented.
@@ -296,17 +304,18 @@ namespace MonoTests.System.Xml
                        element.InnerText = "bar";
                        document.AppendChild(element);
                        element.InnerText = "baz";
-                       Assert(eventStrings.Contains("NodeChanged, Change, baz, foo, foo"));
+                       Assertion.Assert(eventStrings.Contains("NodeChanged, Change, baz, foo, foo"));
                        
                        // Node that isn't part of the document but created by the document.
                        element = document.CreateElement("qux");
                        element.InnerText = "quux";
                        element.InnerText = "quuux";
-                       Assert(eventStrings.Contains("NodeChanged, Change, quuux, qux, qux"));
+                       Assertion.Assert(eventStrings.Contains("NodeChanged, Change, quuux, qux, qux"));
 */
                }
 
-               public void TestEventNodeChanging()
+               [Test]
+               public void EventNodeChanging()
                {
                        XmlElement element;
                        XmlComment comment;
@@ -317,32 +326,32 @@ namespace MonoTests.System.Xml
                        document.AppendChild (document.CreateElement ("foo"));
                        comment = document.CreateComment ("bar");
                        document.DocumentElement.AppendChild (comment);
-                       AssertEquals ("<!--bar-->", document.DocumentElement.InnerXml);
+                       Assertion.AssertEquals ("<!--bar-->", document.DocumentElement.InnerXml);
                        comment.Value = "baz";
-                       Assert (eventStrings.Contains ("NodeChanging, Change, <!--bar-->, foo, foo"));
-                       AssertEquals ("<!--baz-->", document.DocumentElement.InnerXml);
+                       Assertion.Assert (eventStrings.Contains ("NodeChanging, Change, <!--bar-->, foo, foo"));
+                       Assertion.AssertEquals ("<!--baz-->", document.DocumentElement.InnerXml);
 
                        // Node that isn't part of the document but created by the document.
                        element = document.CreateElement ("foo");
                        comment = document.CreateComment ("bar");
                        element.AppendChild (comment);
-                       AssertEquals ("<!--bar-->", element.InnerXml);
+                       Assertion.AssertEquals ("<!--bar-->", element.InnerXml);
                        comment.Value = "baz";
-                       Assert (eventStrings.Contains ("NodeChanging, Change, <!--bar-->, foo, foo"));
-                       AssertEquals ("<!--baz-->", element.InnerXml);
+                       Assertion.Assert (eventStrings.Contains ("NodeChanging, Change, <!--bar-->, foo, foo"));
+                       Assertion.AssertEquals ("<!--baz-->", element.InnerXml);
 
                        // If an exception is thrown the Document returns to original state.
                        document.NodeChanging += new XmlNodeChangedEventHandler (this.EventNodeChangingException);
                        element = document.CreateElement("foo");
                        comment = document.CreateComment ("bar");
                        element.AppendChild (comment);
-                       AssertEquals ("<!--bar-->", element.InnerXml);
+                       Assertion.AssertEquals ("<!--bar-->", element.InnerXml);
                        try 
                        {
                                comment.Value = "baz";
-                               Fail("Expected an exception to be thrown by the NodeChanging event handler method EventNodeChangingException().");
+                               Assertion.Fail("Expected an exception to be thrown by the NodeChanging event handler method EventNodeChangingException().");
                        } catch (Exception) {}
-                       AssertEquals ("<!--bar-->", element.InnerXml);
+                       Assertion.AssertEquals ("<!--bar-->", element.InnerXml);
 
                        // Yes it's a bit anal but this tests whether the node changing event exception fires before the
                        // ArgumentOutOfRangeException.  Turns out it does so that means our implementation needs to raise
@@ -350,7 +359,7 @@ namespace MonoTests.System.Xml
                        try 
                        {
                                comment.ReplaceData(-1, 0, "qux");
-                               Fail("Expected an ArgumentOutOfRangeException to be thrown.");
+                               Assertion.Fail("Expected an ArgumentOutOfRangeException to be thrown.");
                        } 
                        catch (Exception) {}
 
@@ -362,13 +371,13 @@ namespace MonoTests.System.Xml
                        element.InnerText = "bar";
                        document.AppendChild(element);
                        element.InnerText = "baz";
-                       Assert(eventStrings.Contains("NodeChanging, Change, bar, foo, foo"));
+                       Assertion.Assert(eventStrings.Contains("NodeChanging, Change, bar, foo, foo"));
 
                        // Node that isn't part of the document but created by the document.
                        element = document.CreateElement("foo");
                        element.InnerText = "bar";
                        element.InnerText = "baz";
-                       Assert(eventStrings.Contains("NodeChanging, Change, bar, foo, foo"));
+                       Assertion.Assert(eventStrings.Contains("NodeChanging, Change, bar, foo, foo"));
 
                        // If an exception is thrown the Document returns to original state.
                        document.NodeChanging += new XmlNodeChangedEventHandler (this.EventNodeChangingException);
@@ -376,13 +385,14 @@ namespace MonoTests.System.Xml
                        element.InnerText = "bar";
                        try {
                                element.InnerText = "baz";
-                               Fail("Expected an exception to be thrown by the NodeChanging event handler method EventNodeChangingException().");
+                               Assertion.Fail("Expected an exception to be thrown by the NodeChanging event handler method EventNodeChangingException().");
                        } catch (Exception) {}
-                       AssertEquals("bar", element.InnerText);
+                       Assertion.AssertEquals("bar", element.InnerText);
 */
                }
 
-               public void TestEventNodeInserted()
+               [Test]
+               public void EventNodeInserted()
                {
                        XmlElement element;
 
@@ -391,20 +401,21 @@ namespace MonoTests.System.Xml
                        // Inserted 'foo' element to the document.
                        element = document.CreateElement ("foo");
                        document.AppendChild (element);
-                       Assert (eventStrings.Contains ("NodeInserted, Insert, <foo />, <none>, #document"));
+                       Assertion.Assert (eventStrings.Contains ("NodeInserted, Insert, <foo />, <none>, #document"));
 
                        // Append child on node in document
                        element = document.CreateElement ("foo");
                        document.DocumentElement.AppendChild (element);
-                       Assert (eventStrings.Contains ("NodeInserted, Insert, <foo />, <none>, foo"));
+                       Assertion.Assert (eventStrings.Contains ("NodeInserted, Insert, <foo />, <none>, foo"));
 
                        // Append child on node not in document but created by document
                        element = document.CreateElement ("bar");
                        element.AppendChild(document.CreateElement ("bar"));
-                       Assert(eventStrings.Contains("NodeInserted, Insert, <bar />, <none>, bar"));
+                       Assertion.Assert(eventStrings.Contains("NodeInserted, Insert, <bar />, <none>, bar"));
                }
 
-               public void TestEventNodeInserting()
+               [Test]
+               public void EventNodeInserting()
                {
                        XmlElement element;
 
@@ -413,33 +424,34 @@ namespace MonoTests.System.Xml
                        // Inserting 'foo' element to the document.
                        element = document.CreateElement ("foo");
                        document.AppendChild (element);
-                       Assert (eventStrings.Contains ("NodeInserting, Insert, <foo />, <none>, #document"));
+                       Assertion.Assert (eventStrings.Contains ("NodeInserting, Insert, <foo />, <none>, #document"));
 
                        // Append child on node in document
                        element = document.CreateElement ("foo");
                        document.DocumentElement.AppendChild (element);
-                       Assert(eventStrings.Contains ("NodeInserting, Insert, <foo />, <none>, foo"));
+                       Assertion.Assert(eventStrings.Contains ("NodeInserting, Insert, <foo />, <none>, foo"));
 
                        // Append child on node not in document but created by document
                        element = document.CreateElement ("bar");
-                       AssertEquals (0, element.ChildNodes.Count);
+                       Assertion.AssertEquals (0, element.ChildNodes.Count);
                        element.AppendChild (document.CreateElement ("bar"));
-                       Assert (eventStrings.Contains ("NodeInserting, Insert, <bar />, <none>, bar"));
-                       AssertEquals (1, element.ChildNodes.Count);
+                       Assertion.Assert (eventStrings.Contains ("NodeInserting, Insert, <bar />, <none>, bar"));
+                       Assertion.AssertEquals (1, element.ChildNodes.Count);
 
                        // If an exception is thrown the Document returns to original state.
                        document.NodeInserting += new XmlNodeChangedEventHandler (this.EventNodeInsertingException);
-                       AssertEquals (1, element.ChildNodes.Count);
+                       Assertion.AssertEquals (1, element.ChildNodes.Count);
                        try 
                        {
                                element.AppendChild (document.CreateElement("baz"));
-                               Fail ("Expected an exception to be thrown by the NodeInserting event handler method EventNodeInsertingException().");
+                               Assertion.Fail ("Expected an exception to be thrown by the NodeInserting event handler method EventNodeInsertingException().");
                        } 
                        catch (Exception) {}
-                       AssertEquals (1, element.ChildNodes.Count);
+                       Assertion.AssertEquals (1, element.ChildNodes.Count);
                }
 
-               public void TestEventNodeRemoved()
+               [Test]
+               public void EventNodeRemoved()
                {
                        XmlElement element;
                        XmlElement element2;
@@ -450,10 +462,10 @@ namespace MonoTests.System.Xml
                        element = document.CreateElement ("foo");
                        element2 = document.CreateElement ("bar");
                        element.AppendChild (element2);
-                       AssertEquals (1, element.ChildNodes.Count);
+                       Assertion.AssertEquals (1, element.ChildNodes.Count);
                        element.RemoveChild (element2);
-                       Assert (eventStrings.Contains ("NodeRemoved, Remove, <bar />, foo, <none>"));
-                       AssertEquals (0, element.ChildNodes.Count);
+                       Assertion.Assert (eventStrings.Contains ("NodeRemoved, Remove, <bar />, foo, <none>"));
+                       Assertion.AssertEquals (0, element.ChildNodes.Count);
 
 /*
  * TODO:  put this test back in when AttributeCollection.RemoveAll() is implemented.
@@ -462,10 +474,10 @@ namespace MonoTests.System.Xml
                        element = document.CreateElement ("foo");
                        element2 = document.CreateElement ("bar");
                        element.AppendChild(element2);
-                       AssertEquals(1, element.ChildNodes.Count);
+                       Assertion.AssertEquals(1, element.ChildNodes.Count);
                        element.RemoveAll();
-                       Assert (eventStrings.Contains ("NodeRemoved, Remove, <bar />, foo, <none>"));
-                       AssertEquals(0, element.ChildNodes.Count);
+                       Assertion.Assert (eventStrings.Contains ("NodeRemoved, Remove, <bar />, foo, <none>"));
+                       Assertion.AssertEquals(0, element.ChildNodes.Count);
 */
 
                        // Removed 'bar' element from 'foo' inside document.
@@ -473,13 +485,14 @@ namespace MonoTests.System.Xml
                        document.AppendChild (element);
                        element = document.CreateElement ("bar");
                        document.DocumentElement.AppendChild (element);
-                       AssertEquals (1, document.DocumentElement.ChildNodes.Count);
+                       Assertion.AssertEquals (1, document.DocumentElement.ChildNodes.Count);
                        document.DocumentElement.RemoveChild (element);
-                       Assert (eventStrings.Contains ("NodeRemoved, Remove, <bar />, foo, <none>"));
-                       AssertEquals (0, document.DocumentElement.ChildNodes.Count);
+                       Assertion.Assert (eventStrings.Contains ("NodeRemoved, Remove, <bar />, foo, <none>"));
+                       Assertion.AssertEquals (0, document.DocumentElement.ChildNodes.Count);
                }
        
-               public void TestEventNodeRemoving()
+               [Test]
+               public void EventNodeRemoving()
                {
                        XmlElement element;
                        XmlElement element2;
@@ -490,10 +503,10 @@ namespace MonoTests.System.Xml
                        element = document.CreateElement ("foo");
                        element2 = document.CreateElement ("bar");
                        element.AppendChild (element2);
-                       AssertEquals (1, element.ChildNodes.Count);
+                       Assertion.AssertEquals (1, element.ChildNodes.Count);
                        element.RemoveChild (element2);
-                       Assert (eventStrings.Contains ("NodeRemoving, Remove, <bar />, foo, <none>"));
-                       AssertEquals (0, element.ChildNodes.Count);
+                       Assertion.Assert (eventStrings.Contains ("NodeRemoving, Remove, <bar />, foo, <none>"));
+                       Assertion.AssertEquals (0, element.ChildNodes.Count);
 
 /*
  * TODO:  put this test back in when AttributeCollection.RemoveAll() is implemented.
@@ -502,10 +515,10 @@ namespace MonoTests.System.Xml
                        element = document.CreateElement ("foo");
                        element2 = document.CreateElement ("bar");
                        element.AppendChild(element2);
-                       AssertEquals(1, element.ChildNodes.Count);
+                       Assertion.AssertEquals(1, element.ChildNodes.Count);
                        element.RemoveAll();
-                       Assert (eventStrings.Contains ("NodeRemoving, Remove, <bar />, foo, <none>"));
-                       AssertEquals(0, element.ChildNodes.Count);
+                       Assertion.Assert (eventStrings.Contains ("NodeRemoving, Remove, <bar />, foo, <none>"));
+                       Assertion.AssertEquals(0, element.ChildNodes.Count);
 */
 
                        // Removing 'bar' element from 'foo' inside document.
@@ -513,25 +526,26 @@ namespace MonoTests.System.Xml
                        document.AppendChild (element);
                        element = document.CreateElement ("bar");
                        document.DocumentElement.AppendChild (element);
-                       AssertEquals (1, document.DocumentElement.ChildNodes.Count);
+                       Assertion.AssertEquals (1, document.DocumentElement.ChildNodes.Count);
                        document.DocumentElement.RemoveChild (element);
-                       Assert (eventStrings.Contains ("NodeRemoving, Remove, <bar />, foo, <none>"));
-                       AssertEquals (0, document.DocumentElement.ChildNodes.Count);
+                       Assertion.Assert (eventStrings.Contains ("NodeRemoving, Remove, <bar />, foo, <none>"));
+                       Assertion.AssertEquals (0, document.DocumentElement.ChildNodes.Count);
 
                        // If an exception is thrown the Document returns to original state.
                        document.NodeRemoving += new XmlNodeChangedEventHandler (this.EventNodeRemovingException);
                        element.AppendChild (element2);
-                       AssertEquals (1, element.ChildNodes.Count);
+                       Assertion.AssertEquals (1, element.ChildNodes.Count);
                        try 
                        {
                                element.RemoveChild(element2);
-                               Fail ("Expected an exception to be thrown by the NodeRemoving event handler method EventNodeRemovingException().");
+                               Assertion.Fail ("Expected an exception to be thrown by the NodeRemoving event handler method EventNodeRemovingException().");
                        } 
                        catch (Exception) {}
-                       AssertEquals (1, element.ChildNodes.Count);
+                       Assertion.AssertEquals (1, element.ChildNodes.Count);
                }
 
-               public void TestGetElementsByTagNameNoNameSpace ()
+               [Test]
+               public void GetElementsByTagNameNoNameSpace ()
                {
                        string xml = @"<library><book><title>XML Fun</title><author>John Doe</author>
                                <price>34.95</price></book><book><title>Bear and the Dragon</title>
@@ -545,10 +559,11 @@ namespace MonoTests.System.Xml
                        document = new XmlDocument ();
                        document.Load (memoryStream);
                        XmlNodeList bookList = document.GetElementsByTagName ("book");
-                       AssertEquals ("GetElementsByTagName (string) returned incorrect count.", 4, bookList.Count);
+                       Assertion.AssertEquals ("GetElementsByTagName (string) returned incorrect count.", 4, bookList.Count);
                }
 
-               public void TestGetElementsByTagNameUsingNameSpace ()
+               [Test]
+               public void GetElementsByTagNameUsingNameSpace ()
                {
                        StringBuilder xml = new StringBuilder ();
                        xml.Append ("<?xml version=\"1.0\" ?><library xmlns:North=\"http://www.foo.com\" ");
@@ -568,43 +583,44 @@ namespace MonoTests.System.Xml
                        document = new XmlDocument ();
                        document.Load (memoryStream);
                        XmlNodeList bookList = document.GetElementsByTagName ("book", "http://www.goo.com");
-                       AssertEquals ("GetElementsByTagName (string, uri) returned incorrect count.", 2, bookList.Count);
+                       Assertion.AssertEquals ("GetElementsByTagName (string, uri) returned incorrect count.", 2, bookList.Count);
                }
 
-       
-               public void TestInnerAndOuterXml ()
+               [Test]
+               public void InnerAndOuterXml ()
                {
-                       AssertEquals (String.Empty, document.InnerXml);
-                       AssertEquals (document.InnerXml, document.OuterXml);
+                       Assertion.AssertEquals (String.Empty, document.InnerXml);
+                       Assertion.AssertEquals (document.InnerXml, document.OuterXml);
 
                        XmlDeclaration declaration = document.CreateXmlDeclaration ("1.0", null, null);
                        document.AppendChild (declaration);
-                       AssertEquals ("<?xml version=\"1.0\"?>", document.InnerXml);
-                       AssertEquals (document.InnerXml, document.OuterXml);
+                       Assertion.AssertEquals ("<?xml version=\"1.0\"?>", document.InnerXml);
+                       Assertion.AssertEquals (document.InnerXml, document.OuterXml);
 
                        XmlElement element = document.CreateElement ("foo");
                        document.AppendChild (element);
-                       AssertEquals ("<?xml version=\"1.0\"?><foo />", document.InnerXml);
-                       AssertEquals (document.InnerXml, document.OuterXml);
+                       Assertion.AssertEquals ("<?xml version=\"1.0\"?><foo />", document.InnerXml);
+                       Assertion.AssertEquals (document.InnerXml, document.OuterXml);
 
                        XmlComment comment = document.CreateComment ("bar");
                        document.DocumentElement.AppendChild (comment);
-                       AssertEquals ("<?xml version=\"1.0\"?><foo><!--bar--></foo>", document.InnerXml);
-                       AssertEquals (document.InnerXml, document.OuterXml);
+                       Assertion.AssertEquals ("<?xml version=\"1.0\"?><foo><!--bar--></foo>", document.InnerXml);
+                       Assertion.AssertEquals (document.InnerXml, document.OuterXml);
 
                        XmlText text = document.CreateTextNode ("baz");
                        document.DocumentElement.AppendChild (text);
-                       AssertEquals ("<?xml version=\"1.0\"?><foo><!--bar-->baz</foo>", document.InnerXml);
-                       AssertEquals (document.InnerXml, document.OuterXml);
+                       Assertion.AssertEquals ("<?xml version=\"1.0\"?><foo><!--bar-->baz</foo>", document.InnerXml);
+                       Assertion.AssertEquals (document.InnerXml, document.OuterXml);
 
                        element = document.CreateElement ("quux");
                        element.SetAttribute ("quuux", "squonk");
                        document.DocumentElement.AppendChild (element);
-                       AssertEquals ("<?xml version=\"1.0\"?><foo><!--bar-->baz<quux quuux=\"squonk\" /></foo>", document.InnerXml);
-                       AssertEquals (document.InnerXml, document.OuterXml);
+                       Assertion.AssertEquals ("<?xml version=\"1.0\"?><foo><!--bar-->baz<quux quuux=\"squonk\" /></foo>", document.InnerXml);
+                       Assertion.AssertEquals (document.InnerXml, document.OuterXml);
                }
 
-               public void TestLoadWithSystemIOStream ()
+               [Test]
+               public void LoadWithSystemIOStream ()
                {                       
                        string xml = @"<library><book><title>XML Fun</title><author>John Doe</author>
                                <price>34.95</price></book><book><title>Bear and the Dragon</title>
@@ -617,128 +633,139 @@ namespace MonoTests.System.Xml
                        MemoryStream memoryStream = new MemoryStream (Encoding.UTF8.GetBytes (xml));
                        document = new XmlDocument ();
                        document.Load (memoryStream);
-                       AssertEquals ("Not Loaded From IOStream", true, document.HasChildNodes);
+                       Assertion.AssertEquals ("Not Loaded From IOStream", true, document.HasChildNodes);
                }
 
-               public void TestLoadXmlCDATA ()
+               [Test]
+               public void LoadXmlCDATA ()
                {
                        document.LoadXml ("<foo><![CDATA[bar]]></foo>");
-                       Assert (document.DocumentElement.FirstChild.NodeType == XmlNodeType.CDATA);
-                       AssertEquals ("bar", document.DocumentElement.FirstChild.Value);
+                       Assertion.Assert (document.DocumentElement.FirstChild.NodeType == XmlNodeType.CDATA);
+                       Assertion.AssertEquals ("bar", document.DocumentElement.FirstChild.Value);
                }
 
-               public void TestLoadXMLComment()
+               [Test]
+               public void LoadXMLComment()
                {
 // XmlTextReader needs to throw this exception
 //                     try {
 //                             document.LoadXml("<!--foo-->");
-//                             Fail("XmlException should have been thrown.");
+//                             Assertion.Fail("XmlException should have been thrown.");
 //                     }
 //                     catch (XmlException e) {
-//                             AssertEquals("Exception message doesn't match.", "The root element is missing.", e.Message);
+//                             Assertion.AssertEquals("Exception message doesn't match.", "The root element is missing.", e.Message);
 //                     }
 
                        document.LoadXml ("<foo><!--Comment--></foo>");
-                       Assert (document.DocumentElement.FirstChild.NodeType == XmlNodeType.Comment);
-                       AssertEquals ("Comment", document.DocumentElement.FirstChild.Value);
+                       Assertion.Assert (document.DocumentElement.FirstChild.NodeType == XmlNodeType.Comment);
+                       Assertion.AssertEquals ("Comment", document.DocumentElement.FirstChild.Value);
 
                        document.LoadXml (@"<foo><!--bar--></foo>");
-                       AssertEquals ("Incorrect target.", "bar", ((XmlComment)document.FirstChild.FirstChild).Data);
+                       Assertion.AssertEquals ("Incorrect target.", "bar", ((XmlComment)document.FirstChild.FirstChild).Data);
                }
 
-               public void TestLoadXmlElementSingle ()
+               [Test]
+               public void LoadXmlElementSingle ()
                {
-                       AssertNull (document.DocumentElement);
+                       Assertion.AssertNull (document.DocumentElement);
                        document.LoadXml ("<foo/>");
 
-                       AssertNotNull (document.DocumentElement);
-                       AssertSame (document.FirstChild, document.DocumentElement);
+                       Assertion.AssertNotNull (document.DocumentElement);
+                       Assertion.AssertSame (document.FirstChild, document.DocumentElement);
 
-                       AssertEquals (String.Empty, document.DocumentElement.Prefix);
-                       AssertEquals ("foo", document.DocumentElement.LocalName);
-                       AssertEquals (String.Empty, document.DocumentElement.NamespaceURI);
-                       AssertEquals ("foo", document.DocumentElement.Name);
+                       Assertion.AssertEquals (String.Empty, document.DocumentElement.Prefix);
+                       Assertion.AssertEquals ("foo", document.DocumentElement.LocalName);
+                       Assertion.AssertEquals (String.Empty, document.DocumentElement.NamespaceURI);
+                       Assertion.AssertEquals ("foo", document.DocumentElement.Name);
                }
 
-               public void TestLoadXmlElementWithAttributes ()
+               [Test]
+               public void LoadXmlElementWithAttributes ()
                {
-                       AssertNull (document.DocumentElement);
+                       Assertion.AssertNull (document.DocumentElement);
                        document.LoadXml ("<foo bar='baz' quux='quuux' hoge='hello &amp; world' />");
 
                        XmlElement documentElement = document.DocumentElement;
 
-                       AssertEquals ("baz", documentElement.GetAttribute ("bar"));
-                       AssertEquals ("quuux", documentElement.GetAttribute ("quux"));
-                       AssertEquals ("hello & world", documentElement.GetAttribute ("hoge"));
-                       AssertEquals ("hello & world", documentElement.Attributes ["hoge"].Value);
-                       AssertEquals (1, documentElement.GetAttributeNode ("hoge").ChildNodes.Count);
+                       Assertion.AssertEquals ("baz", documentElement.GetAttribute ("bar"));
+                       Assertion.AssertEquals ("quuux", documentElement.GetAttribute ("quux"));
+                       Assertion.AssertEquals ("hello & world", documentElement.GetAttribute ("hoge"));
+                       Assertion.AssertEquals ("hello & world", documentElement.Attributes ["hoge"].Value);
+                       Assertion.AssertEquals (1, documentElement.GetAttributeNode ("hoge").ChildNodes.Count);
                }
 
-               public void TestLoadXmlElementWithChildElement ()
+               [Test]
+               public void LoadXmlElementWithChildElement ()
                {
                        document.LoadXml ("<foo><bar/></foo>");
-                       Assert (document.ChildNodes.Count == 1);
-                       Assert (document.FirstChild.ChildNodes.Count == 1);
-                       AssertEquals ("foo", document.DocumentElement.LocalName);
-                       AssertEquals ("bar", document.DocumentElement.FirstChild.LocalName);
+                       Assertion.Assert (document.ChildNodes.Count == 1);
+                       Assertion.Assert (document.FirstChild.ChildNodes.Count == 1);
+                       Assertion.AssertEquals ("foo", document.DocumentElement.LocalName);
+                       Assertion.AssertEquals ("bar", document.DocumentElement.FirstChild.LocalName);
                }
 
-               public void TestLoadXmlElementWithTextNode ()
+               [Test]
+               public void LoadXmlElementWithTextNode ()
                {
                        document.LoadXml ("<foo>bar</foo>");
-                       Assert (document.DocumentElement.FirstChild.NodeType == XmlNodeType.Text);
-                       AssertEquals ("bar", document.DocumentElement.FirstChild.Value);
+                       Assertion.Assert (document.DocumentElement.FirstChild.NodeType == XmlNodeType.Text);
+                       Assertion.AssertEquals ("bar", document.DocumentElement.FirstChild.Value);
                }
 
-               public void TestLoadXmlExceptionClearsDocument ()
+               [Test]
+               public void LoadXmlExceptionClearsDocument ()
                {
                        document.LoadXml ("<foo/>");
-                       Assert (document.FirstChild != null);
+                       Assertion.Assert (document.FirstChild != null);
                        
                        try {
                                document.LoadXml ("<123/>");
-                               Fail ("An XmlException should have been thrown.");
+                               Assertion.Fail ("An XmlException should have been thrown.");
                        } catch (XmlException) {}
 
-                       Assert (document.FirstChild == null);
+                       Assertion.Assert (document.FirstChild == null);
                }
 
-               public void TestLoadXmlProcessingInstruction ()
+               [Test]
+               public void LoadXmlProcessingInstruction ()
                {
                        document.LoadXml (@"<?foo bar='baaz' quux='quuux'?><quuuux></quuuux>");
-                       AssertEquals ("Incorrect target.", "foo", ((XmlProcessingInstruction)document.FirstChild).Target);
-                       AssertEquals ("Incorrect data.", "bar='baaz' quux='quuux'", ((XmlProcessingInstruction)document.FirstChild).Data);
+                       Assertion.AssertEquals ("Incorrect target.", "foo", ((XmlProcessingInstruction)document.FirstChild).Target);
+                       Assertion.AssertEquals ("Incorrect data.", "bar='baaz' quux='quuux'", ((XmlProcessingInstruction)document.FirstChild).Data);
                }
 
-               public void TestOuterXml ()
+               [Test]
+               public void OuterXml ()
                {
                        string xml;
                        
                        xml = "<root><![CDATA[foo]]></root>";
                        document.LoadXml (xml);
-                       AssertEquals("XmlDocument with cdata OuterXml is incorrect.", xml, document.OuterXml);
+                       Assertion.AssertEquals("XmlDocument with cdata OuterXml is incorrect.", xml, document.OuterXml);
 
                        xml = "<root><!--foo--></root>";
                        document.LoadXml (xml);
-                       AssertEquals("XmlDocument with comment OuterXml is incorrect.", xml, document.OuterXml);
+                       Assertion.AssertEquals("XmlDocument with comment OuterXml is incorrect.", xml, document.OuterXml);
 
                        xml = "<root><?foo bar?></root>";
                        document.LoadXml (xml);
-                       AssertEquals("XmlDocument with processing instruction OuterXml is incorrect.", xml, document.OuterXml);
+                       Assertion.AssertEquals("XmlDocument with processing instruction OuterXml is incorrect.", xml, document.OuterXml);
                }
 
-               public void TestParentNodes ()
+               [Test]
+               public void ParentNodes ()
                {
                        document.LoadXml ("<foo><bar><baz/></bar></foo>");
                        XmlNode node = document.FirstChild.FirstChild.FirstChild;
-                       AssertEquals ("Wrong child found.", "baz", node.LocalName);
-                       AssertEquals ("Wrong parent.", "bar", node.ParentNode.LocalName);
-                       AssertEquals ("Wrong parent.", "foo", node.ParentNode.ParentNode.LocalName);
-                       AssertEquals ("Wrong parent.", "#document", node.ParentNode.ParentNode.ParentNode.LocalName);
-                       AssertNull ("Expected parent to be null.", node.ParentNode.ParentNode.ParentNode.ParentNode);
+                       Assertion.AssertEquals ("Wrong child found.", "baz", node.LocalName);
+                       Assertion.AssertEquals ("Wrong parent.", "bar", node.ParentNode.LocalName);
+                       Assertion.AssertEquals ("Wrong parent.", "foo", node.ParentNode.ParentNode.LocalName);
+                       Assertion.AssertEquals ("Wrong parent.", "#document", node.ParentNode.ParentNode.ParentNode.LocalName);
+                       Assertion.AssertNull ("Expected parent to be null.", node.ParentNode.ParentNode.ParentNode.ParentNode);
                }
 
-               public void TestRemovedElementNextSibling ()
+               [Test]
+               public void RemovedElementNextSibling ()
                {
                        XmlNode node;
                        XmlNode nextSibling;
@@ -747,11 +774,12 @@ namespace MonoTests.System.Xml
                        node = document.DocumentElement.FirstChild;
                        document.DocumentElement.RemoveChild (node);
                        nextSibling = node.NextSibling;
-                       AssertNull ("Expected removed node's next sibling to be null.", nextSibling);
+                       Assertion.AssertNull ("Expected removed node's next sibling to be null.", nextSibling);
                }
 
                // ImportNode
-               public void TestImportNode ()
+               [Test]
+               public void ImportNode ()
                {
                        XmlNode n;
 
@@ -764,103 +792,109 @@ namespace MonoTests.System.Xml
 
                        // Attribute
                        n = newDoc.ImportNode(bar.GetAttributeNode("href", xlinkURI), true);
-                       AssertEquals("#ImportNode.Attr.NS.LocalName", "href", n.LocalName);
-                       AssertEquals("#ImportNode.Attr.NS.NSURI", xlinkURI, n.NamespaceURI);
-                       AssertEquals("#ImportNode.Attr.NS.Value", "#foo", n.Value);
+                       Assertion.AssertEquals("#ImportNode.Attr.NS.LocalName", "href", n.LocalName);
+                       Assertion.AssertEquals("#ImportNode.Attr.NS.NSURI", xlinkURI, n.NamespaceURI);
+                       Assertion.AssertEquals("#ImportNode.Attr.NS.Value", "#foo", n.Value);
 
                        // CDATA
                        n = newDoc.ImportNode(bar.FirstChild.FirstChild, true);
-                       AssertEquals("#ImportNode.CDATA", "cdata section.\n\titem 1\n\titem 2\n", n.Value);
+                       Assertion.AssertEquals("#ImportNode.CDATA", "cdata section.\n\titem 1\n\titem 2\n", n.Value);
 
                        // Element
                        XmlElement e = newDoc.ImportNode(bar, true) as XmlElement;
-                       AssertEquals("#ImportNode.Element.Name", "bar", e.Name);
-                       AssertEquals("#ImportNode.Element.Attr", "#foo", e.GetAttribute("href", xlinkURI));
-                       AssertEquals("#ImportNode.Element.deep", "baz", e.FirstChild.Name);
+                       Assertion.AssertEquals("#ImportNode.Element.Name", "bar", e.Name);
+                       Assertion.AssertEquals("#ImportNode.Element.Attr", "#foo", e.GetAttribute("href", xlinkURI));
+                       Assertion.AssertEquals("#ImportNode.Element.deep", "baz", e.FirstChild.Name);
 
                        // Entity Reference:
                        //   [2002/10/14] CreateEntityReference was not implemented.
 //                     document.LoadXml("<!DOCTYPE test PUBLIC 'dummy' [<!ENTITY FOOENT 'foo'>]><root>&FOOENT;</root>");
 //                     n = newDoc.ImportNode(document.DocumentElement.FirstChild);
-//                     AssertEquals("#ImportNode.EntityReference", "FOOENT", n.Name);
-//                     AssertEquals("#ImportNode.EntityReference", "foo_", n.Value);
+//                     Assertion.AssertEquals("#ImportNode.EntityReference", "FOOENT", n.Name);
+//                     Assertion.AssertEquals("#ImportNode.EntityReference", "foo_", n.Value);
 
                        // Processing Instruction
                        document.LoadXml("<foo><?xml-stylesheet href='foo.xsl' ?></foo>");
                        XmlProcessingInstruction pi = (XmlProcessingInstruction)newDoc.ImportNode(document.DocumentElement.FirstChild, false);
-                       AssertEquals("#ImportNode.ProcessingInstruction.Name", "xml-stylesheet", pi.Name);
-                       AssertEquals("#ImportNode.ProcessingInstruction.Data", "href='foo.xsl'", pi.Data.Trim());
+                       Assertion.AssertEquals("#ImportNode.ProcessingInstruction.Name", "xml-stylesheet", pi.Name);
+                       Assertion.AssertEquals("#ImportNode.ProcessingInstruction.Data", "href='foo.xsl'", pi.Data.Trim());
                        
                        // Text
                        document.LoadXml(xml1);
                        n = newDoc.ImportNode((XmlText)bar.FirstChild.ChildNodes[1], true);
-                       AssertEquals("#ImportNode.Text", "From here, simple text node.", n.Value);
+                       Assertion.AssertEquals("#ImportNode.Text", "From here, simple text node.", n.Value);
 
                        // XmlDeclaration
                        document.LoadXml(xml1);
                        XmlDeclaration decl = (XmlDeclaration)newDoc.ImportNode(document.FirstChild, false);
-                       AssertEquals("#ImportNode.XmlDeclaration.Type", XmlNodeType.XmlDeclaration, decl.NodeType);
-                       AssertEquals("#ImportNode.XmlDeclaration.Encoding", "utf-8", decl.Encoding);
+                       Assertion.AssertEquals("#ImportNode.XmlDeclaration.Type", XmlNodeType.XmlDeclaration, decl.NodeType);
+                       Assertion.AssertEquals("#ImportNode.XmlDeclaration.Encoding", "utf-8", decl.Encoding);
                }
 
-               public void TestNameTable()
+               [Test]
+               public void NameTable()
                {
                        XmlDocument doc = new XmlDocument();
-                       AssertNotNull(doc.NameTable);
+                       Assertion.AssertNotNull(doc.NameTable);
                }
 
-               public void TestSingleEmptyRootDocument()
+               [Test]
+               public void SingleEmptyRootDocument()
                {
                        XmlDocument doc = new XmlDocument();
                        doc.LoadXml("<root />");
-                       AssertNotNull(doc.DocumentElement);
+                       Assertion.AssertNotNull(doc.DocumentElement);
                }
 
-               public void TestDocumentWithDoctypeDecl ()
+               [Test]
+               public void DocumentWithDoctypeDecl ()
                {
                        XmlDocument doc = new XmlDocument ();
                        try {
                                doc.LoadXml ("<!DOCTYPE test><root />");
                        } catch (XmlException) {
-                               Fail ("#DoctypeDecl.OnlyName");
+                               Assertion.Fail ("#DoctypeDecl.OnlyName");
                        }
                        try 
                        {
                                doc.LoadXml ("<!DOCTYPE test SYSTEM 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><root />");
                        } catch (XmlException) {
-                               Fail("#DoctypeDecl.System");
+                               Assertion.Fail("#DoctypeDecl.System");
                        }
                        try {
                                doc.LoadXml ("<!DOCTYPE test PUBLIC '-//test' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><root />");
                        } catch (XmlException) {
-                               Fail ("#DoctypeDecl.Public");
+                               Assertion.Fail ("#DoctypeDecl.Public");
                        }
                        // Should this be commented out?
 //                     try {
 //                             doc.LoadXml ("<!DOCTYPE test [<!ELEMENT foo >]><root />");
 //                     } catch (XmlException) {
-//                             Fail("#DoctypeDecl.ElementDecl");
+//                             Assertion.Fail("#DoctypeDecl.ElementDecl");
 //                     }
                }
 
-               public void TestCloneNode ()
+               [Test]
+               public void CloneNode ()
                {
                        XmlDocument doc = new XmlDocument ();
                        doc.LoadXml ("<foo><bar /><baz hoge='fuga'>TEST Text</baz></foo>");
                        XmlDocument doc2 = (XmlDocument)doc.CloneNode (false);
-                       AssertEquals ("ShallowCopy", 0, doc2.ChildNodes.Count);
+                       Assertion.AssertEquals ("ShallowCopy", 0, doc2.ChildNodes.Count);
                        doc2 = (XmlDocument)doc.CloneNode (true);
-                       AssertEquals ("DeepCopy", "foo", doc2.DocumentElement.Name);
+                       Assertion.AssertEquals ("DeepCopy", "foo", doc2.DocumentElement.Name);
                }
 
-               public void TestOuterXmlWithDefaultXmlns ()
+               [Test]
+               public void OuterXmlWithDefaultXmlns ()
                {
                        XmlDocument doc = new XmlDocument ();
                        doc.LoadXml ("<iq type=\"get\" id=\"ATECLIENT_1\"><query xmlns=\"jabber:iq:auth\"><username></username></query></iq>");
-                       AssertEquals ("<iq type=\"get\" id=\"ATECLIENT_1\"><query xmlns=\"jabber:iq:auth\"><username /></query></iq>", doc.OuterXml);
+                       Assertion.AssertEquals ("<iq type=\"get\" id=\"ATECLIENT_1\"><query xmlns=\"jabber:iq:auth\"><username /></query></iq>", doc.OuterXml);
                }
 
-               public void TestPreserveWhitespace ()
+               [Test]
+               public void PreserveWhitespace ()
                {
                        string input = 
                                "<?xml version=\"1.0\" encoding=\"utf-8\" ?><!-- --> <foo/>";
@@ -869,13 +903,14 @@ namespace MonoTests.System.Xml
                        XmlTextReader reader = new XmlTextReader (new StringReader (input));
                        dom.Load (reader);
 
-                       AssertEquals (XmlNodeType.Element, dom.FirstChild.NextSibling.NextSibling.NodeType);
+                       Assertion.AssertEquals (XmlNodeType.Element, dom.FirstChild.NextSibling.NextSibling.NodeType);
                }
 
-               public void TestLoadExternalUri ()\r
-               {\r
-                       // set any URL of well-formed XML.\r
-                       document.Load ("http://www.go-mono.com/index.rss");\r
-               }\r
+               [Test]
+               public void LoadExternalUri ()
+               {
+                       // set any URL of well-formed XML.
+                       document.Load ("http://www.go-mono.com/index.rss");
+               }
        }
 }
index 857478bc51c2dd31d9c9fae628f7606b5f0a71a2..9cb3e554e932afc65799b088833e7f58f58d8dea 100755 (executable)
@@ -2,8 +2,10 @@
 // System.Xml.XmlDocumentTypeTests.cs
 //
 // Author: Duncan Mak  (duncan@ximian.com)
+// Author: Martin Willemoes Hansen (mwh@sysrq.dk)
 //
 // (C) Ximian, Inc.
+// (C) 2003 Martin Willemoes Hansen
 //
 
 using System;
@@ -13,56 +15,53 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class XmlDocumentTypeTests : TestCase
+       [TestFixture]
+       public class XmlDocumentTypeTests
        {
                XmlDocument document;
                XmlDocumentType docType;
-               public XmlDocumentTypeTests ()
-                       : base ("MonoTests.System.Xml.XmlDocumentTypeTests testsuite")
-               {
-               }
-
-               public XmlDocumentTypeTests (string name)
-                       : base (name)
-               {
-               }
 
-               protected override void SetUp ()
+               [SetUp]
+               public void GetReady ()
                {
                        document = new XmlDocument ();
                        docType = document.CreateDocumentType ("book", null, null, "<!ELEMENT book ANY>");
                        document.AppendChild (docType);
                }
 
-               internal void TestXmlNodeBaseProperties (XmlNode original, XmlNode cloned)
+               internal void XmlNodeBaseProperties (XmlNode original, XmlNode cloned)
                {
 //                     assertequals (original.nodetype + " was incorrectly cloned.",
 //                                   original.baseuri, cloned.baseuri);                        
 
-                       AssertNull (cloned.ParentNode);
-                       AssertEquals ("Value incorrectly cloned",
+                       Assertion.AssertNull (cloned.ParentNode);
+                       Assertion.AssertEquals ("Value incorrectly cloned",
                                      original.Value, cloned.Value);
 
-                        Assert ("Copies, not pointers", !Object.ReferenceEquals (original, cloned));
+                        Assertion.Assert ("Copies, not pointers", !Object.ReferenceEquals (original, cloned));
                }
 
-               public void TestName ()
+               [Test]
+               public void Name ()
                {
-                       AssertEquals ("Getting Name property", "book", docType.Name);
+                       Assertion.AssertEquals ("Getting Name property", "book", docType.Name);
                }
 
-               public void TestLocalName ()
+               [Test]
+               public void LocalName ()
                {
-                       AssertEquals ("Getting LocalName property", "book", docType.LocalName);
+                       Assertion.AssertEquals ("Getting LocalName property", "book", docType.LocalName);
                }
 
-               public void TestInternalSubset ()
+               [Test]
+               public void InternalSubset ()
                {
-                       AssertEquals ("Getting Internal Subset property",
+                       Assertion.AssertEquals ("Getting Internal Subset property",
                                      "<!ELEMENT book ANY>", docType.InternalSubset);
                }
 
-               public void TestAppendChild ()
+               [Test]
+               public void AppendChild ()
                {
                        try {
                                XmlDocumentType type1 = document.CreateDocumentType ("book", null, null, null);
@@ -72,32 +71,35 @@ namespace MonoTests.System.Xml
                                return;
 
                        } catch (Exception) {                           
-                               Fail ("Incorrect Exception thrown.");
+                               Assertion.Fail ("Incorrect Exception thrown.");
                        }
                }
 
-               public void TestNodeType ()
+               [Test]
+               public void NodeType ()
                {
-                       AssertEquals ("NodeType property broken",
+                       Assertion.AssertEquals ("NodeType property broken",
                                      docType.NodeType.ToString (), "DocumentType");
                }
                
-               public void TestIsReadOnly ()
+               [Test]
+               public void IsReadOnly ()
                {
-                       AssertEquals ("IsReadOnly property", "True", docType.IsReadOnly.ToString ());
+                       Assertion.AssertEquals ("IsReadOnly property", "True", docType.IsReadOnly.ToString ());
                }
 
-               public void TestCloneNode ()
+               [Test]
+               public void CloneNode ()
                {
                        XmlNode original = docType;
 
                        XmlNode cloned1 = docType.CloneNode (true);
-                       TestXmlNodeBaseProperties (original, cloned1);
+                       XmlNodeBaseProperties (original, cloned1);
 
                        XmlNode cloned2 = docType.CloneNode (false);
-                       TestXmlNodeBaseProperties (original, cloned2);
+                       XmlNodeBaseProperties (original, cloned2);
 
-                       AssertEquals ("Deep and shallow cloning", cloned1.Value, cloned2.Value);
+                       Assertion.AssertEquals ("Deep and shallow cloning", cloned1.Value, cloned2.Value);
                }
               
        }
index 5122a42adc8b01c190bc26f1fe4023b4b37e66bf..b00fd92b7e8ea1d433e1d1ed5141a132d7c80a07 100644 (file)
@@ -1,10 +1,12 @@
 //
 // XmlElementTests
 //
-// Author:
+// Authors:
 //   Jason Diamond (jason@injektilo.org)
+//   Martin Willemoes Hansen (mwh@sysrq.dk)
 //
 // (C) 2002 Jason Diamond  http://injektilo.org/
+// (C) 2003 Martin Willemoes Hansen 
 //
 
 using System;
@@ -16,14 +18,13 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class XmlElementTests : TestCase
+       [TestFixture]
+       public class XmlElementTests 
        {
-               public XmlElementTests () : base ("MonoTests.System.Xml.XmlElementTests testsuite") { }
-               public XmlElementTests (string name) : base (name) { }
-
                private XmlDocument document;
 
-               protected override void SetUp()
+               [SetUp]
+               public void GetReady ()
                {
                        document = new XmlDocument ();
                }
@@ -32,11 +33,11 @@ namespace MonoTests.System.Xml
                                            string localName, string namespaceURI,
                                            int attributesCount)
                {
-                       AssertEquals (prefix != String.Empty ? prefix + ":" + localName : localName, element.Name);
-                       AssertEquals (prefix, element.Prefix);
-                       AssertEquals (localName, element.LocalName);
-                       AssertEquals (namespaceURI, element.NamespaceURI);
-                       //AssertEquals (attributesCount, element.Attributes.Count);
+                       Assertion.AssertEquals (prefix != String.Empty ? prefix + ":" + localName : localName, element.Name);
+                       Assertion.AssertEquals (prefix, element.Prefix);
+                       Assertion.AssertEquals (localName, element.LocalName);
+                       Assertion.AssertEquals (namespaceURI, element.NamespaceURI);
+                       //Assertion.AssertEquals (attributesCount, element.Attributes.Count);
                }
 
                // for NodeInserted Event
@@ -60,8 +61,8 @@ namespace MonoTests.System.Xml
                        Removed = true;
                }
 
-
-               public void TestCloneNode ()
+               [Test]
+               public void CloneNode ()
                {
                        XmlElement element = document.CreateElement ("foo");
                        XmlElement child = document.CreateElement ("bar");
@@ -75,93 +76,102 @@ namespace MonoTests.System.Xml
                         
                        document.AppendChild (element);
                        XmlNode deep = element.CloneNode (true);
-                       // AssertEquals ("These should be the same", deep.OuterXml, element.OuterXml); 
-                       AssertNull ("This is not null", deep.ParentNode);
-                       Assert ("Copies, not pointers", !Object.ReferenceEquals (element,deep));
+                       // Assertion.AssertEquals ("These should be the same", deep.OuterXml, element.OuterXml); 
+                       Assertion.AssertNull ("This is not null", deep.ParentNode);
+                       Assertion.Assert ("Copies, not pointers", !Object.ReferenceEquals (element,deep));
 
                        XmlNode shallow = element.CloneNode (false);
-                       AssertNull ("This is not null", shallow.ParentNode);
-                       Assert ("Copies, not pointers", !Object.ReferenceEquals (element,shallow));
-                       AssertEquals ("Shallow clones shalt have no children!", false, shallow.HasChildNodes);
+                       Assertion.AssertNull ("This is not null", shallow.ParentNode);
+                       Assertion.Assert ("Copies, not pointers", !Object.ReferenceEquals (element,shallow));
+                       Assertion.AssertEquals ("Shallow clones shalt have no children!", false, shallow.HasChildNodes);
                }
 
-               public void TestCreateElement1 ()
+               [Test]
+               public void CreateElement1 ()
                {
                        XmlElement element = document.CreateElement ("name");
                        AssertElement (element, String.Empty, "name", String.Empty, 0);
                }
 
-               public void TestCreateElement1WithPrefix ()
+               [Test]
+               public void CreateElement1WithPrefix ()
                {
                        XmlElement element = document.CreateElement ("prefix:localName");
                        AssertElement (element, "prefix", "localName", String.Empty, 0);
                }
 
-               public void TestCreateElement2 ()
+               [Test]
+               public void CreateElement2 ()
                {
                        XmlElement element = document.CreateElement ("qualifiedName", "namespaceURI");
                        AssertElement (element, String.Empty, "qualifiedName",
                                       "namespaceURI", 0);
                }
 
-               public void TestCreateElement2WithPrefix ()
+               [Test]
+               public void CreateElement2WithPrefix ()
                {
                        XmlElement element = document.CreateElement ("prefix:localName", "namespaceURI");
                        AssertElement (element, "prefix", "localName", "namespaceURI", 0);
                }
 
-               public void TestCreateElement3 ()
+               [Test]
+               public void CreateElement3 ()
                {
                        XmlElement element = document.CreateElement ("prefix", "localName", "namespaceURI");
                        AssertElement (element, "prefix", "localName", "namespaceURI", 0);
                }
 
-               public void TestCreateElement3WithNullNamespace ()
+               [Test]
+               public void CreateElement3WithNullNamespace ()
                {
                        // bug #26855, NamespaceURI should NEVER be null.
                        XmlElement element = document.CreateElement (null, "localName", null);
                        AssertElement (element, String.Empty, "localName", String.Empty, 0);
                }
 
-               public void TestInnerAndOuterXml ()
+               [Test]
+               public void InnerAndOuterXml ()
                {
                        XmlElement element;
                        XmlText text;
                        XmlComment comment;
                        
                        element = document.CreateElement ("foo");
-                       AssertEquals (String.Empty, element.InnerXml);
-                       AssertEquals ("<foo />", element.OuterXml);
+                       Assertion.AssertEquals (String.Empty, element.InnerXml);
+                       Assertion.AssertEquals ("<foo />", element.OuterXml);
 
                        text = document.CreateTextNode ("bar");
                        element.AppendChild (text);
-                       AssertEquals ("bar", element.InnerXml);
-                       AssertEquals ("<foo>bar</foo>", element.OuterXml);
+                       Assertion.AssertEquals ("bar", element.InnerXml);
+                       Assertion.AssertEquals ("<foo>bar</foo>", element.OuterXml);
 
                        element.SetAttribute ("baz", "quux");
-                       AssertEquals ("bar", element.InnerXml);
-                       AssertEquals ("<foo baz=\"quux\">bar</foo>", element.OuterXml);
+                       Assertion.AssertEquals ("bar", element.InnerXml);
+                       Assertion.AssertEquals ("<foo baz=\"quux\">bar</foo>", element.OuterXml);
 
                        comment = document.CreateComment ("squonk");
                        element.AppendChild (comment);
-                       AssertEquals ("bar<!--squonk-->", element.InnerXml);
-                       AssertEquals ("<foo baz=\"quux\">bar<!--squonk--></foo>", element.OuterXml);
+                       Assertion.AssertEquals ("bar<!--squonk-->", element.InnerXml);
+                       Assertion.AssertEquals ("<foo baz=\"quux\">bar<!--squonk--></foo>", element.OuterXml);
 
                        element.RemoveAll();
                        element.AppendChild(document.CreateElement("hoge"));
-                       AssertEquals ("<hoge />", element.InnerXml);
+                       Assertion.AssertEquals ("<hoge />", element.InnerXml);
                }
 
-               public void TestSetGetAttribute ()
+               [Test]
+               public void SetGetAttribute ()
                {
                        XmlElement element = document.CreateElement ("foo");
                        element.SetAttribute ("attr1", "val1");
                        element.SetAttribute ("attr2", "val2");
-                       AssertEquals ("val1", element.GetAttribute ("attr1"));
-                       AssertEquals ("val2", element.GetAttribute ("attr2"));
+                       Assertion.AssertEquals ("val1", element.GetAttribute ("attr1"));
+                       Assertion.AssertEquals ("val2", element.GetAttribute ("attr2"));
                }
 
-               public void TestGetElementsByTagNameNoNameSpace ()
+               [Test]
+               public void GetElementsByTagNameNoNameSpace ()
                {
                        string xml = @"<library><book><title>XML Fun</title><author>John Doe</author>
                                <price>34.95</price></book><book><title>Bear and the Dragon</title>
@@ -178,10 +188,11 @@ namespace MonoTests.System.Xml
                        XmlNode xmlNode = libraryList.Item (0);
                        XmlElement xmlElement = xmlNode as XmlElement;
                        XmlNodeList bookList = xmlElement.GetElementsByTagName ("book");
-                       AssertEquals ("GetElementsByTagName (string) returned incorrect count.", 4, bookList.Count);
+                       Assertion.AssertEquals ("GetElementsByTagName (string) returned incorrect count.", 4, bookList.Count);
                }
 
-               public void TestGetElementsByTagNameUsingNameSpace ()
+               [Test]
+               public void GetElementsByTagNameUsingNameSpace ()
                {
                        StringBuilder xml = new StringBuilder ();
                        xml.Append ("<?xml version=\"1.0\" ?><library xmlns:North=\"http://www.foo.com\" ");
@@ -204,16 +215,18 @@ namespace MonoTests.System.Xml
                        XmlNode xmlNode = libraryList.Item (0);
                        XmlElement xmlElement = xmlNode as XmlElement;
                        XmlNodeList bookList = xmlElement.GetElementsByTagName ("book", "http://www.foo.com");
-                       AssertEquals ("GetElementsByTagName (string, uri) returned incorrect count.", 1, bookList.Count);
+                       Assertion.AssertEquals ("GetElementsByTagName (string, uri) returned incorrect count.", 1, bookList.Count);
                }
 
-               public void TestOuterXmlWithNamespace ()
+               [Test]
+               public void OuterXmlWithNamespace ()
                {
                        XmlElement element = document.CreateElement ("foo", "bar", "#foo");
-                       AssertEquals ("<foo:bar xmlns:foo=\"#foo\" />", element.OuterXml);
+                       Assertion.AssertEquals ("<foo:bar xmlns:foo=\"#foo\" />", element.OuterXml);
                }               
 
-               public void TestRemoveAllAttributes ()
+               [Test]
+               public void RemoveAllAttributes ()
                {
                        StringBuilder xml = new StringBuilder ();
                        xml.Append ("<?xml version=\"1.0\" ?><library><book type=\"non-fiction\" price=\"34.95\"> ");
@@ -227,48 +240,51 @@ namespace MonoTests.System.Xml
                        XmlNode xmlNode = bookList.Item (0);
                        XmlElement xmlElement = xmlNode as XmlElement;
                        xmlElement.RemoveAllAttributes ();
-                       AssertEquals ("attributes not properly removed.", false, xmlElement.HasAttribute ("type"));
+                       Assertion.AssertEquals ("attributes not properly removed.", false, xmlElement.HasAttribute ("type"));
                }
 
-               public void TestSetAttributeNode ()
+               [Test]
+               public void SetAttributeNode ()
                {
                        XmlDocument xmlDoc = new XmlDocument ();
                        XmlElement xmlEl = xmlDoc.CreateElement ("TestElement");
                        XmlAttribute xmlAttribute = xmlEl.SetAttributeNode ("attr1", "namespace1");
                        XmlAttribute xmlAttribute2 = xmlEl.SetAttributeNode ("attr2", "namespace2");
-                       AssertEquals ("attribute name not properly created.", true, xmlAttribute.Name.Equals ("attr1"));
-                       AssertEquals ("attribute namespace not properly created.", true, xmlAttribute.NamespaceURI.Equals ("namespace1"));
+                       Assertion.AssertEquals ("attribute name not properly created.", true, xmlAttribute.Name.Equals ("attr1"));
+                       Assertion.AssertEquals ("attribute namespace not properly created.", true, xmlAttribute.NamespaceURI.Equals ("namespace1"));
                }
 
-               public void TestInnerXmlSetter ()
+               [Test]
+               public void InnerXmlSetter ()
                {
                        XmlDocument doc = new XmlDocument ();
                        doc.LoadXml ("<root/>");
                        XmlElement el =  doc.DocumentElement;
-                       AssertNull ("#Simple", el.FirstChild);
+                       Assertion.AssertNull ("#Simple", el.FirstChild);
                        el.InnerXml = "<foo><bar att='baz'/></foo>";
                        XmlElement child = el.FirstChild as XmlElement;
-                       AssertNotNull ("#Simple.Child", child);
-                       AssertEquals ("#Simple.Child.Name", "foo", child.LocalName);
+                       Assertion.AssertNotNull ("#Simple.Child", child);
+                       Assertion.AssertEquals ("#Simple.Child.Name", "foo", child.LocalName);
 
                        XmlElement grandchild = child.FirstChild as XmlElement;
-                       AssertNotNull ("#Simple.GrandChild", grandchild);
-                       AssertEquals ("#Simple.GrandChild.Name", "bar", grandchild.LocalName);
-                       AssertEquals ("#Simple.GrandChild.Attr", "baz", grandchild.GetAttribute ("att"));
+                       Assertion.AssertNotNull ("#Simple.GrandChild", grandchild);
+                       Assertion.AssertEquals ("#Simple.GrandChild.Name", "bar", grandchild.LocalName);
+                       Assertion.AssertEquals ("#Simple.GrandChild.Attr", "baz", grandchild.GetAttribute ("att"));
 
                        doc.LoadXml ("<root xmlns='NS0' xmlns:ns1='NS1'><foo/><ns1:bar/><ns2:bar xmlns:ns2='NS2' /></root>");
                        el = doc.DocumentElement.FirstChild.NextSibling as XmlElement;  // ns1:bar
-                       AssertNull ("#Namespaced.Prepare", el.FirstChild);
+                       Assertion.AssertNull ("#Namespaced.Prepare", el.FirstChild);
                        el.InnerXml = "<ns1:baz />";
-                       AssertNotNull ("#Namespaced.Child", el.FirstChild);
-                       AssertEquals ("#Namespaced.Child.Name", "baz", el.FirstChild.LocalName);
-                       AssertEquals ("#Namespaced.Child.NSURI", "NS1", el.FirstChild.NamespaceURI);    // important!
+                       Assertion.AssertNotNull ("#Namespaced.Child", el.FirstChild);
+                       Assertion.AssertEquals ("#Namespaced.Child.Name", "baz", el.FirstChild.LocalName);
+                       Assertion.AssertEquals ("#Namespaced.Child.NSURI", "NS1", el.FirstChild.NamespaceURI);  // important!
 
                        el.InnerXml = "<hoge />";
-                       AssertEquals ("#Namespaced.VerifyPreviousCleared", "hoge", el.FirstChild.Name);
+                       Assertion.AssertEquals ("#Namespaced.VerifyPreviousCleared", "hoge", el.FirstChild.Name);
                }
 
-               public void TestRemoveAttribute ()
+               [Test]
+               public void RemoveAttribute ()
                {
                        string xlinkURI = "http://www.w3.org/1999/XLink";
                        XmlDocument doc = new XmlDocument ();
@@ -276,40 +292,44 @@ namespace MonoTests.System.Xml
 
                        XmlElement el =  doc.DocumentElement;
                        el.RemoveAttribute ("a1");
-                       AssertNull ("RemoveAttribute", el.GetAttributeNode ("a1"));
+                       Assertion.AssertNull ("RemoveAttribute", el.GetAttributeNode ("a1"));
                        el.RemoveAttribute ("xlink:href");
-                       AssertNull ("RemoveAttribute", el.GetAttributeNode ("href", xlinkURI));
+                       Assertion.AssertNull ("RemoveAttribute", el.GetAttributeNode ("href", xlinkURI));
                        el.RemoveAllAttributes ();
-                       AssertNull ("RemoveAllAttributes", el.GetAttributeNode ("a2"));
+                       Assertion.AssertNull ("RemoveAllAttributes", el.GetAttributeNode ("a2"));
                }
 
-               public void TestWriteToWithDefaultNamespace ()
+               [Test]
+               public void WriteToWithDefaultNamespace ()
                {
                        XmlDocument doc = new XmlDocument ();
                        doc.LoadXml ("<RetrievalElement URI=\"\"xmlns=\"http://www.w3.org/2000/09/xmldsig#\" />");
                        StringWriter sw = new StringWriter ();
                        XmlTextWriter xtw = new XmlTextWriter (sw);
                        doc.DocumentElement.WriteTo (xtw);
-                       AssertEquals ("<RetrievalElement URI=\"\" xmlns=\"http://www.w3.org/2000/09/xmldsig#\" />", sw.ToString());
+                       Assertion.AssertEquals ("<RetrievalElement URI=\"\" xmlns=\"http://www.w3.org/2000/09/xmldsig#\" />", sw.ToString());
                }
 
-               public void TestWriteToWithDeletedNamespacePrefix ()
+               [Test]
+               public void WriteToWithDeletedNamespacePrefix ()
                {
                        XmlDocument doc = new XmlDocument ();
                        doc.LoadXml ("<root xmlns:foo='urn:dummy'><foo foo:bar='baz' /></root>");
                        doc.DocumentElement.RemoveAllAttributes ();
 
-                       Assert (doc.DocumentElement.FirstChild.OuterXml.IndexOf("xmlns:foo") > 0);
+                       Assertion.Assert (doc.DocumentElement.FirstChild.OuterXml.IndexOf("xmlns:foo") > 0);
                }
 
-               public void TestWriteToWithDifferentNamespaceAttributes ()
+               [Test]
+               public void WriteToWithDifferentNamespaceAttributes ()
                {
                        XmlDocument doc = new XmlDocument ();
                        doc.LoadXml ("<root xmlns:foo='urn:dummy' xmlns:html='http://www.w3.org/1999/xhtml' html:style='font-size: 1em'></root>");
-                       Assert (doc.OuterXml.IndexOf ("xmlns:html=\"http://www.w3.org/1999/xhtml\"") > 0);
+                       Assertion.Assert (doc.OuterXml.IndexOf ("xmlns:html=\"http://www.w3.org/1999/xhtml\"") > 0);
                }
 
-               public void TestInnerTextAndEvent ()
+               [Test]
+               public void InnerTextAndEvent ()
                {
                        XmlDocument doc = new XmlDocument ();
                        doc.LoadXml ("<root><child>text</child><child2><![CDATA[cdata]]></child2></root>");
@@ -320,18 +340,18 @@ namespace MonoTests.System.Xml
                        // If only one child of the element is Text node,
                        // then no events are fired.
                        doc.DocumentElement.FirstChild.InnerText = "no events fired.";
-                       AssertEquals ("NoInsertEventFired", false, Inserted);
-                       AssertEquals ("NoRemoveEventFired", false, Removed);
-                       AssertEquals ("SetInnerTextToSingleText", "no events fired.", doc.DocumentElement.FirstChild.InnerText);
+                       Assertion.AssertEquals ("NoInsertEventFired", false, Inserted);
+                       Assertion.AssertEquals ("NoRemoveEventFired", false, Removed);
+                       Assertion.AssertEquals ("SetInnerTextToSingleText", "no events fired.", doc.DocumentElement.FirstChild.InnerText);
                        Inserted = false;
                        Removed = false;
 
                        // if only one child of the element is CDataSection,
                        // then events are fired.
                        doc.DocumentElement.LastChild.InnerText = "events are fired.";
-                       AssertEquals ("InsertedEventFired", true, Inserted);
-                       AssertEquals ("RemovedEventFired", true, Removed);
-                       AssertEquals ("SetInnerTextToCDataSection", "events are fired.", doc.DocumentElement.LastChild.InnerText);
+                       Assertion.AssertEquals ("InsertedEventFired", true, Inserted);
+                       Assertion.AssertEquals ("RemovedEventFired", true, Removed);
+                       Assertion.AssertEquals ("SetInnerTextToCDataSection", "events are fired.", doc.DocumentElement.LastChild.InnerText);
                }
        }
 }
index 8cb9c64706947ab6709a731bbb3d227d7e0f989f..343677838a657914ae64e7a734a2ad6068b6ea30 100755 (executable)
@@ -1,10 +1,12 @@
 //
 // System.Xml.XmlEntityReference.cs
 //
-// Author:
+// Authors:
 //   Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+//   Martin Willemoes Hansen <mwh@sysrq.dk>
 //
 // (C) 2002 Atsushi Enomoto
+// (C) 2003 Martin Willemoes Hansen
 //
 
 using System;
@@ -13,23 +15,18 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class XmlEntityReferenceTests : TestCase
+       [TestFixture]
+       public class XmlEntityReferenceTests
        {
-               public XmlEntityReferenceTests () : base ("MonoTests.System.Xml.XmlEntityReferenceTests testsuite") {}
-               public XmlEntityReferenceTests (string name) : base (name) {}
-
-               protected override void SetUp ()
-               {
-               }
-
-               public void TestWriteTo ()
+               [Test]
+               public void WriteTo ()
                {
                        XmlDocument doc = new XmlDocument();
                        doc.LoadXml("<root/>");
                        XmlEntityReference er = doc.CreateEntityReference("foo");
                        doc.DocumentElement.AppendChild(er);
-                       AssertEquals ("Name", "foo", er.Name);
-                       AssertEquals ("WriteTo", "<root>&foo;</root>", doc.DocumentElement.OuterXml);
+                       Assertion.AssertEquals ("Name", "foo", er.Name);
+                       Assertion.AssertEquals ("WriteTo", "<root>&foo;</root>", doc.DocumentElement.OuterXml);
                }
        }
 }
index 06d6500aa70fc3531ef83fd24293039055a5ba06..28dc8a2215ac01b75b20e439750aa02127a475ed 100644 (file)
@@ -1,10 +1,12 @@
 //
 // XmlNamespaceManagerTests.cs
 //
-// Author:
+// Authors:
 //   Jason Diamond (jason@injektilo.org)
+//   Martin Willemoes Hansen (mwh@sysrq.dk)
 //
 // (C) 2002 Jason Diamond  http://injektilo.org/
+// (C) 2003 Martin Willemoes Hansen
 //
 
 using System;
@@ -14,24 +16,24 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class XmlNamespaceManagerTests : TestCase
+       [TestFixture]
+       public class XmlNamespaceManagerTests
        {
-               public XmlNamespaceManagerTests () : base ("MonoTests.System.Xml.XmlNameSpaceManagerTests testsuite") { }
-               public XmlNamespaceManagerTests (string name) : base (name) { }
-
                private XmlNameTable nameTable;
                private XmlNamespaceManager namespaceManager;
 
-               protected override void SetUp ()
+               [SetUp]
+               public void GetReady ()
                {
                        nameTable = new NameTable ();
                        namespaceManager = new XmlNamespaceManager (nameTable);
                }
 
-               public void TestNewNamespaceManager ()
+               [Test]
+               public void NewNamespaceManager ()
                {
                        // make sure that you can call PopScope when there aren't any to pop.
-                       Assert (!namespaceManager.PopScope ());
+                       Assertion.Assert (!namespaceManager.PopScope ());
 
                        // the following strings should have been added to the name table by the
                        // namespace manager.
@@ -42,42 +44,44 @@ namespace MonoTests.System.Xml
                        string xmlNamespace = "http://www.w3.org/XML/1998/namespace";
 
                        // none of them should be null.
-                       AssertNotNull (xmlnsPrefix);
-                       AssertNotNull (xmlPrefix);
-                       AssertNotNull (stringEmpty);
-                       AssertNotNull (xmlnsNamespace);
-                       AssertNotNull (xmlNamespace);
+                       Assertion.AssertNotNull (xmlnsPrefix);
+                       Assertion.AssertNotNull (xmlPrefix);
+                       Assertion.AssertNotNull (stringEmpty);
+                       Assertion.AssertNotNull (xmlnsNamespace);
+                       Assertion.AssertNotNull (xmlNamespace);
 
                        // Microsoft's XmlNamespaceManager reports that these three
                        // namespaces aren't declared for some reason.
-                       Assert (!namespaceManager.HasNamespace ("xmlns"));
-                       Assert (!namespaceManager.HasNamespace ("xml"));
-                       Assert (!namespaceManager.HasNamespace (String.Empty));
+                       Assertion.Assert (!namespaceManager.HasNamespace ("xmlns"));
+                       Assertion.Assert (!namespaceManager.HasNamespace ("xml"));
+                       Assertion.Assert (!namespaceManager.HasNamespace (String.Empty));
 
                        // these three namespaces are declared by default.
-                       AssertEquals ("http://www.w3.org/2000/xmlns/", namespaceManager.LookupNamespace ("xmlns"));
-                       AssertEquals ("http://www.w3.org/XML/1998/namespace", namespaceManager.LookupNamespace ("xml"));
-                       AssertEquals (String.Empty, namespaceManager.LookupNamespace (String.Empty));
+                       Assertion.AssertEquals ("http://www.w3.org/2000/xmlns/", namespaceManager.LookupNamespace ("xmlns"));
+                       Assertion.AssertEquals ("http://www.w3.org/XML/1998/namespace", namespaceManager.LookupNamespace ("xml"));
+                       Assertion.AssertEquals (String.Empty, namespaceManager.LookupNamespace (String.Empty));
 
                        // the namespaces should be the same references found in the name table.
-                       AssertSame (xmlnsNamespace, namespaceManager.LookupNamespace ("xmlns"));
-                       AssertSame (xmlNamespace, namespaceManager.LookupNamespace ("xml"));
-                       AssertSame (stringEmpty, namespaceManager.LookupNamespace (String.Empty));
+                       Assertion.AssertSame (xmlnsNamespace, namespaceManager.LookupNamespace ("xmlns"));
+                       Assertion.AssertSame (xmlNamespace, namespaceManager.LookupNamespace ("xml"));
+                       Assertion.AssertSame (stringEmpty, namespaceManager.LookupNamespace (String.Empty));
 
                        // looking up undeclared namespaces should return null.
-                       AssertNull (namespaceManager.LookupNamespace ("foo"));
+                       Assertion.AssertNull (namespaceManager.LookupNamespace ("foo"));
                }
 
-               public void TestAddNamespace ()
+               [Test]
+               public void AddNamespace ()
                {
                        // add a new namespace.
                        namespaceManager.AddNamespace ("foo", "http://foo/");
                        // make sure the new namespace is there.
-                       Assert (namespaceManager.HasNamespace ("foo"));
-                       AssertEquals ("http://foo/", namespaceManager.LookupNamespace ("foo"));
+                       Assertion.Assert (namespaceManager.HasNamespace ("foo"));
+                       Assertion.AssertEquals ("http://foo/", namespaceManager.LookupNamespace ("foo"));
                }
 
-               public void TestAddNamespaceWithNameTable ()
+               [Test]
+               public void AddNamespaceWithNameTable ()
                {
                        // add a known reference to the name table.
                        string fooNamespace = "http://foo/";
@@ -88,54 +92,57 @@ namespace MonoTests.System.Xml
                        fooNamespace2 += "foo/";
 
                        // the references must be different in order for this test to prove anything.
-                       Assert (!Object.ReferenceEquals (fooNamespace, fooNamespace2));
+                       Assertion.Assert (!Object.ReferenceEquals (fooNamespace, fooNamespace2));
 
                        // add the namespace with the reference that's not in the name table.
                        namespaceManager.AddNamespace ("foo", fooNamespace2);
 
                        // the returned reference should be the same one that's in the name table.
-                       AssertSame (fooNamespace, namespaceManager.LookupNamespace ("foo"));
+                       Assertion.AssertSame (fooNamespace, namespaceManager.LookupNamespace ("foo"));
                }
 
-               public void TestPushScope ()
+               [Test]
+               public void PushScope ()
                {
                        // add a new namespace.
                        namespaceManager.AddNamespace ("foo", "http://foo/");
                        // make sure the new namespace is there.
-                       Assert (namespaceManager.HasNamespace ("foo"));
-                       AssertEquals ("http://foo/", namespaceManager.LookupNamespace ("foo"));
+                       Assertion.Assert (namespaceManager.HasNamespace ("foo"));
+                       Assertion.AssertEquals ("http://foo/", namespaceManager.LookupNamespace ("foo"));
                        // push a new scope.
                        namespaceManager.PushScope ();
                        // add a new namespace.
                        namespaceManager.AddNamespace ("bar", "http://bar/");
                        // make sure the old namespace is not in this new scope.
-                       Assert (!namespaceManager.HasNamespace ("foo"));
+                       Assertion.Assert (!namespaceManager.HasNamespace ("foo"));
                        // but we're still supposed to be able to lookup the old namespace.
-                       AssertEquals ("http://foo/", namespaceManager.LookupNamespace ("foo"));
+                       Assertion.AssertEquals ("http://foo/", namespaceManager.LookupNamespace ("foo"));
                        // make sure the new namespace is there.
-                       Assert (namespaceManager.HasNamespace ("bar"));
-                       AssertEquals ("http://bar/", namespaceManager.LookupNamespace ("bar"));
+                       Assertion.Assert (namespaceManager.HasNamespace ("bar"));
+                       Assertion.AssertEquals ("http://bar/", namespaceManager.LookupNamespace ("bar"));
                }
 
-               public void TestPopScope ()
+               [Test]
+               public void PopScope ()
                {
                        // add some namespaces and a scope.
-                       TestPushScope ();
+                       PushScope ();
                        // pop the scope.
-                       Assert (namespaceManager.PopScope ());
+                       Assertion.Assert (namespaceManager.PopScope ());
                        // make sure the first namespace is still there.
-                       Assert (namespaceManager.HasNamespace ("foo"));
-                       AssertEquals ("http://foo/", namespaceManager.LookupNamespace ("foo"));
+                       Assertion.Assert (namespaceManager.HasNamespace ("foo"));
+                       Assertion.AssertEquals ("http://foo/", namespaceManager.LookupNamespace ("foo"));
                        // make sure the second namespace is no longer there.
-                       Assert (!namespaceManager.HasNamespace ("bar"));
-                       AssertNull (namespaceManager.LookupNamespace ("bar"));
+                       Assertion.Assert (!namespaceManager.HasNamespace ("bar"));
+                       Assertion.AssertNull (namespaceManager.LookupNamespace ("bar"));
                        // make sure there are no more scopes to pop.
-                       Assert (!namespaceManager.PopScope ());
+                       Assertion.Assert (!namespaceManager.PopScope ());
                        // make sure that popping again doesn't cause an exception.
-                       Assert (!namespaceManager.PopScope ());
+                       Assertion.Assert (!namespaceManager.PopScope ());
                }
 
-               public void TestLookupPrefix ()
+               [Test]
+               public void LookupPrefix ()
                {
                        // This test should use an empty nametable.
                        XmlNamespaceManager nsmgr =
@@ -143,8 +150,8 @@ namespace MonoTests.System.Xml
                        nsmgr.NameTable.Add ("urn:hoge");
                        nsmgr.NameTable.Add ("urn:fuga");
                        nsmgr.AddNamespace (string.Empty, "urn:hoge");
-                       AssertNull (nsmgr.LookupPrefix ("urn:fuga"));
-                       AssertEquals (String.Empty, nsmgr.LookupPrefix ("urn:hoge"));
+                       Assertion.AssertNull (nsmgr.LookupPrefix ("urn:fuga"));
+                       Assertion.AssertEquals (String.Empty, nsmgr.LookupPrefix ("urn:hoge"));
                }
        }
 }
index 66279bb76642fb40a1ba95033a42808b56da9cdc..4f754ac5ba14e0017a8d219433508f1a831ded18 100644 (file)
@@ -1,10 +1,12 @@
 //
 // System.Xml.XmlTextWriterTests
 //
-// Author:
+// Authors:
 //   Kral Ferch <kral_ferch@hotmail.com>
+//   Martin Willemoes Hansen <mwh@sysrq.dk>
 //
 // (C) 2002 Kral Ferch
+// (C) 2003 Martin Willemoes Hansen
 //
 
 using System;
@@ -15,11 +17,9 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class XmlNodeListTests : TestCase
+       [TestFixture]
+       public class XmlNodeListTests
        {
-               public XmlNodeListTests () : base ("MonoTests.System.Xml.XmlNodeListTests testsuite") {}
-               public XmlNodeListTests (string name) : base (name) {}
-               
                XmlDocument document;
                XmlElement documentElement;
                XmlElement element;
@@ -27,143 +27,155 @@ namespace MonoTests.System.Xml
                Object obj;
                IEnumerator enumerator;
                int index;
-               
-               protected override void SetUp ()
+
+               [SetUp]
+               public void GetReady ()
                {
                        document = new XmlDocument ();
                }
 
-               public void TestNodeTypesThatCantHaveChildren ()
+               [Test]
+               public void NodeTypesThatCantHaveChildren ()
                {
                        document.LoadXml ("<foo>bar</foo>");
                        documentElement = document.DocumentElement;
                        node = documentElement.FirstChild;
-                       AssertEquals ("Expected a text node.", node.NodeType, XmlNodeType.Text);
-                       AssertEquals ("Shouldn't have children.", node.HasChildNodes, false);
-                       AssertEquals ("Should be empty node list.", node.ChildNodes.Count, 0);
-                       AssertEquals ("Should be empty node list.", node.GetEnumerator().MoveNext(), false);
+                       Assertion.AssertEquals ("Expected a text node.", node.NodeType, XmlNodeType.Text);
+                       Assertion.AssertEquals ("Shouldn't have children.", node.HasChildNodes, false);
+                       Assertion.AssertEquals ("Should be empty node list.", node.ChildNodes.Count, 0);
+                       Assertion.AssertEquals ("Should be empty node list.", node.GetEnumerator().MoveNext(), false);
                }
 
-               public void TestZeroChildren ()
+               [Test]
+               public void ZeroChildren ()
                {
                        document.LoadXml ("<foo/>");
                        documentElement = document.DocumentElement;
-                       AssertEquals ("Should be empty node list.", documentElement.GetEnumerator().MoveNext(), false);
+                       Assertion.AssertEquals ("Should be empty node list.", documentElement.GetEnumerator().MoveNext(), false);
                }
 
-               public void TestOneChild ()
+               [Test]
+               public void OneChild ()
                {
                        document.LoadXml ("<foo><child1/></foo>");
                        documentElement = document.DocumentElement;
-                       AssertEquals ("Incorrect number of children returned from Count property.", documentElement.ChildNodes.Count, 1);
+                       Assertion.AssertEquals ("Incorrect number of children returned from Count property.", documentElement.ChildNodes.Count, 1);
                        index = 1;
                        foreach (XmlNode childNode in documentElement.ChildNodes) 
                        {
-                               AssertEquals ("Enumerator didn't return correct node.", "child" + index.ToString(), childNode.LocalName);
+                               Assertion.AssertEquals ("Enumerator didn't return correct node.", "child" + index.ToString(), childNode.LocalName);
                                index++;
                        }
-                       AssertEquals ("foreach didn't loop over all children correctly.", index, 2);
+                       Assertion.AssertEquals ("foreach didn't loop over all children correctly.", index, 2);
                }
 
-               public void TestMultipleChildren ()
+               [Test]
+               public void MultipleChildren ()
                {
                        document.LoadXml ("<foo><child1/><child2/><child3/></foo>");
                        element = document.DocumentElement;
-                       AssertEquals ("Incorrect number of children returned from Count property.", element.ChildNodes.Count, 3);
-                       AssertNull ("Index less than zero should have returned null.", element.ChildNodes [-1]);
-                       AssertNull ("Index greater than or equal to Count should have returned null.", element.ChildNodes [3]);
-                       AssertEquals ("Didn't return the correct child.", element.FirstChild, element.ChildNodes[0]);
-                       AssertEquals ("Didn't return the correct child.", "child1", element.ChildNodes[0].LocalName);
-                       AssertEquals ("Didn't return the correct child.", "child2", element.ChildNodes[1].LocalName);
-                       AssertEquals ("Didn't return the correct child.", "child3", element.ChildNodes[2].LocalName);
+                       Assertion.AssertEquals ("Incorrect number of children returned from Count property.", element.ChildNodes.Count, 3);
+                       Assertion.AssertNull ("Index less than zero should have returned null.", element.ChildNodes [-1]);
+                       Assertion.AssertNull ("Index greater than or equal to Count should have returned null.", element.ChildNodes [3]);
+                       Assertion.AssertEquals ("Didn't return the correct child.", element.FirstChild, element.ChildNodes[0]);
+                       Assertion.AssertEquals ("Didn't return the correct child.", "child1", element.ChildNodes[0].LocalName);
+                       Assertion.AssertEquals ("Didn't return the correct child.", "child2", element.ChildNodes[1].LocalName);
+                       Assertion.AssertEquals ("Didn't return the correct child.", "child3", element.ChildNodes[2].LocalName);
 
                        index = 1;
                        foreach (XmlNode childNode in element.ChildNodes) 
                        {
-                               AssertEquals ("Enumerator didn't return correct node.", "child" + index.ToString(), childNode.LocalName);
+                               Assertion.AssertEquals ("Enumerator didn't return correct node.", "child" + index.ToString(), childNode.LocalName);
                                index++;
                        }
-                       AssertEquals ("foreach didn't loop over all children correctly.", index, 4);
+                       Assertion.AssertEquals ("foreach didn't loop over all children correctly.", index, 4);
                }
 
-               public void TestAppendChildAffectOnEnumeration ()
+               [Test]
+               public void AppendChildAffectOnEnumeration ()
                {
                        document.LoadXml ("<foo><child1/></foo>");
                        element = document.DocumentElement;
                        enumerator = element.GetEnumerator();
-                       AssertEquals ("MoveNext should have succeeded.", enumerator.MoveNext(), true);
-                       AssertEquals ("MoveNext should have failed.", enumerator.MoveNext(), false);
+                       Assertion.AssertEquals ("MoveNext should have succeeded.", enumerator.MoveNext(), true);
+                       Assertion.AssertEquals ("MoveNext should have failed.", enumerator.MoveNext(), false);
                        enumerator.Reset();
-                       AssertEquals ("MoveNext should have succeeded.", enumerator.MoveNext(), true);
+                       Assertion.AssertEquals ("MoveNext should have succeeded.", enumerator.MoveNext(), true);
                        element.AppendChild(document.CreateElement("child2"));
-                       AssertEquals ("MoveNext should have succeeded.", enumerator.MoveNext(), true);
-                       AssertEquals ("MoveNext should have failed.", enumerator.MoveNext(), false);
+                       Assertion.AssertEquals ("MoveNext should have succeeded.", enumerator.MoveNext(), true);
+                       Assertion.AssertEquals ("MoveNext should have failed.", enumerator.MoveNext(), false);
                }
 
-               public void TestRemoveChildAffectOnEnumeration ()
+               [Test]
+               public void RemoveChildAffectOnEnumeration ()
                {
                        document.LoadXml ("<foo><child1/><child2/></foo>");
                        element = document.DocumentElement;
                        enumerator = element.GetEnumerator();
                        element.RemoveChild(element.FirstChild);
                        enumerator.MoveNext();
-                       AssertEquals ("Expected child2 element.", ((XmlElement)enumerator.Current).LocalName, "child2");
+                       Assertion.AssertEquals ("Expected child2 element.", ((XmlElement)enumerator.Current).LocalName, "child2");
                }
 
-               public void TestRemoveChildAffectOnEnumerationWhenEnumeratorIsOnRemovedChild ()
+               [Test]
+               public void RemoveChildAffectOnEnumerationWhenEnumeratorIsOnRemovedChild ()
                {
                        document.LoadXml ("<foo><child1/><child2/><child3/></foo>");
                        element = document.DocumentElement;
                        enumerator = element.GetEnumerator ();
                        enumerator.MoveNext ();
                        enumerator.MoveNext ();
-                       AssertEquals ("Expected child2 element.", "child2", ((XmlElement)enumerator.Current).LocalName);
-                       AssertEquals ("Expected child2 element.", "child2", element.FirstChild.NextSibling.LocalName);
+                       Assertion.AssertEquals ("Expected child2 element.", "child2", ((XmlElement)enumerator.Current).LocalName);
+                       Assertion.AssertEquals ("Expected child2 element.", "child2", element.FirstChild.NextSibling.LocalName);
                        element.RemoveChild (element.FirstChild.NextSibling);
                        enumerator.MoveNext ();
                        
                        try {
                                element = (XmlElement) enumerator.Current;
-                               Fail ("Expected an InvalidOperationException.");
+                               Assertion.Fail ("Expected an InvalidOperationException.");
                        } catch (InvalidOperationException) { }
                }
 
                // TODO:  Take the word save off front of this method when XmlNode.ReplaceChild() is implemented.
+
                public void saveTestReplaceChildAffectOnEnumeration ()
                {
                        document.LoadXml ("<foo><child1/><child2/></foo>");
                        element = document.DocumentElement;
                        node = document.CreateElement("child3");
                        enumerator = element.GetEnumerator();
-                       AssertEquals ("MoveNext should have succeeded.", enumerator.MoveNext(), true);
+                       Assertion.AssertEquals ("MoveNext should have succeeded.", enumerator.MoveNext(), true);
                        element.ReplaceChild(node, element.LastChild);
                        enumerator.MoveNext();
-                       AssertEquals ("Expected child3 element.", ((XmlElement)enumerator.Current).LocalName, "child3");
-                       AssertEquals ("MoveNext should have failed.", enumerator.MoveNext(), false);
+                       Assertion.AssertEquals ("Expected child3 element.", ((XmlElement)enumerator.Current).LocalName, "child3");
+                       Assertion.AssertEquals ("MoveNext should have failed.", enumerator.MoveNext(), false);
                }
 
-               public void TestRemoveOnlyChildAffectOnEnumeration ()
+               [Test]
+               public void RemoveOnlyChildAffectOnEnumeration ()
                {
                        document.LoadXml ("<foo><child1/></foo>");
                        element = document.DocumentElement;
                        enumerator = element.GetEnumerator();
                        element.RemoveChild(element.FirstChild);
-                       AssertEquals ("MoveNext should have failed.", enumerator.MoveNext(), false);
+                       Assertion.AssertEquals ("MoveNext should have failed.", enumerator.MoveNext(), false);
                }
 
                // TODO:  Take the word save off front of this method when XmlNode.RemoveAll() is fully implemented.
+
                public void saveTestRemoveAllAffectOnEnumeration ()
                {
                        document.LoadXml ("<foo><child1/><child2/><child3/></foo>");
                        element = document.DocumentElement;
                        enumerator = element.GetEnumerator();
-                       AssertEquals ("Expected 3 children.", element.ChildNodes.Count, 3);
-                       AssertEquals ("MoveNext should have succeeded.", enumerator.MoveNext(), true);
+                       Assertion.AssertEquals ("Expected 3 children.", element.ChildNodes.Count, 3);
+                       Assertion.AssertEquals ("MoveNext should have succeeded.", enumerator.MoveNext(), true);
                        element.RemoveAll();
-                       AssertEquals ("MoveNext should have failed.", enumerator.MoveNext(), false);
+                       Assertion.AssertEquals ("MoveNext should have failed.", enumerator.MoveNext(), false);
                }
 
-               public void TestCurrentBeforeFirstNode ()
+               [Test]
+               public void CurrentBeforeFirstNode ()
                {
                        document.LoadXml ("<foo><child1/></foo>");
                        element = document.DocumentElement;
@@ -171,11 +183,12 @@ namespace MonoTests.System.Xml
                        try 
                        {
                                obj = enumerator.Current;
-                               Fail ("Calling Current property before first node in list should have thrown InvalidOperationException.");
+                               Assertion.Fail ("Calling Current property before first node in list should have thrown InvalidOperationException.");
                        } catch (InvalidOperationException) { }
                }
 
-               public void TestCurrentAfterLastNode ()
+               [Test]
+               public void CurrentAfterLastNode ()
                {
                        document.LoadXml ("<foo><child1/></foo>");
                        element = document.DocumentElement;
@@ -185,31 +198,33 @@ namespace MonoTests.System.Xml
                        try 
                        {
                                obj = enumerator.Current;
-                               Fail ("Calling Current property after last node in list should have thrown InvalidOperationException.");
+                               Assertion.Fail ("Calling Current property after last node in list should have thrown InvalidOperationException.");
                        } 
                        catch (InvalidOperationException) { }
                }
 
-               public void TestCurrentDoesntMove ()
+               [Test]
+               public void CurrentDoesntMove ()
                {
                        document.LoadXml ("<foo><child1/></foo>");
                        element = document.DocumentElement;
                        enumerator = element.GetEnumerator();
                        enumerator.MoveNext();
-                       AssertEquals("Consecutive calls to Current property should yield same reference.", Object.ReferenceEquals(enumerator.Current, enumerator.Current), true);
+                       Assertion.AssertEquals("Consecutive calls to Current property should yield same reference.", Object.ReferenceEquals(enumerator.Current, enumerator.Current), true);
                }
 
-               public void TestReset ()
+               [Test]
+               public void Reset ()
                {
                        document.LoadXml ("<foo><child1/><child2/></foo>");
                        element = document.DocumentElement;
                        enumerator = element.GetEnumerator();
                        enumerator.MoveNext();
                        enumerator.MoveNext();
-                       AssertEquals("Expected child2.", ((XmlElement)enumerator.Current).LocalName, "child2");
+                       Assertion.AssertEquals("Expected child2.", ((XmlElement)enumerator.Current).LocalName, "child2");
                        enumerator.Reset();
                        enumerator.MoveNext();
-                       AssertEquals("Expected child1.", ((XmlElement)enumerator.Current).LocalName, "child1");
+                       Assertion.AssertEquals("Expected child1.", ((XmlElement)enumerator.Current).LocalName, "child1");
                }
        }
 }
index 34462aa5361dfedcc99b8b73e8a01bc92e74be4e..cf74b888a1afb0840148dd3159b701e01f508b26 100644 (file)
@@ -1,15 +1,15 @@
 //\r
 // System.Xml.XmlNodeReaderTests\r
 //\r
-// Author:\r
+// Authors:\r
 //   Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>\r
+//   Martin Willemoes Hansen <mwh@sysrq.dk>\r
 //\r
 // (C) 2003 Atsushi Enomoto\r
+// (C) 2003 Martin Willemoes Hansen\r
 //\r
 //\r
 \r
-\r
-\r
 using System;\r
 using System.IO;\r
 using System.Text;\r
@@ -19,12 +19,11 @@ using NUnit.Framework;
 \r
 namespace MonoTests.System.Xml\r
 {\r
-       public class XmlNodeReaderTests : TestCase\r
+       [TestFixture]\r
+       public class XmlNodeReaderTests\r
        {\r
-               public XmlNodeReaderTests () : base ("MonoTests.System.Xml.NodeReaderTests testsuite") {}\r
-               public XmlNodeReaderTests (string name) : base (name) {}\r
-\r
-               protected override void SetUp ()\r
+               [SetUp]\r
+               public void GetReady ()\r
                {\r
                        document.LoadXml ("<root attr1='value1'><child /></root>");\r
                }\r
@@ -34,105 +33,111 @@ namespace MonoTests.System.Xml
                // MS.NET's not-overriden XmlNodeReader.WriteStartElement(name)\r
                // invokes WriteStartElement(null, name, null). \r
                // WriteStartElement(name, ns) invokes (null, name, ns), too.\r
-               public void TestInitialState ()\r
+               [Test]\r
+               public void InitialState ()\r
                {\r
                        XmlNodeReader nrdr = new XmlNodeReader (document);\r
-                       AssertEquals ("Depth", 0, nrdr.Depth);\r
-                       AssertEquals ("EOF", false, nrdr.EOF);\r
-                       AssertEquals ("HasValue", false, nrdr.HasValue);\r
-                       AssertEquals ("IsEmptyElement", false, nrdr.IsEmptyElement);\r
-                       AssertEquals ("LocalName", String.Empty, nrdr.LocalName);\r
-                       AssertEquals ("NodeType", XmlNodeType.None, nrdr.NodeType);\r
-                       AssertEquals ("ReadState", ReadState.Initial, nrdr.ReadState);\r
+                       Assertion.AssertEquals ("Depth", 0, nrdr.Depth);\r
+                       Assertion.AssertEquals ("EOF", false, nrdr.EOF);\r
+                       Assertion.AssertEquals ("HasValue", false, nrdr.HasValue);\r
+                       Assertion.AssertEquals ("IsEmptyElement", false, nrdr.IsEmptyElement);\r
+                       Assertion.AssertEquals ("LocalName", String.Empty, nrdr.LocalName);\r
+                       Assertion.AssertEquals ("NodeType", XmlNodeType.None, nrdr.NodeType);\r
+                       Assertion.AssertEquals ("ReadState", ReadState.Initial, nrdr.ReadState);\r
                }\r
 \r
-               public void TestInvalidConstruction ()\r
+               [Test]\r
+               public void InvalidConstruction ()\r
                {\r
                        XmlNodeReader nrdr;\r
                        try {\r
                                nrdr = new XmlNodeReader (null);\r
-                               Fail ("null reference exception is preferable.");\r
+                               Assertion.Fail ("null reference exception is preferable.");\r
                        } catch (NullReferenceException ex) {\r
                        }\r
                        nrdr = new XmlNodeReader (new XmlDocument ());\r
                        nrdr.Read ();\r
-                       AssertEquals ("newDoc.ReadState", ReadState.Error, nrdr.ReadState);\r
-                       AssertEquals ("newDoc.EOF", true, nrdr.EOF);\r
-                       AssertEquals ("newDoc.NodeType", XmlNodeType.None, nrdr.NodeType);\r
+                       Assertion.AssertEquals ("newDoc.ReadState", ReadState.Error, nrdr.ReadState);\r
+                       Assertion.AssertEquals ("newDoc.EOF", true, nrdr.EOF);\r
+                       Assertion.AssertEquals ("newDoc.NodeType", XmlNodeType.None, nrdr.NodeType);\r
                        nrdr = new XmlNodeReader (document.CreateDocumentFragment ());\r
                        nrdr.Read ();\r
-                       AssertEquals ("Fragment.ReadState", ReadState.Error, nrdr.ReadState);\r
-                       AssertEquals ("Fragment.EOF", true, nrdr.EOF);\r
-                       AssertEquals ("Fragment.NodeType", XmlNodeType.None, nrdr.NodeType);\r
+                       Assertion.AssertEquals ("Fragment.ReadState", ReadState.Error, nrdr.ReadState);\r
+                       Assertion.AssertEquals ("Fragment.EOF", true, nrdr.EOF);\r
+                       Assertion.AssertEquals ("Fragment.NodeType", XmlNodeType.None, nrdr.NodeType);\r
                }\r
 \r
-               public void TestRead ()\r
+               [Test]\r
+               public void Read ()\r
                {\r
                        XmlNodeReader nrdr = new XmlNodeReader (document);\r
                        nrdr.Read ();\r
-                       AssertEquals ("<root>.NodeType", XmlNodeType.Element, nrdr.NodeType);\r
-                       AssertEquals ("<root>.Name", "root", nrdr.Name);\r
-                       AssertEquals ("<root>.ReadState", ReadState.Interactive, nrdr.ReadState);\r
-                       AssertEquals ("<root>.Depth", 0, nrdr.Depth);\r
+                       Assertion.AssertEquals ("<root>.NodeType", XmlNodeType.Element, nrdr.NodeType);\r
+                       Assertion.AssertEquals ("<root>.Name", "root", nrdr.Name);\r
+                       Assertion.AssertEquals ("<root>.ReadState", ReadState.Interactive, nrdr.ReadState);\r
+                       Assertion.AssertEquals ("<root>.Depth", 0, nrdr.Depth);\r
 \r
                        // move to 'child'\r
                        nrdr.Read ();\r
-                       AssertEquals ("<child/>.Depth", 1, nrdr.Depth);\r
-                       AssertEquals ("<child/>.NodeType", XmlNodeType.Element, nrdr.NodeType);\r
-                       AssertEquals ("<child/>.Name", "child", nrdr.Name);\r
+                       Assertion.AssertEquals ("<child/>.Depth", 1, nrdr.Depth);\r
+                       Assertion.AssertEquals ("<child/>.NodeType", XmlNodeType.Element, nrdr.NodeType);\r
+                       Assertion.AssertEquals ("<child/>.Name", "child", nrdr.Name);\r
 \r
                        nrdr.Read ();\r
-                       AssertEquals ("</root>.Depth", 0, nrdr.Depth);\r
-                       AssertEquals ("</root>.NodeType", XmlNodeType.EndElement, nrdr.NodeType);\r
-                       AssertEquals ("</root>.Name", "root", nrdr.Name);\r
+                       Assertion.AssertEquals ("</root>.Depth", 0, nrdr.Depth);\r
+                       Assertion.AssertEquals ("</root>.NodeType", XmlNodeType.EndElement, nrdr.NodeType);\r
+                       Assertion.AssertEquals ("</root>.Name", "root", nrdr.Name);\r
 \r
                        nrdr.Read ();\r
-                       AssertEquals ("end.EOF", true, nrdr.EOF);\r
-                       AssertEquals ("end.NodeType", XmlNodeType.None, nrdr.NodeType);\r
+                       Assertion.AssertEquals ("end.EOF", true, nrdr.EOF);\r
+                       Assertion.AssertEquals ("end.NodeType", XmlNodeType.None, nrdr.NodeType);\r
                }\r
 \r
-               public void TestReadFromElement ()\r
+               [Test]\r
+               public void ReadFromElement ()\r
                {\r
                        XmlNodeReader nrdr = new XmlNodeReader (document.DocumentElement);\r
                        nrdr.Read ();\r
-                       AssertEquals ("<root>.NodeType", XmlNodeType.Element, nrdr.NodeType);\r
-                       AssertEquals ("<root>.Name", "root", nrdr.Name);\r
-                       AssertEquals ("<root>.ReadState", ReadState.Interactive, nrdr.ReadState);\r
-                       AssertEquals ("<root>.Depth", 0, nrdr.Depth);\r
+                       Assertion.AssertEquals ("<root>.NodeType", XmlNodeType.Element, nrdr.NodeType);\r
+                       Assertion.AssertEquals ("<root>.Name", "root", nrdr.Name);\r
+                       Assertion.AssertEquals ("<root>.ReadState", ReadState.Interactive, nrdr.ReadState);\r
+                       Assertion.AssertEquals ("<root>.Depth", 0, nrdr.Depth);\r
                }\r
 \r
-               public void TestReadString ()\r
+               [Test]\r
+               public void ReadString ()\r
                {\r
                        XmlDocument doc = new XmlDocument ();\r
                        doc.LoadXml ("<root>test of <b>mixed</b> string.<![CDATA[ cdata string.]]></root>");\r
                        XmlNodeReader nrdr = new XmlNodeReader (doc);\r
                        nrdr.Read ();\r
                        string s = nrdr.ReadString ();\r
-                       AssertEquals ("readString.1.ret_val", "test of ", s);\r
-                       AssertEquals ("readString.1.Name", "b", nrdr.Name);\r
+                       Assertion.AssertEquals ("readString.1.ret_val", "test of ", s);\r
+                       Assertion.AssertEquals ("readString.1.Name", "b", nrdr.Name);\r
                        s = nrdr.ReadString ();\r
-                       AssertEquals ("readString.2.ret_val", "mixed", s);\r
-                       AssertEquals ("readString.2.NodeType", XmlNodeType.EndElement, nrdr.NodeType);\r
+                       Assertion.AssertEquals ("readString.2.ret_val", "mixed", s);\r
+                       Assertion.AssertEquals ("readString.2.NodeType", XmlNodeType.EndElement, nrdr.NodeType);\r
                        s = nrdr.ReadString (); // never proceeds.\r
-                       AssertEquals ("readString.3.ret_val", String.Empty, s);\r
-                       AssertEquals ("readString.3.NodeType", XmlNodeType.EndElement, nrdr.NodeType);\r
+                       Assertion.AssertEquals ("readString.3.ret_val", String.Empty, s);\r
+                       Assertion.AssertEquals ("readString.3.NodeType", XmlNodeType.EndElement, nrdr.NodeType);\r
                        nrdr.Read ();\r
-                       AssertEquals ("readString.4.NodeType", XmlNodeType.Text, nrdr.NodeType);\r
-                       AssertEquals ("readString.4.Value", " string.", nrdr.Value);\r
+                       Assertion.AssertEquals ("readString.4.NodeType", XmlNodeType.Text, nrdr.NodeType);\r
+                       Assertion.AssertEquals ("readString.4.Value", " string.", nrdr.Value);\r
                        s = nrdr.ReadString (); // reads the same Text node.\r
-                       AssertEquals ("readString.5.ret_val", " string. cdata string.", s);\r
-                       AssertEquals ("readString.5.NodeType", XmlNodeType.EndElement, nrdr.NodeType);\r
+                       Assertion.AssertEquals ("readString.5.ret_val", " string. cdata string.", s);\r
+                       Assertion.AssertEquals ("readString.5.NodeType", XmlNodeType.EndElement, nrdr.NodeType);\r
                }\r
 \r
-               public void TestRedInnerXml ()\r
+               [Test]\r
+               public void RedInnerXml ()\r
                {\r
                        XmlDocument doc = new XmlDocument ();\r
                        doc.LoadXml ("<root>test of <b>mixed</b> string.</root>");\r
                        XmlNodeReader nrdr = new XmlNodeReader (doc);\r
                        nrdr.ReadInnerXml ();\r
-                       AssertEquals ("initial.ReadState", ReadState.Error, nrdr.ReadState);\r
-                       AssertEquals ("initial.EOF", true, nrdr.EOF);\r
-                       AssertEquals ("initial.NodeType", XmlNodeType.None, nrdr.NodeType);\r
+                       Assertion.AssertEquals ("initial.ReadState", ReadState.Error, nrdr.ReadState);\r
+                       Assertion.AssertEquals ("initial.EOF", true, nrdr.EOF);\r
+                       Assertion.AssertEquals ("initial.NodeType", XmlNodeType.None, nrdr.NodeType);\r
                }\r
        }\r
 \r
index 08f4b885830379e077bf6ceb76cc1adb91741c15..efb164bb847e614e96774b166bc17bb1c23eee55 100644 (file)
@@ -1,10 +1,12 @@
 //
 // System.Xml.XmlNodeTests
 //
-// Author:
+// Authors:
 //   Kral Ferch <kral_ferch@hotmail.com>
+//   Martin Willemoes Hansen
 //
 // (C) 2002 Kral Ferch
+// (C) 2003 Martin Willemoes Hansen
 //
 
 using System;
@@ -16,11 +18,9 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class XmlNodeTests : TestCase
+       [TestFixture]
+       public class XmlNodeTests
        {
-               public XmlNodeTests () : base ("MonoTests.System.Xml.XmlNodeTests testsuite") {}
-               public XmlNodeTests (string name) : base (name) {}
-
                XmlDocument document;
                XmlElement element;
                XmlElement element2;
@@ -31,7 +31,8 @@ namespace MonoTests.System.Xml
                bool removed;
                bool removing;
 
-               protected override void SetUp ()
+               [SetUp]
+               public void GetReady ()
                {
                        document = new XmlDocument ();
                        document.NodeInserted += new XmlNodeChangedEventHandler (this.EventNodeInserted);
@@ -72,93 +73,97 @@ namespace MonoTests.System.Xml
                        removing = true;
                }
 
-               public void TestAppendChild ()
+               [Test]
+               public void AppendChild ()
                {
                        XmlComment comment;
 
                        inserted = false;
                        inserting = false;
                        element.AppendChild (element2);
-                       Assert (inserted);
-                       Assert (inserting);
+                       Assertion.Assert (inserted);
+                       Assertion.Assert (inserting);
 
                        // Can only append to elements, documents, and attributes
                        try 
                        {
                                comment = document.CreateComment ("baz");
                                comment.AppendChild (element2);
-                               Fail ("Expected an InvalidOperationException to be thrown.");
+                               Assertion.Fail ("Expected an InvalidOperationException to be thrown.");
                        } 
                        catch (InvalidOperationException) {}
 
                        // Can't append a node from one document into another document.
                        XmlDocument document2 = new XmlDocument();
-                       AssertEquals (1, element.ChildNodes.Count);
+                       Assertion.AssertEquals (1, element.ChildNodes.Count);
                        try 
                        {
                                element2 = document2.CreateElement ("qux");
                                element.AppendChild (element2);
-                               Fail ("Expected an ArgumentException to be thrown.");
+                               Assertion.Fail ("Expected an ArgumentException to be thrown.");
                        } 
                        catch (ArgumentException) {}
-                       AssertEquals (1, element.ChildNodes.Count);
+                       Assertion.AssertEquals (1, element.ChildNodes.Count);
 
                        // Can't append to a readonly node.
 /* TODO put this in when I figure out how to create a read-only node.
                        try 
                        {
                                XmlElement element3 = (XmlElement)element.CloneNode (false);
-                               Assert (!element.IsReadOnly);
-                               Assert (element3.IsReadOnly);
+                               Assertion.Assert (!element.IsReadOnly);
+                               Assertion.Assert (element3.IsReadOnly);
                                element2 = document.CreateElement ("quux");
                                element3.AppendChild (element2);
-                               Fail ("Expected an ArgumentException to be thrown.");
+                               Assertion.Fail ("Expected an ArgumentException to be thrown.");
                        } 
                        catch (ArgumentException) {}
 */
                }
 
-               public void TestInsertBefore()
+               [Test]
+               public void InsertBefore()
                {
                        document = new XmlDocument();
                        document.LoadXml("<root><sub /></root>");
                        XmlElement docelem = document.DocumentElement;
                        docelem.InsertBefore(document.CreateElement("good_child"), docelem.FirstChild);
-                       AssertEquals("InsertBefore.Normal", "good_child", docelem.FirstChild.Name);
+                       Assertion.AssertEquals("InsertBefore.Normal", "good_child", docelem.FirstChild.Name);
                        // These are required for .NET 1.0 but not for .NET 1.1.
 //                     try {
 //                             document.InsertBefore (document.CreateElement ("BAD_MAN"), docelem);
-//                             Fail ("#InsertBefore.BadPositionButNoError.1");
+//                             Assertion.Fail ("#InsertBefore.BadPositionButNoError.1");
 //                     }
 //                     catch (XmlException) {}
                }
 
-               public void TestInsertAfter()
+               [Test]
+               public void InsertAfter()
                {
                        document = new XmlDocument();
                        document.LoadXml("<root><sub1 /><sub2 /></root>");
                        XmlElement docelem = document.DocumentElement;
                        XmlElement newelem = document.CreateElement("good_child");
                        docelem.InsertAfter(newelem, docelem.FirstChild);
-                       AssertEquals("InsertAfter.Normal", 3, docelem.ChildNodes.Count);
-                       AssertEquals("InsertAfter.First", "sub1", docelem.FirstChild.Name);
-                       AssertEquals("InsertAfter.Last", "sub2", docelem.LastChild.Name);
-                       AssertEquals("InsertAfter.Prev", "good_child", docelem.FirstChild.NextSibling.Name);
-                       AssertEquals("InsertAfter.Next", "good_child", docelem.LastChild.PreviousSibling.Name);
+                       Assertion.AssertEquals("InsertAfter.Normal", 3, docelem.ChildNodes.Count);
+                       Assertion.AssertEquals("InsertAfter.First", "sub1", docelem.FirstChild.Name);
+                       Assertion.AssertEquals("InsertAfter.Last", "sub2", docelem.LastChild.Name);
+                       Assertion.AssertEquals("InsertAfter.Prev", "good_child", docelem.FirstChild.NextSibling.Name);
+                       Assertion.AssertEquals("InsertAfter.Next", "good_child", docelem.LastChild.PreviousSibling.Name);
                        // this doesn't throw an exception
                        document.InsertAfter(document.CreateElement("BAD_MAN"), docelem);
-                       AssertEquals("InsertAfter with bad location", 
+                       Assertion.AssertEquals("InsertAfter with bad location", 
                                "<root><sub1 /><good_child /><sub2 /></root><BAD_MAN />",
                                document.InnerXml);
 }
 
-               public void TestPrependChild()
+               [Test]
+               public void PrependChild()
                {
                        document = new XmlDocument();
                        document.LoadXml("<root><sub1 /><sub2 /></root>");
                        XmlElement docelem = document.DocumentElement;
                        docelem.PrependChild(document.CreateElement("prepender"));
-                       AssertEquals("PrependChild", "prepender", docelem.FirstChild.Name);
+                       Assertion.AssertEquals("PrependChild", "prepender", docelem.FirstChild.Name);
                }
 
                public void saveTestRemoveAll ()
@@ -168,31 +173,34 @@ namespace MonoTests.System.Xml
                        removed = false;
                        removing = false;
                        element.RemoveAll ();
-                       Assert (removed);
-                       Assert (removing);
+                       Assertion.Assert (removed);
+                       Assertion.Assert (removing);
                }
 
-               public void TestRemoveChild ()
+               [Test]
+               public void RemoveChild ()
                {
                        element.AppendChild(element2);
                        removed = false;
                        removing = false;
                        element.RemoveChild (element2);
-                       Assert (removed);
-                       Assert (removing);
+                       Assertion.Assert (removed);
+                       Assertion.Assert (removing);
                }
                
-               public void TestGetPrefixOfNamespace ()
+               [Test]
+               public void GetPrefixOfNamespace ()
                {
                        document.LoadXml ("<root><c1 xmlns='urn:foo'><c2 xmlns:foo='urn:foo' xmlns='urn:bar'><c3 xmlns=''/></c2></c1></root>");
-                       AssertEquals ("root", String.Empty, document.DocumentElement.GetPrefixOfNamespace ("urn:foo"));
-                       AssertEquals ("c1", String.Empty, document.DocumentElement.GetPrefixOfNamespace ("urn:foo"));
-                       AssertEquals ("c2", String.Empty, document.DocumentElement.FirstChild.GetPrefixOfNamespace ("urn:foo"));
-                       AssertEquals ("c3", "foo", document.DocumentElement.FirstChild.FirstChild.GetPrefixOfNamespace ("urn:foo"));
+                       Assertion.AssertEquals ("root", String.Empty, document.DocumentElement.GetPrefixOfNamespace ("urn:foo"));
+                       Assertion.AssertEquals ("c1", String.Empty, document.DocumentElement.GetPrefixOfNamespace ("urn:foo"));
+                       Assertion.AssertEquals ("c2", String.Empty, document.DocumentElement.FirstChild.GetPrefixOfNamespace ("urn:foo"));
+                       Assertion.AssertEquals ("c3", "foo", document.DocumentElement.FirstChild.FirstChild.GetPrefixOfNamespace ("urn:foo"));
 
                }
 
-               public void TestReplaceChild ()
+               [Test]
+               public void ReplaceChild ()
                {
                        document.LoadXml ("<root/>");
                        document.NodeInserted += new XmlNodeChangedEventHandler (this.EventNodeInserted);
@@ -201,9 +209,9 @@ namespace MonoTests.System.Xml
                        inserted = changed = removed = false;
                        XmlElement el = document.CreateElement("root2");
                        document.ReplaceChild (el, document.DocumentElement);
-                       AssertEquals ("root2", document.DocumentElement.Name);
-                       AssertEquals (1, document.ChildNodes.Count);
-                       Assert (inserted && removed && !changed);
+                       Assertion.AssertEquals ("root2", document.DocumentElement.Name);
+                       Assertion.AssertEquals (1, document.ChildNodes.Count);
+                       Assertion.Assert (inserted && removed && !changed);
                }
        }
 }
index 0926af316aa13cb43055578d74893392734477d9..12163f4ef202fa69bd0aad4bc39220a74b9a45d3 100644 (file)
@@ -1,10 +1,12 @@
 //
 // System.Xml.XmlTextWriterTests
 //
-// Author:
+// Authors:
 //   Kral Ferch <kral_ferch@hotmail.com>
+//   Martin Willemoes Hansen <mwh@sysrq.dk>
 //
 // (C) 2002 Kral Ferch
+// (C) 2003 Martin Willemoes Hansen
 //
 
 using System;
@@ -13,24 +15,24 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class XmlProcessingInstructionTests : TestCase
+       [TestFixture]
+       public class XmlProcessingInstructionTests
        {
-               public XmlProcessingInstructionTests () : base ("MonoTests.System.Xml.XmlProcessingInstructionTests testsuite") {}
-               public XmlProcessingInstructionTests (string name) : base (name) {}
-
                XmlDocument document;
                XmlProcessingInstruction pi;
 
-               protected override void SetUp ()
+               [SetUp]
+               public void GetReady ()
                {
                        document = new XmlDocument ();
                }
 
-               public void TestInnerAndOuterXml ()
+               [Test]
+               public void InnerAndOuterXml ()
                {
                        pi = document.CreateProcessingInstruction ("foo", "bar");
-                       AssertEquals (String.Empty, pi.InnerXml);
-                       AssertEquals ("<?foo bar?>", pi.OuterXml);
+                       Assertion.AssertEquals (String.Empty, pi.InnerXml);
+                       Assertion.AssertEquals ("<?foo bar?>", pi.OuterXml);
                }
        }
 }
index 870d986972071b6972868aa9556fbf078b0c4f04..0f9193b706b851536aa490546f5fbeb74cf08de3 100755 (executable)
@@ -1,10 +1,12 @@
 //
 // System.Xml.XmlWhitespaceTests.cs
 //
-// Author:
+// Authors:
 //     Duncan Mak  (duncan@ximian.com)
+//      Martin Willemoes Hansen (mwh@sysrq.dk)
 //
 // (C) Ximian, Inc.
+// (C) 2003 Martin Willemoes Hansen
 //
 
 using System;
@@ -14,7 +16,8 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class XmlSignificantWhitespaceTests : TestCase
+       [TestFixture]
+       public class XmlSignificantWhitespaceTests
        {
                XmlDocument document;
                XmlDocument doc2;
@@ -24,10 +27,8 @@ namespace MonoTests.System.Xml
                XmlNode deep;
                XmlNode shallow;
                
-               public XmlSignificantWhitespaceTests () : base ("MonoTests.System.Xml.XmlWhitespaceTests testsuite") {}
-               public XmlSignificantWhitespaceTests (string name) : base (name) {}
-
-               protected override void SetUp ()
+               [SetUp]
+               public void GetReady ()
                {
                        document = new XmlDocument ();
                        document.LoadXml ("<root><foo></foo></root>");
@@ -38,35 +39,38 @@ namespace MonoTests.System.Xml
                        doc2 = new XmlDocument ();
                }
 
-               public void TestInnerAndOuterXml ()
+               [Test]
+               public void InnerAndOuterXml ()
                {
                        whitespace = doc2.CreateSignificantWhitespace ("\r\n\t ");
-                       AssertEquals (String.Empty, whitespace.InnerXml);
-                       AssertEquals ("\r\n\t ", whitespace.OuterXml);
+                       Assertion.AssertEquals (String.Empty, whitespace.InnerXml);
+                       Assertion.AssertEquals ("\r\n\t ", whitespace.OuterXml);
                }
 
-               public void TestDataAndValue ()
+               [Test]
+               public void DataAndValue ()
                {
                        string val = "\t\t\r\n ";
                        whitespace = doc2.CreateSignificantWhitespace (val);
-                       AssertEquals ("#DataValue.1", val, whitespace.Data);
-                       AssertEquals ("#DataValue.2", val, whitespace.Value);
+                       Assertion.AssertEquals ("#DataValue.1", val, whitespace.Data);
+                       Assertion.AssertEquals ("#DataValue.2", val, whitespace.Value);
                        whitespace.Value = val + "\t";
-                       AssertEquals ("#DataValue.3", val + "\t", whitespace.Data);
+                       Assertion.AssertEquals ("#DataValue.3", val + "\t", whitespace.Data);
                }
                        
-               internal void TestXmlNodeBaseProperties (XmlNode original, XmlNode cloned)
+               internal void XmlNodeBaseProperties (XmlNode original, XmlNode cloned)
                {
 //                     assertequals (original.nodetype + " was incorrectly cloned.",
 //                                   original.baseuri, cloned.baseuri);                        
-                       AssertNull (cloned.ParentNode);
-                       AssertEquals ("Value incorrectly cloned",
+                       Assertion.AssertNull (cloned.ParentNode);
+                       Assertion.AssertEquals ("Value incorrectly cloned",
                                       cloned.Value, original.Value);
                        
-                        Assert ("Copies, not pointers", !Object.ReferenceEquals (original,cloned));
+                        Assertion.Assert ("Copies, not pointers", !Object.ReferenceEquals (original,cloned));
                }
 
-               public void TestXmlSignificantWhitespaceBadConstructor ()
+               [Test]
+               public void XmlSignificantWhitespaceBadConstructor ()
                {
                        try {
                                broken = document.CreateSignificantWhitespace ("black");                                
@@ -75,52 +79,57 @@ namespace MonoTests.System.Xml
                                return;
 
                        } catch (Exception) {
-                               Fail ("Incorrect Exception thrown.");
+                               Assertion.Fail ("Incorrect Exception thrown.");
                        }
                }
 
-               public void TestXmlSignificantWhitespaceConstructor ()
+               [Test]
+               public void XmlSignificantWhitespaceConstructor ()
                {
-                       AssertEquals ("whitespace char didn't get copied right",
+                       Assertion.AssertEquals ("whitespace char didn't get copied right",
                                      "\r\n", whitespace.Data);
                }
                
-              
-               public void TestXmlSignificantWhitespaceName ()
+               [Test]
+               public void XmlSignificantWhitespaceName ()
                {
-                       AssertEquals (whitespace.NodeType + " Name property broken",
+                       Assertion.AssertEquals (whitespace.NodeType + " Name property broken",
                                      whitespace.Name, "#significant-whitespace");
                }
 
-               public void TestXmlSignificantWhitespaceLocalName ()
+               [Test]
+               public void XmlSignificantWhitespaceLocalName ()
                {
-                       AssertEquals (whitespace.NodeType + " LocalName property broken",
+                       Assertion.AssertEquals (whitespace.NodeType + " LocalName property broken",
                                      whitespace.LocalName, "#significant-whitespace");
                }
 
-               public void TestXmlSignificantWhitespaceNodeType ()
+               [Test]
+               public void XmlSignificantWhitespaceNodeType ()
                {
-                       AssertEquals ("XmlSignificantWhitespace NodeType property broken",
+                       Assertion.AssertEquals ("XmlSignificantWhitespace NodeType property broken",
                                      whitespace.NodeType.ToString (), "SignificantWhitespace");
                }
 
-               public void TestXmlSignificantWhitespaceIsReadOnly ()
+               [Test]
+               public void XmlSignificantWhitespaceIsReadOnly ()
                {
-                       AssertEquals ("XmlSignificantWhitespace IsReadOnly property broken",
+                       Assertion.AssertEquals ("XmlSignificantWhitespace IsReadOnly property broken",
                                      whitespace.IsReadOnly, false);
                }
 
-               public void TestXmlSignificantWhitespaceCloneNode ()
+               [Test]
+               public void XmlSignificantWhitespaceCloneNode ()
                {
                        original = whitespace;
 
                        shallow = whitespace.CloneNode (false); // shallow
-                       TestXmlNodeBaseProperties (original, shallow);
+                       XmlNodeBaseProperties (original, shallow);
                                                
                        deep = whitespace.CloneNode (true); // deep
-                       TestXmlNodeBaseProperties (original, deep); 
+                       XmlNodeBaseProperties (original, deep); 
 
-                        AssertEquals ("deep cloning differs from shallow cloning",
+                        Assertion.AssertEquals ("deep cloning differs from shallow cloning",
                                      deep.OuterXml, shallow.OuterXml);
                }
        }
index a779915d1b8b328790b642fb1d5fa4ec23b39d3f..d9224ba8158d1b741cab48a18b92fe3f4ead67b3 100644 (file)
@@ -1,8 +1,9 @@
 //
 // XmlTextReaderTests.cs
 //
-// Author:
+// Authors:
 //   Jason Diamond (jason@injektilo.org)
+//   Martin Willemoes Hansen (mwh@sysrq.dk)
 //
 // (C) 2001, 2002 Jason Diamond  http://injektilo.org/
 //
@@ -16,17 +17,15 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class XmlTextReaderTests : TestCase
+       [TestFixture]
+       public class XmlTextReaderTests
        {
-               public XmlTextReaderTests () : base ("MonoTests.System.Xml.XmlTextReaderTests testsuite") { }
-               public XmlTextReaderTests (string name) : base (name) { }
-
                private void AssertStartDocument (XmlReader xmlReader)
                {
-                       Assert (xmlReader.ReadState == ReadState.Initial);
-                       Assert (xmlReader.NodeType == XmlNodeType.None);
-                       Assert (xmlReader.Depth == 0);
-                       Assert (!xmlReader.EOF);
+                       Assertion.Assert (xmlReader.ReadState == ReadState.Initial);
+                       Assertion.Assert (xmlReader.NodeType == XmlNodeType.None);
+                       Assertion.Assert (xmlReader.Depth == 0);
+                       Assertion.Assert (!xmlReader.EOF);
                }
 
                private void AssertNode (
@@ -41,9 +40,9 @@ namespace MonoTests.System.Xml
                        string value,
                        int attributeCount)
                {
-                       Assert (xmlReader.Read ());
-                       Assert (xmlReader.ReadState == ReadState.Interactive);
-                       Assert (!xmlReader.EOF);
+                       Assertion.Assert (xmlReader.Read ());
+                       Assertion.Assert (xmlReader.ReadState == ReadState.Interactive);
+                       Assertion.Assert (!xmlReader.EOF);
                        AssertNodeValues (xmlReader, nodeType, depth, isEmptyElement, name, prefix, localName, namespaceURI, value, attributeCount);
                }
 
@@ -59,25 +58,25 @@ namespace MonoTests.System.Xml
                        string value,
                        int attributeCount)
                {
-                       AssertEquals ("NodeType", nodeType, xmlReader.NodeType);
-                       AssertEquals ("Depth", depth, xmlReader.Depth);
-                       AssertEquals ("IsEmptyElement", isEmptyElement, xmlReader.IsEmptyElement);
+                       Assertion.AssertEquals ("NodeType", nodeType, xmlReader.NodeType);
+                       Assertion.AssertEquals ("Depth", depth, xmlReader.Depth);
+                       Assertion.AssertEquals ("IsEmptyElement", isEmptyElement, xmlReader.IsEmptyElement);
 
-                       AssertEquals ("name", name, xmlReader.Name);
+                       Assertion.AssertEquals ("name", name, xmlReader.Name);
 
-                       AssertEquals ("prefix", prefix, xmlReader.Prefix);
+                       Assertion.AssertEquals ("prefix", prefix, xmlReader.Prefix);
 
-                       AssertEquals ("localName", localName, xmlReader.LocalName);
+                       Assertion.AssertEquals ("localName", localName, xmlReader.LocalName);
 
-                       AssertEquals ("namespaceURI", namespaceURI, xmlReader.NamespaceURI);
+                       Assertion.AssertEquals ("namespaceURI", namespaceURI, xmlReader.NamespaceURI);
 
-                       AssertEquals ("hasValue", (value != String.Empty), xmlReader.HasValue);
+                       Assertion.AssertEquals ("hasValue", (value != String.Empty), xmlReader.HasValue);
 
-                       AssertEquals ("Value", value, xmlReader.Value);
+                       Assertion.AssertEquals ("Value", value, xmlReader.Value);
 
-                       AssertEquals ("hasAttributes", attributeCount > 0, xmlReader.HasAttributes);
+                       Assertion.AssertEquals ("hasAttributes", attributeCount > 0, xmlReader.HasAttributes);
 
-                       AssertEquals ("attributeCount", attributeCount, xmlReader.AttributeCount);
+                       Assertion.AssertEquals ("attributeCount", attributeCount, xmlReader.AttributeCount);
                }
 
                private void AssertAttribute (
@@ -88,29 +87,30 @@ namespace MonoTests.System.Xml
                        string namespaceURI,
                        string value)
                {
-                       AssertEquals ("value", value, xmlReader [name]);
+                       Assertion.AssertEquals ("value", value, xmlReader [name]);
 
-                       Assert (xmlReader.GetAttribute (name) == value);
+                       Assertion.Assert (xmlReader.GetAttribute (name) == value);
 
                        if (namespaceURI != String.Empty) {
-                               Assert (xmlReader[localName, namespaceURI] == value);
-                               Assert (xmlReader.GetAttribute (localName, namespaceURI) == value);
+                               Assertion.Assert (xmlReader[localName, namespaceURI] == value);
+                               Assertion.Assert (xmlReader.GetAttribute (localName, namespaceURI) == value);
                        }
                }
 
                private void AssertEndDocument (XmlReader xmlReader)
                {
-                       Assert ("could read", !xmlReader.Read ());
-                       AssertEquals ("NodeType is not XmlNodeType.None", XmlNodeType.None, xmlReader.NodeType);
-                       AssertEquals ("Depth is not 0", 0, xmlReader.Depth);
-                       AssertEquals ("ReadState is not ReadState.EndOfFile",  ReadState.EndOfFile, xmlReader.ReadState);
-                       Assert ("not EOF", xmlReader.EOF);
+                       Assertion.Assert ("could read", !xmlReader.Read ());
+                       Assertion.AssertEquals ("NodeType is not XmlNodeType.None", XmlNodeType.None, xmlReader.NodeType);
+                       Assertion.AssertEquals ("Depth is not 0", 0, xmlReader.Depth);
+                       Assertion.AssertEquals ("ReadState is not ReadState.EndOfFile",  ReadState.EndOfFile, xmlReader.ReadState);
+                       Assertion.Assert ("not EOF", xmlReader.EOF);
 
                        xmlReader.Close ();
-                       AssertEquals ("ReadState is not ReadState.Cosed", ReadState.Closed, xmlReader.ReadState);
+                       Assertion.AssertEquals ("ReadState is not ReadState.Cosed", ReadState.Closed, xmlReader.ReadState);
                }
 
-               public void TestEmptyElement ()
+               [Test]
+               public void EmptyElement ()
                {
                        string xml = "<foo/>";
                        XmlReader xmlReader =
@@ -134,7 +134,8 @@ namespace MonoTests.System.Xml
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestEmptyElementWithBadName ()
+               [Test]
+               public void EmptyElementWithBadName ()
                {
                        string xml = "<1foo/>";
                        XmlReader xmlReader =
@@ -148,10 +149,11 @@ namespace MonoTests.System.Xml
                                caughtXmlException = true;
                        }
 
-                       Assert(caughtXmlException);
+                       Assertion.Assert(caughtXmlException);
                }
 
-               public void TestEmptyElementWithWhitespace ()
+               [Test]
+               public void EmptyElementWithWhitespace ()
                {
                        string xml = "<foo />";
                        XmlReader xmlReader =
@@ -175,7 +177,8 @@ namespace MonoTests.System.Xml
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestEmptyElementWithStartAndEndTag ()
+               [Test]
+               public void EmptyElementWithStartAndEndTag ()
                {
                        string xml = "<foo></foo>";
                        XmlReader xmlReader =
@@ -212,7 +215,8 @@ namespace MonoTests.System.Xml
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestEmptyElementWithStartAndEndTagWithWhitespace ()
+               [Test]
+               public void EmptyElementWithStartAndEndTagWithWhitespace ()
                {
                        string xml = "<foo ></foo >";
                        XmlReader xmlReader =
@@ -249,7 +253,8 @@ namespace MonoTests.System.Xml
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestNestedEmptyTag ()
+               [Test]
+               public void NestedEmptyTag ()
                {
                        string xml = "<foo><bar/></foo>";
                        XmlReader xmlReader =
@@ -299,7 +304,8 @@ namespace MonoTests.System.Xml
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestNestedText ()
+               [Test]
+               public void NestedText ()
                {
                        string xml = "<foo>bar</foo>";
                        XmlReader xmlReader =
@@ -349,7 +355,8 @@ namespace MonoTests.System.Xml
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestEmptyElementWithAttribute ()
+               [Test]
+               public void EmptyElementWithAttribute ()
                {
                        string xml = @"<foo bar=""baz""/>";
                        XmlReader xmlReader =
@@ -382,7 +389,8 @@ namespace MonoTests.System.Xml
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestStartAndEndTagWithAttribute ()
+               [Test]
+               public void StartAndEndTagWithAttribute ()
                {
                        string xml = @"<foo bar='baz'></foo>";
                        XmlReader xmlReader =
@@ -428,7 +436,8 @@ namespace MonoTests.System.Xml
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestEmptyElementWithTwoAttributes ()
+               [Test]
+               public void EmptyElementWithTwoAttributes ()
                {
                        string xml = @"<foo bar=""baz"" quux='quuux'/>";
                        XmlReader xmlReader =
@@ -470,7 +479,8 @@ namespace MonoTests.System.Xml
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestProcessingInstructionBeforeDocumentElement ()
+               [Test]
+               public void ProcessingInstructionBeforeDocumentElement ()
                {
                        string xml = "<?foo bar?><baz/>";
                        XmlReader xmlReader =
@@ -507,7 +517,8 @@ namespace MonoTests.System.Xml
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestCommentBeforeDocumentElement ()
+               [Test]
+               public void CommentBeforeDocumentElement ()
                {
                        string xml = "<!--foo--><bar/>";
                        XmlReader xmlReader =
@@ -544,7 +555,8 @@ namespace MonoTests.System.Xml
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestPredefinedEntities ()
+               [Test]
+               public void PredefinedEntities ()
                {
                        string xml = "<foo>&lt;&gt;&amp;&apos;&quot;</foo>";
                        XmlReader xmlReader =
@@ -594,7 +606,8 @@ namespace MonoTests.System.Xml
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestEntityReference ()
+               [Test]
+               public void EntityReference ()
                {
                        string xml = "<foo>&bar;</foo>";
                        XmlReader xmlReader =
@@ -644,7 +657,8 @@ namespace MonoTests.System.Xml
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestEntityReferenceInsideText ()
+               [Test]
+               public void EntityReferenceInsideText ()
                {
                        string xml = "<foo>bar&baz;quux</foo>";
                        XmlReader xmlReader =
@@ -720,7 +734,8 @@ namespace MonoTests.System.Xml
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestCharacterReferences ()
+               [Test]
+               public void CharacterReferences ()
                {
                        string xml = "<foo>&#70;&#x4F;&#x4f;</foo>";
                        XmlReader xmlReader =
@@ -770,7 +785,8 @@ namespace MonoTests.System.Xml
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestEntityReferenceInAttribute ()
+               [Test]
+               public void EntityReferenceInAttribute ()
                {
                        string xml = "<foo bar='&baz;'/>";
                        XmlReader xmlReader =
@@ -803,7 +819,8 @@ namespace MonoTests.System.Xml
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestPredefinedEntitiesInAttribute ()
+               [Test]
+               public void PredefinedEntitiesInAttribute ()
                {
                        string xml = "<foo bar='&lt;&gt;&amp;&apos;&quot;'/>";
                        XmlReader xmlReader =
@@ -836,7 +853,8 @@ namespace MonoTests.System.Xml
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestCharacterReferencesInAttribute ()
+               [Test]
+               public void CharacterReferencesInAttribute ()
                {
                        string xml = "<foo bar='&#70;&#x4F;&#x4f;'/>";
                        XmlReader xmlReader =
@@ -869,7 +887,8 @@ namespace MonoTests.System.Xml
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestCDATA ()
+               [Test]
+               public void CDATA ()
                {
                        string xml = "<foo><![CDATA[<>&]]></foo>";
                        XmlReader xmlReader =
@@ -919,7 +938,8 @@ namespace MonoTests.System.Xml
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestEmptyElementInNamespace ()
+               [Test]
+               public void EmptyElementInNamespace ()
                {
                        string xml = @"<foo:bar xmlns:foo='http://foo/' />";
                        XmlReader xmlReader =
@@ -949,12 +969,13 @@ namespace MonoTests.System.Xml
                                "http://foo/" // value
                        );
 
-                       AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
+                       Assertion.AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
 
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestEmptyElementInDefaultNamespace ()
+               [Test]
+               public void EmptyElementInDefaultNamespace ()
                {
                        string xml = @"<foo xmlns='http://foo/' />";
                        XmlReader xmlReader =
@@ -984,12 +1005,13 @@ namespace MonoTests.System.Xml
                                "http://foo/" // value
                        );
 
-                       AssertEquals ("http://foo/", xmlReader.LookupNamespace (String.Empty));
+                       Assertion.AssertEquals ("http://foo/", xmlReader.LookupNamespace (String.Empty));
 
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestChildElementInNamespace ()
+               [Test]
+               public void ChildElementInNamespace ()
                {
                        string xml = @"<foo:bar xmlns:foo='http://foo/'><baz:quux xmlns:baz='http://baz/' /></foo:bar>";
                        XmlReader xmlReader =
@@ -1019,7 +1041,7 @@ namespace MonoTests.System.Xml
                                "http://foo/" // value
                        );
 
-                       AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
+                       Assertion.AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
 
                        AssertNode (
                                xmlReader, // xmlReader
@@ -1043,8 +1065,8 @@ namespace MonoTests.System.Xml
                                "http://baz/" // value
                        );
 
-                       AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
-                       AssertEquals ("http://baz/", xmlReader.LookupNamespace ("baz"));
+                       Assertion.AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
+                       Assertion.AssertEquals ("http://baz/", xmlReader.LookupNamespace ("baz"));
 
                        AssertNode (
                                xmlReader, // xmlReader
@@ -1059,13 +1081,14 @@ namespace MonoTests.System.Xml
                                0 // attributeCount
                        );
 
-                       AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
-                       AssertNull (xmlReader.LookupNamespace ("baz"));
+                       Assertion.AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
+                       Assertion.AssertNull (xmlReader.LookupNamespace ("baz"));
 
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestChildElementInDefaultNamespace ()
+               [Test]
+               public void ChildElementInDefaultNamespace ()
                {
                        string xml = @"<foo:bar xmlns:foo='http://foo/'><baz xmlns='http://baz/' /></foo:bar>";
                        XmlReader xmlReader =
@@ -1095,7 +1118,7 @@ namespace MonoTests.System.Xml
                                "http://foo/" // value
                        );
 
-                       AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
+                       Assertion.AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
 
                        AssertNode (
                                xmlReader, // xmlReader
@@ -1119,8 +1142,8 @@ namespace MonoTests.System.Xml
                                "http://baz/" // value
                        );
 
-                       AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
-                       AssertEquals ("http://baz/", xmlReader.LookupNamespace (String.Empty));
+                       Assertion.AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
+                       Assertion.AssertEquals ("http://baz/", xmlReader.LookupNamespace (String.Empty));
 
                        AssertNode (
                                xmlReader, // xmlReader
@@ -1135,12 +1158,13 @@ namespace MonoTests.System.Xml
                                0 // attributeCount
                        );
 
-                       AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
+                       Assertion.AssertEquals ("http://foo/", xmlReader.LookupNamespace ("foo"));
 
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestAttributeInNamespace ()
+               [Test]
+               public void AttributeInNamespace ()
                {
                        string xml = @"<foo bar:baz='quux' xmlns:bar='http://bar/' />";
                        XmlReader xmlReader =
@@ -1179,7 +1203,7 @@ namespace MonoTests.System.Xml
                                "http://bar/" // value
                        );
 
-                       AssertEquals ("http://bar/", xmlReader.LookupNamespace ("bar"));
+                       Assertion.AssertEquals ("http://bar/", xmlReader.LookupNamespace ("bar"));
 
                        AssertEndDocument (xmlReader);
                }
@@ -1190,19 +1214,21 @@ namespace MonoTests.System.Xml
 
 #if false
 
-               public void TestIsFirstNameChar ()
+               [Test]
+               public void IsFirstNameCharTest ()
                {
                        for (int ch = 0; ch <= 0xFFFF; ++ch) {
-                               Assert (
+                               Assertion.Assert (
                                        XmlChar.IsFirstNameChar (ch) ==
                                                IsFirstNameChar (ch));
                        }
                }
 
-               public void TestIsNameChar ()
+               [Test]
+               public void IsNameCharTest ()
                {
                        for (int ch = 0; ch <= 0xFFFF; ++ch) {
-                               Assert (
+                               Assertion.Assert (
                                        XmlChar.IsNameChar (ch) ==
                                                IsNameChar (ch));
                        }
@@ -1588,72 +1614,78 @@ namespace MonoTests.System.Xml
                }
 
 #endif
-
-               public void TestIsName ()
+               [Test]
+               public void IsName ()
                {
-                       Assert (XmlReader.IsName ("foo"));
-                       Assert (!XmlReader.IsName ("1foo"));
-                       Assert (!XmlReader.IsName (" foo"));
+                       Assertion.Assert (XmlReader.IsName ("foo"));
+                       Assertion.Assert (!XmlReader.IsName ("1foo"));
+                       Assertion.Assert (!XmlReader.IsName (" foo"));
                }
 
-               public void TestIsNameToken ()
+               [Test]
+               public void IsNameToken ()
                {
-                       Assert (XmlReader.IsNameToken ("foo"));
-                       Assert (XmlReader.IsNameToken ("1foo"));
-                       Assert (!XmlReader.IsNameToken (" foo"));
+                       Assertion.Assert (XmlReader.IsNameToken ("foo"));
+                       Assertion.Assert (XmlReader.IsNameToken ("1foo"));
+                       Assertion.Assert (!XmlReader.IsNameToken (" foo"));
                }
 
-               public void TestMoveToElementFromAttribute ()
+               [Test]
+               public void MoveToElementFromAttribute ()
                {
                        string xml = @"<foo bar=""baz"" />";
                        XmlReader xmlReader =
                                new XmlTextReader (new StringReader (xml));
 
-                       Assert (xmlReader.Read ());
-                       AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
-                       Assert (xmlReader.MoveToFirstAttribute ());
-                       AssertEquals (XmlNodeType.Attribute, xmlReader.NodeType);
-                       Assert (xmlReader.MoveToElement ());
-                       AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+                       Assertion.Assert (xmlReader.Read ());
+                       Assertion.AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+                       Assertion.Assert (xmlReader.MoveToFirstAttribute ());
+                       Assertion.AssertEquals (XmlNodeType.Attribute, xmlReader.NodeType);
+                       Assertion.Assert (xmlReader.MoveToElement ());
+                       Assertion.AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
                }
 
-               public void TestMoveToElementFromElement ()
+               [Test]
+               public void MoveToElementFromElement ()
                {
                        string xml = @"<foo bar=""baz"" />";
                        XmlReader xmlReader =
                                new XmlTextReader (new StringReader (xml));
 
-                       Assert (xmlReader.Read ());
-                       AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
-                       Assert (!xmlReader.MoveToElement ());
-                       AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+                       Assertion.Assert (xmlReader.Read ());
+                       Assertion.AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+                       Assertion.Assert (!xmlReader.MoveToElement ());
+                       Assertion.AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
                }
 
-               public void TestMoveToFirstAttributeWithNoAttributes ()
+               [Test]
+               public void MoveToFirstAttributeWithNoAttributes ()
                {
                        string xml = @"<foo />";
                        XmlReader xmlReader =
                                new XmlTextReader (new StringReader (xml));
 
-                       Assert (xmlReader.Read ());
-                       AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
-                       Assert (!xmlReader.MoveToFirstAttribute ());
-                       AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+                       Assertion.Assert (xmlReader.Read ());
+                       Assertion.AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+                       Assertion.Assert (!xmlReader.MoveToFirstAttribute ());
+                       Assertion.AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
                }
 
-               public void TestMoveToNextAttributeWithNoAttributes ()
+               [Test]
+               public void MoveToNextAttributeWithNoAttributes ()
                {
                        string xml = @"<foo />";
                        XmlReader xmlReader =
                                new XmlTextReader (new StringReader (xml));
 
-                       Assert (xmlReader.Read ());
-                       AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
-                       Assert (!xmlReader.MoveToNextAttribute ());
-                       AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+                       Assertion.Assert (xmlReader.Read ());
+                       Assertion.AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+                       Assertion.Assert (!xmlReader.MoveToNextAttribute ());
+                       Assertion.AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
                }
 
-               public void TestMoveToNextAttribute()
+               [Test]
+               public void MoveToNextAttribute()
                {
                        string xml = @"<foo bar=""baz"" quux='quuux'/>";
                        XmlReader xmlReader =
@@ -1692,17 +1724,17 @@ namespace MonoTests.System.Xml
                                "quuux" // value
                        );
 
-                       Assert (xmlReader.MoveToNextAttribute ());
-                       Assert ("bar" == xmlReader.Name || "quux" == xmlReader.Name);
-                       Assert ("baz" == xmlReader.Value || "quuux" == xmlReader.Value);
+                       Assertion.Assert (xmlReader.MoveToNextAttribute ());
+                       Assertion.Assert ("bar" == xmlReader.Name || "quux" == xmlReader.Name);
+                       Assertion.Assert ("baz" == xmlReader.Value || "quuux" == xmlReader.Value);
 
-                       Assert (xmlReader.MoveToNextAttribute ());
-                       Assert ("bar" == xmlReader.Name || "quux" == xmlReader.Name);
-                       Assert ("baz" == xmlReader.Value || "quuux" == xmlReader.Value);
+                       Assertion.Assert (xmlReader.MoveToNextAttribute ());
+                       Assertion.Assert ("bar" == xmlReader.Name || "quux" == xmlReader.Name);
+                       Assertion.Assert ("baz" == xmlReader.Value || "quuux" == xmlReader.Value);
 
-                       Assert (!xmlReader.MoveToNextAttribute ());
+                       Assertion.Assert (!xmlReader.MoveToNextAttribute ());
 
-            Assert (xmlReader.MoveToElement ());
+            Assertion.Assert (xmlReader.MoveToElement ());
 
                        AssertNodeValues (
                                xmlReader, // xmlReader
@@ -1720,26 +1752,28 @@ namespace MonoTests.System.Xml
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestAttributeOrder ()
+               [Test]
+               public void AttributeOrder ()
                {
                        string xml = @"<foo _1='1' _2='2' _3='3' />";
                        XmlReader xmlReader =
                                new XmlTextReader (new StringReader (xml));
 
-                       Assert (xmlReader.Read ());
-                       AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
+                       Assertion.Assert (xmlReader.Read ());
+                       Assertion.AssertEquals (XmlNodeType.Element, xmlReader.NodeType);
 
-                       Assert (xmlReader.MoveToFirstAttribute ());
-                       AssertEquals ("_1", xmlReader.Name);
-                       Assert (xmlReader.MoveToNextAttribute ());
-                       AssertEquals ("_2", xmlReader.Name);
-                       Assert (xmlReader.MoveToNextAttribute ());
-                       AssertEquals ("_3", xmlReader.Name);
+                       Assertion.Assert (xmlReader.MoveToFirstAttribute ());
+                       Assertion.AssertEquals ("_1", xmlReader.Name);
+                       Assertion.Assert (xmlReader.MoveToNextAttribute ());
+                       Assertion.AssertEquals ("_2", xmlReader.Name);
+                       Assertion.Assert (xmlReader.MoveToNextAttribute ());
+                       Assertion.AssertEquals ("_3", xmlReader.Name);
 
-                       Assert (!xmlReader.MoveToNextAttribute ());
+                       Assertion.Assert (!xmlReader.MoveToNextAttribute ());
                }
 
-               public void TestFragmentConstructor()
+               [Test]
+               public void FragmentConstructor()
                {
                        XmlDocument doc = new XmlDocument();
 //                     doc.LoadXml("<root/>");
@@ -1764,16 +1798,18 @@ namespace MonoTests.System.Xml
                        AssertEndDocument (xmlReader);
                }
 
-               public void TestAttributeWithCharacterReference ()
+               [Test]
+               public void AttributeWithCharacterReference ()
                {
                        string xml = @"<a value='hello &amp; world' />";
                        XmlReader xmlReader =
                                new XmlTextReader (new StringReader (xml));
                        xmlReader.Read ();
-                       AssertEquals ("hello & world", xmlReader ["value"]);
+                       Assertion.AssertEquals ("hello & world", xmlReader ["value"]);
                }
 
-               public void TestAttributeWithEntityReference ()
+               [Test]
+               public void AttributeWithEntityReference ()
                {
                        string xml = @"<a value='hello &ent; world' />";
                        XmlReader xmlReader =
@@ -1781,32 +1817,33 @@ namespace MonoTests.System.Xml
                        xmlReader.Read ();
                        xmlReader.MoveToFirstAttribute ();
                        xmlReader.ReadAttributeValue ();
-                       AssertEquals ("hello ", xmlReader.Value);
+                       Assertion.AssertEquals ("hello ", xmlReader.Value);
                        xmlReader.ReadAttributeValue ();
-                       AssertEquals (XmlNodeType.EntityReference, xmlReader.NodeType);
-                       AssertEquals ("ent", xmlReader.Name);
-                       AssertEquals (XmlNodeType.EntityReference, xmlReader.NodeType);
+                       Assertion.AssertEquals (XmlNodeType.EntityReference, xmlReader.NodeType);
+                       Assertion.AssertEquals ("ent", xmlReader.Name);
+                       Assertion.AssertEquals (XmlNodeType.EntityReference, xmlReader.NodeType);
                        xmlReader.ReadAttributeValue ();
-                       AssertEquals (" world", xmlReader.Value);
-                       AssertEquals (XmlNodeType.Text, xmlReader.NodeType);
+                       Assertion.AssertEquals (" world", xmlReader.Value);
+                       Assertion.AssertEquals (XmlNodeType.Text, xmlReader.NodeType);
                        xmlReader.ReadAttributeValue ();
-                       AssertEquals (XmlNodeType.None, xmlReader.NodeType);
+                       Assertion.AssertEquals (XmlNodeType.None, xmlReader.NodeType);
                        xmlReader.ReadAttributeValue ();
-                       AssertEquals (XmlNodeType.None, xmlReader.NodeType);
+                       Assertion.AssertEquals (XmlNodeType.None, xmlReader.NodeType);
                }
 
-               public void TestQuoteChar ()
+               [Test]
+               public void QuoteChar ()
                {
                        string xml = @"<a value='hello &amp; world' value2="""" />";
                        XmlReader xmlReader =
                                new XmlTextReader (new StringReader (xml));
                        xmlReader.Read ();
                        xmlReader.MoveToFirstAttribute ();
-                       AssertEquals ("First", '\'', xmlReader.QuoteChar);
+                       Assertion.AssertEquals ("First", '\'', xmlReader.QuoteChar);
                        xmlReader.MoveToNextAttribute ();
-                       AssertEquals ("Next", '"', xmlReader.QuoteChar);
+                       Assertion.AssertEquals ("Next", '"', xmlReader.QuoteChar);
                        xmlReader.MoveToFirstAttribute ();
-                       AssertEquals ("First.Again", '\'', xmlReader.QuoteChar);
+                       Assertion.AssertEquals ("First.Again", '\'', xmlReader.QuoteChar);
                }
        }
 }
index 2e88090e807ce3fceda7c3311956c0d480dfcedb..ab22d16e92591cbdbe623cc9e6a81fe67ec880af 100644 (file)
@@ -1,10 +1,12 @@
 //
 // System.Xml.XmlTextWriterTests
 //
-// Author:
+// Authors:
 //   Kral Ferch <kral_ferch@hotmail.com>
+//   Martin Willemoes Hansen <mwh@sysrq.dk>
 //
 // (C) 2002 Kral Ferch
+// (C) 2003 Martin Willemoes Hansen
 //
 
 using System;
@@ -13,11 +15,9 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class XmlTextTests : TestCase
+       [TestFixture]
+       public class XmlTextTests
        {
-               public XmlTextTests () : base ("MonoTests.System.Xml.XmlTextTests testsuite") {}
-               public XmlTextTests (string name) : base (name) {}
-
                XmlDocument document;
                XmlText text;
                bool inserted;
@@ -27,7 +27,8 @@ namespace MonoTests.System.Xml
                bool removed;
                bool removing;
 
-               protected override void SetUp ()
+               [SetUp]
+               public void GetReady ()
                {
                        document = new XmlDocument ();
                }
@@ -62,14 +63,16 @@ namespace MonoTests.System.Xml
                        removing = true;
                }
 
-               public void TestInnerAndOuterXml ()
+               [Test]
+               public void InnerAndOuterXml ()
                {
                        text = document.CreateTextNode ("&<>\"'");
-                       AssertEquals (String.Empty, text.InnerXml);
-                       AssertEquals ("&amp;&lt;&gt;\"'", text.OuterXml);
+                       Assertion.AssertEquals (String.Empty, text.InnerXml);
+                       Assertion.AssertEquals ("&amp;&lt;&gt;\"'", text.OuterXml);
                }
                
-               public void TestSplitText ()
+               [Test]
+               public void SplitText ()
                {
                        document.LoadXml ("<root>test text.</root>");
                        document.NodeInserted += new XmlNodeChangedEventHandler(EventNodeInserted);
@@ -77,12 +80,12 @@ namespace MonoTests.System.Xml
                        document.NodeRemoved += new XmlNodeChangedEventHandler(EventNodeRemoved);
                        XmlText t = document.DocumentElement.FirstChild as XmlText;
                        t.SplitText (5);
-                       AssertNotNull (t.NextSibling);
-                       AssertEquals ("test ", t.Value);
-                       AssertEquals ("text.", t.NextSibling.Value);
-                       Assert (changed);
-                       Assert (inserted);
-                       Assert (!removed);
+                       Assertion.AssertNotNull (t.NextSibling);
+                       Assertion.AssertEquals ("test ", t.Value);
+                       Assertion.AssertEquals ("text.", t.NextSibling.Value);
+                       Assertion.Assert (changed);
+                       Assertion.Assert (inserted);
+                       Assertion.Assert (!removed);
                }
        }
 }
index 4643fdcbe6c82a7c0b6206b8377805eafdc1a87c..3ae3e274b28d2f437fd78be14980d6de38191d0a 100644 (file)
@@ -1,10 +1,12 @@
 //
 // System.Xml.XmlTextWriterTests
 //
-// Author:
+// Authors:
 //   Kral Ferch <kral_ferch@hotmail.com>
+//   Martin Willemoes Hansen <mwh@sysrq.dk>
 //
 // (C) 2002 Kral Ferch
+// (C) 2003 Martin Willemoes Hansen
 //
 
 using System;
@@ -16,15 +18,14 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class XmlTextWriterTests : TestCase
+       [TestFixture]
+       public class XmlTextWriterTests
        {
-               public XmlTextWriterTests () : base ("MonoTests.System.Xml.XmlTextWriterTests testsuite") {}
-               public XmlTextWriterTests (string name) : base (name) {}
-
                StringWriter sw;
                XmlTextWriter xtw;
 
-               protected override void SetUp ()
+               [SetUp]
+               public void GetReady ()
                {
                        sw = new StringWriter ();
                        xtw = new XmlTextWriter (sw);
@@ -36,30 +37,34 @@ namespace MonoTests.System.Xml
                        get { return sw.GetStringBuilder ().ToString (); }
                }
 
-               public void TestAttributeNamespacesNonNamespaceAttributeBefore ()
+               [Test]
+               public void AttributeNamespacesNonNamespaceAttributeBefore ()
                {
                        xtw.WriteStartElement ("foo");
                        xtw.WriteAttributeString("bar", "baz");
                        xtw.WriteAttributeString ("xmlns", "abc", null, "http://abc.def");
-                       AssertEquals ("<foo bar='baz' xmlns:abc='http://abc.def'", StringWriterText);
+                       Assertion.AssertEquals ("<foo bar='baz' xmlns:abc='http://abc.def'", StringWriterText);
                }
 
-               public void TestAttributeNamespacesNonNamespaceAttributeAfter ()
+               [Test]
+               public void AttributeNamespacesNonNamespaceAttributeAfter ()
                {
                        xtw.WriteStartElement ("foo");
 
                        xtw.WriteAttributeString ("xmlns", "abc", null, "http://abc.def");
                        xtw.WriteAttributeString("bar", "baz");
-                       AssertEquals ("<foo xmlns:abc='http://abc.def' bar='baz'", StringWriterText);
+                       Assertion.AssertEquals ("<foo xmlns:abc='http://abc.def' bar='baz'", StringWriterText);
                }
 
-               public void TestAttributeNamespacesThreeParamWithNullInNamespaceParam ()
+               [Test]
+               public void AttributeNamespacesThreeParamWithNullInNamespaceParam ()
                {
                        xtw.WriteAttributeString ("xmlns", null, "http://abc.def");
-                       AssertEquals ("xmlns='http://abc.def'", StringWriterText);
+                       Assertion.AssertEquals ("xmlns='http://abc.def'", StringWriterText);
                }
 
-               public void TestAttributeNamespacesThreeParamWithTextInNamespaceParam ()
+               [Test]
+               public void AttributeNamespacesThreeParamWithTextInNamespaceParam ()
                {
                        try 
                        {
@@ -68,53 +73,58 @@ namespace MonoTests.System.Xml
                        catch (ArgumentException) {}
                }
 
-               public void TestAttributeNamespacesWithNullInNamespaceParam ()
+               [Test]
+               public void AttributeNamespacesWithNullInNamespaceParam ()
                {
                        xtw.WriteAttributeString ("xmlns", "abc", null, "http://abc.def");
-                       AssertEquals ("xmlns:abc='http://abc.def'", StringWriterText);
+                       Assertion.AssertEquals ("xmlns:abc='http://abc.def'", StringWriterText);
                }
 
-               public void TestAttributeNamespacesWithTextInNamespaceParam ()
+               [Test]
+               public void AttributeNamespacesWithTextInNamespaceParam ()
                {
                        try {
                                xtw.WriteAttributeString ("xmlns", "abc", "http://somenamespace.com", "http://abc.def");
                        } catch (ArgumentException) {}
                }
 
-               public void TestAttributeNamespacesXmlnsXmlns ()
+               [Test]
+               public void AttributeNamespacesXmlnsXmlns ()
                {
                        xtw.WriteStartElement ("foo");
                        try 
                        {
                                xtw.WriteAttributeString ("xmlns", "xmlns", null, "http://abc.def");
-                               Fail ("any prefix which name starts from \"xml\" must not be allowed.");
+                               Assertion.Fail ("any prefix which name starts from \"xml\" must not be allowed.");
                        } 
                        catch (ArgumentException e) {}
                }
 
-               public void TestAttributeWriteAttributeString ()
+               [Test]
+               public void AttributeWriteAttributeString ()
                {
                        xtw.WriteStartElement ("foo");
 
                        xtw.WriteAttributeString ("foo", "bar");
-                       AssertEquals ("<foo foo='bar'", StringWriterText);
+                       Assertion.AssertEquals ("<foo foo='bar'", StringWriterText);
 
                        xtw.WriteAttributeString ("bar", "");
-                       AssertEquals ("<foo foo='bar' bar=''", StringWriterText);
+                       Assertion.AssertEquals ("<foo foo='bar' bar=''", StringWriterText);
 
                        xtw.WriteAttributeString ("baz", null);
-                       AssertEquals ("<foo foo='bar' bar='' baz=''", StringWriterText);
+                       Assertion.AssertEquals ("<foo foo='bar' bar='' baz=''", StringWriterText);
 
                        // TODO: Why does this pass Microsoft?
                        xtw.WriteAttributeString ("", "quux");
-                       AssertEquals ("<foo foo='bar' bar='' baz='' ='quux'", StringWriterText);
+                       Assertion.AssertEquals ("<foo foo='bar' bar='' baz='' ='quux'", StringWriterText);
 
                        // TODO: Why does this pass Microsoft?
                        xtw.WriteAttributeString (null, "quuux");
-                       AssertEquals ("<foo foo='bar' bar='' baz='' ='quux' ='quuux'", StringWriterText);
+                       Assertion.AssertEquals ("<foo foo='bar' bar='' baz='' ='quux' ='quuux'", StringWriterText);
                }
 
-               public void TestAttributeWriteAttributeStringNotInsideOpenStartElement ()
+               [Test]
+               public void AttributeWriteAttributeStringNotInsideOpenStartElement ()
                {
                        xtw.WriteStartElement ("foo");
                        xtw.WriteString ("bar");
@@ -122,45 +132,50 @@ namespace MonoTests.System.Xml
                        try 
                        {
                                xtw.WriteAttributeString ("baz", "quux");
-                               Fail ("Expected an InvalidOperationException to be thrown.");
+                               Assertion.Fail ("Expected an InvalidOperationException to be thrown.");
                        } 
                        catch (InvalidOperationException) {}
                }
 
-               public void TestAttributeWriteAttributeStringWithoutParentElement ()
+               [Test]
+               public void AttributeWriteAttributeStringWithoutParentElement ()
                {
                        xtw.WriteAttributeString ("foo", "bar");
-                       AssertEquals ("foo='bar'", StringWriterText);
+                       Assertion.AssertEquals ("foo='bar'", StringWriterText);
 
                        xtw.WriteAttributeString ("baz", "quux");
-                       AssertEquals ("foo='bar' baz='quux'", StringWriterText);
+                       Assertion.AssertEquals ("foo='bar' baz='quux'", StringWriterText);
                }
 
-               public void TestCDataValid ()
+               [Test]
+               public void CDataValid ()
                {
                        xtw.WriteCData ("foo");
-                       AssertEquals ("WriteCData had incorrect output.", "<![CDATA[foo]]>", StringWriterText);
+                       Assertion.AssertEquals ("WriteCData had incorrect output.", "<![CDATA[foo]]>", StringWriterText);
                }
 
-               public void TestCDataInvalid ()
+               [Test]
+               public void CDataInvalid ()
                {
                        try {
                                xtw.WriteCData("foo]]>bar");
-                               Fail("Should have thrown an ArgumentException.");
+                               Assertion.Fail("Should have thrown an ArgumentException.");
                        } 
                        catch (ArgumentException) { }
                }
 
-               public void TestCloseOpenElements ()
+               [Test]
+               public void CloseOpenElements ()
                {
                        xtw.WriteStartElement("foo");
                        xtw.WriteStartElement("bar");
                        xtw.WriteStartElement("baz");
                        xtw.Close();
-                       AssertEquals ("Close didn't write out end elements properly.", "<foo><bar><baz /></bar></foo>", StringWriterText);
+                       Assertion.AssertEquals ("Close didn't write out end elements properly.", "<foo><bar><baz /></bar></foo>",       StringWriterText);
                }
 
-               public void TestCloseWriteAfter ()
+               [Test]
+               public void CloseWriteAfter ()
                {
                        xtw.WriteElementString ("foo", "bar");
                        xtw.Close ();
@@ -171,79 +186,82 @@ namespace MonoTests.System.Xml
 
                        try {
                                xtw.WriteCData ("foo");
-                               Fail ("WriteCData after Close Should have thrown an InvalidOperationException.");
+                               Assertion.Fail ("WriteCData after Close Should have thrown an InvalidOperationException.");
                        } 
                        catch (InvalidOperationException e) {
-                               AssertEquals ("Exception message is incorrect.", "The Writer is closed.", e.Message);
+                               Assertion.AssertEquals ("Exception message is incorrect.", "The Writer is closed.", e.Message);
                        }
 
                        try {
                                xtw.WriteComment ("foo");
-                               Fail ("WriteComment after Close Should have thrown an InvalidOperationException.");
+                               Assertion.Fail ("WriteComment after Close Should have thrown an InvalidOperationException.");
                        } 
                        catch (InvalidOperationException e) {
-                               AssertEquals ("Exception message is incorrect.", "The Writer is closed.", e.Message);
+                               Assertion.AssertEquals ("Exception message is incorrect.", "The Writer is closed.", e.Message);
                        }
 
                        try {
                                xtw.WriteProcessingInstruction ("foo", "bar");
-                               Fail ("WriteProcessingInstruction after Close Should have thrown an InvalidOperationException.");
+                               Assertion.Fail ("WriteProcessingInstruction after Close Should have thrown an InvalidOperationException.");
                        } 
                        catch (InvalidOperationException e) {
-                               AssertEquals ("Exception message is incorrect.", "The Writer is closed.", e.Message);
+                               Assertion.AssertEquals ("Exception message is incorrect.", "The Writer is closed.", e.Message);
                        }
 
                        try {
                                xtw.WriteStartElement ("foo", "bar", "baz");
-                               Fail ("WriteStartElement after Close Should have thrown an InvalidOperationException.");
+                               Assertion.Fail ("WriteStartElement after Close Should have thrown an InvalidOperationException.");
                        } 
                        catch (InvalidOperationException e) {
-                               AssertEquals ("Exception message is incorrect.", "The Writer is closed.", e.Message);
+                               Assertion.AssertEquals ("Exception message is incorrect.", "The Writer is closed.", e.Message);
                        }
 
                        try 
                        {
                                xtw.WriteAttributeString ("foo", "bar");
-                               Fail ("WriteAttributeString after Close Should have thrown an InvalidOperationException.");
+                               Assertion.Fail ("WriteAttributeString after Close Should have thrown an InvalidOperationException.");
                        } 
                        catch (InvalidOperationException e) 
                        {
-                               AssertEquals ("Exception message is incorrect.", "The Writer is closed.", e.Message);
+                               Assertion.AssertEquals ("Exception message is incorrect.", "The Writer is closed.", e.Message);
                        }
 
                        try {
                                xtw.WriteString ("foo");
-                               Fail ("WriteString after Close Should have thrown an InvalidOperationException.");
+                               Assertion.Fail ("WriteString after Close Should have thrown an InvalidOperationException.");
                        } 
                        catch (InvalidOperationException e) {
-                               AssertEquals ("Exception message is incorrect.", "The Writer is closed.", e.Message);
+                               Assertion.AssertEquals ("Exception message is incorrect.", "The Writer is closed.", e.Message);
                        }
                }
 
-               public void TestCommentValid ()
+               [Test]
+               public void CommentValid ()
                {
                        xtw.WriteComment ("foo");
-                       AssertEquals ("WriteComment had incorrect output.", "<!--foo-->", StringWriterText);
+                       Assertion.AssertEquals ("WriteComment had incorrect output.", "<!--foo-->", StringWriterText);
                }
 
-               public void TestCommentInvalid ()
+               [Test]
+               public void CommentInvalid ()
                {
                        try {
                                xtw.WriteComment("foo-");
-                               Fail("Should have thrown an ArgumentException.");
+                               Assertion.Fail("Should have thrown an ArgumentException.");
                        } 
                        catch (ArgumentException) { }
 
                        try {
                                xtw.WriteComment("foo-->bar");
-                               Fail("Should have thrown an ArgumentException.");
+                               Assertion.Fail("Should have thrown an ArgumentException.");
                        } 
                        catch (ArgumentException) { }
                }
 
-               public void TestConstructorsAndBaseStream ()
+               [Test]
+               public void ConstructorsAndBaseStream ()
                {
-                       Assert ("BaseStream property returned wrong value.", Object.ReferenceEquals (null, this.xtw.BaseStream));
+                       Assertion.Assert ("BaseStream property returned wrong value.", Object.ReferenceEquals (null, this.xtw.BaseStream));
 
                        MemoryStream ms;
                        StreamReader sr;
@@ -257,8 +275,8 @@ namespace MonoTests.System.Xml
                        sr = new StreamReader (ms, Encoding.Unicode);
                        string expectedXmlDeclaration = "<?xml version=\"1.0\" encoding=\"utf-16\"?>";
                        string actualXmlDeclaration = sr.ReadToEnd();
-                       AssertEquals (expectedXmlDeclaration, actualXmlDeclaration);
-                       Assert ("BaseStream property returned wrong value.", Object.ReferenceEquals (ms, xtw.BaseStream));
+                       Assertion.AssertEquals (expectedXmlDeclaration, actualXmlDeclaration);
+                       Assertion.Assert ("BaseStream property returned wrong value.", Object.ReferenceEquals (ms, xtw.BaseStream));
 
                        ms = new MemoryStream ();
                        xtw = new XmlTextWriter (ms, new UnicodeEncoding ());
@@ -266,7 +284,7 @@ namespace MonoTests.System.Xml
                        xtw.Flush ();
                        ms.Seek (0, SeekOrigin.Begin);
                        sr = new StreamReader (ms, Encoding.Unicode);
-                       AssertEquals ("<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?>", sr.ReadToEnd ());
+                       Assertion.AssertEquals ("<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?>", sr.ReadToEnd ());
 
                        ms = new MemoryStream ();
                        xtw = new XmlTextWriter (ms, new UTF8Encoding ());
@@ -274,7 +292,7 @@ namespace MonoTests.System.Xml
                        xtw.Flush ();
                        ms.Seek (0, SeekOrigin.Begin);
                        sr = new StreamReader (ms, Encoding.UTF8);
-                       AssertEquals ("<?xml version=\"1.0\" encoding=\"utf-8\"?>", sr.ReadToEnd ());
+                       Assertion.AssertEquals ("<?xml version=\"1.0\" encoding=\"utf-8\"?>", sr.ReadToEnd ());
 
                        ms = new MemoryStream ();
                        xtw = new XmlTextWriter (ms, null);
@@ -282,7 +300,7 @@ namespace MonoTests.System.Xml
                        xtw.Flush ();
                        ms.Seek (0, SeekOrigin.Begin);
                        sr = new StreamReader (ms, Encoding.UTF8);
-                       AssertEquals ("<?xml version=\"1.0\"?>", sr.ReadToEnd ());
+                       Assertion.AssertEquals ("<?xml version=\"1.0\"?>", sr.ReadToEnd ());
 
                        ms = new MemoryStream ();
                        xtw = new XmlTextWriter (ms, null);
@@ -290,72 +308,77 @@ namespace MonoTests.System.Xml
                        xtw.Flush ();
                        ms.Seek (0, SeekOrigin.Begin);
                        sr = new StreamReader (ms, Encoding.UTF8);
-                       AssertEquals ("<?xml version=\"1.0\" standalone=\"yes\"?>", sr.ReadToEnd ());
-                       Assert ("BaseStream property returned wrong value.", Object.ReferenceEquals (ms, xtw.BaseStream));
+                       Assertion.AssertEquals ("<?xml version=\"1.0\" standalone=\"yes\"?>", sr.ReadToEnd ());
+                       Assertion.Assert ("BaseStream property returned wrong value.", Object.ReferenceEquals (ms, xtw.BaseStream));
                }
 
-               public void TestDocumentStart ()
+               [Test]
+               public void DocumentStart ()
                {
                        xtw.WriteStartDocument ();
-                       AssertEquals ("XmlDeclaration is incorrect.", "<?xml version='1.0' encoding='utf-16'?>", StringWriterText);
+                       Assertion.AssertEquals ("XmlDeclaration is incorrect.", "<?xml version='1.0' encoding='utf-16'?>", StringWriterText);
 
                        try 
                        {
                                xtw.WriteStartDocument ();
-                               Fail("Should have thrown an InvalidOperationException.");
+                               Assertion.Fail("Should have thrown an InvalidOperationException.");
                        } 
                        catch (InvalidOperationException e) {
-                               AssertEquals ("Exception message is incorrect.",
+                               Assertion.AssertEquals ("Exception message is incorrect.",
                                        "WriteStartDocument should be the first call.", e.Message);
                        }
 
                        xtw = new XmlTextWriter (sw = new StringWriter ());
                        xtw.QuoteChar = '\'';
                        xtw.WriteStartDocument (true);
-                       AssertEquals ("<?xml version='1.0' encoding='utf-16' standalone='yes'?>", StringWriterText);
+                       Assertion.AssertEquals ("<?xml version='1.0' encoding='utf-16' standalone='yes'?>", StringWriterText);
 
                        xtw = new XmlTextWriter (sw = new StringWriter ());
                        xtw.QuoteChar = '\'';
                        xtw.WriteStartDocument (false);
-                       AssertEquals ("<?xml version='1.0' encoding='utf-16' standalone='no'?>", StringWriterText);
+                       Assertion.AssertEquals ("<?xml version='1.0' encoding='utf-16' standalone='no'?>", StringWriterText);
                }
 
-               public void TestElementEmpty ()
+               [Test]
+               public void ElementEmpty ()
                {
                        xtw.WriteStartElement ("foo");
                        xtw.WriteEndElement ();
-                       AssertEquals ("Incorrect output.", "<foo />", StringWriterText);
+                       Assertion.AssertEquals ("Incorrect output.", "<foo />", StringWriterText);
                }
 
-               public void TestElementWriteElementString ()
+               [Test]
+               public void ElementWriteElementString ()
                {
                        xtw.WriteElementString ("foo", "bar");
-                       AssertEquals ("WriteElementString has incorrect output.", "<foo>bar</foo>", StringWriterText);
+                       Assertion.AssertEquals ("WriteElementString has incorrect output.", "<foo>bar</foo>", StringWriterText);
 
                        xtw.WriteElementString ("baz", "");
-                       AssertEquals ("<foo>bar</foo><baz />", StringWriterText);
+                       Assertion.AssertEquals ("<foo>bar</foo><baz />", StringWriterText);
 
                        xtw.WriteElementString ("quux", null);
-                       AssertEquals ("<foo>bar</foo><baz /><quux />", StringWriterText);
+                       Assertion.AssertEquals ("<foo>bar</foo><baz /><quux />", StringWriterText);
 
                        xtw.WriteElementString ("", "quuux");
-                       AssertEquals ("<foo>bar</foo><baz /><quux /><>quuux</>", StringWriterText);
+                       Assertion.AssertEquals ("<foo>bar</foo><baz /><quux /><>quuux</>", StringWriterText);
 
                        xtw.WriteElementString (null, "quuuux");
-                       AssertEquals ("<foo>bar</foo><baz /><quux /><>quuux</><>quuuux</>", StringWriterText);
+                       Assertion.AssertEquals ("<foo>bar</foo><baz /><quux /><>quuux</><>quuuux</>", StringWriterText);
                }
 
-               public void TestFormatting ()
+               [Test]
+               public void FormattingTest ()
                {
                        xtw.Formatting = Formatting.Indented;
                        xtw.WriteStartDocument ();
                        xtw.WriteStartElement ("foo");
                        xtw.WriteElementString ("bar", "");
                        xtw.Close ();
-                       AssertEquals ("<?xml version='1.0' encoding='utf-16'?>\r\n<foo>\r\n  <bar />\r\n</foo>", StringWriterText);
+                       Assertion.AssertEquals ("<?xml version='1.0' encoding='utf-16'?>\r\n<foo>\r\n  <bar />\r\n</foo>", StringWriterText);
                }
 
-               public void TestFormattingInvalidXmlForFun ()
+               [Test]
+               public void FormattingInvalidXmlForFun ()
                {
                        xtw.Formatting = Formatting.Indented;
                        xtw.IndentChar = 'x';
@@ -364,10 +387,11 @@ namespace MonoTests.System.Xml
                        xtw.WriteStartElement ("bar");
                        xtw.WriteElementString ("baz", "");
                        xtw.Close ();
-                       AssertEquals ("<?xml version='1.0' encoding='utf-16'?>\r\n<foo>\r\nxx<bar>\r\nxxxx<baz />\r\nxx</bar>\r\n</foo>", StringWriterText);
+                       Assertion.AssertEquals ("<?xml version='1.0' encoding='utf-16'?>\r\n<foo>\r\nxx<bar>\r\nxxxx<baz />\r\nxx</bar>\r\n</foo>", StringWriterText);
                }
 
-               public void TestFormattingFromRemarks ()
+               [Test]
+               public void FormattingFromRemarks ()
                {
                        // Remarks section of on-line help for XmlTextWriter.Formatting suggests this test.
                        xtw.Formatting = Formatting.Indented; 
@@ -379,31 +403,33 @@ namespace MonoTests.System.Xml
                        xtw.WriteString (" walks slowly."); 
                        xtw.WriteEndElement (); 
                        xtw.WriteEndElement ();
-                       AssertEquals ("<ol>\r\n  <li>The big <b>E</b><i>lephant</i> walks slowly.</li>\r\n</ol>", StringWriterText);
+                       Assertion.AssertEquals ("<ol>\r\n  <li>The big <b>E</b><i>lephant</i> walks slowly.</li>\r\n</ol>", StringWriterText);
                }
 
-               public void TestLookupPrefix ()
+               [Test]
+               public void LookupPrefix ()
                {
                        xtw.WriteStartElement ("root");
 
                        xtw.WriteStartElement ("one");
                        xtw.WriteAttributeString ("xmlns", "foo", null, "http://abc.def");
                        xtw.WriteAttributeString ("xmlns", "bar", null, "http://ghi.jkl");
-                       AssertEquals ("foo", xtw.LookupPrefix ("http://abc.def"));
-                       AssertEquals ("bar", xtw.LookupPrefix ("http://ghi.jkl"));
+                       Assertion.AssertEquals ("foo", xtw.LookupPrefix ("http://abc.def"));
+                       Assertion.AssertEquals ("bar", xtw.LookupPrefix ("http://ghi.jkl"));
                        xtw.WriteEndElement ();
 
                        xtw.WriteStartElement ("two");
                        xtw.WriteAttributeString ("xmlns", "baz", null, "http://mno.pqr");
                        xtw.WriteString("quux");
-                       AssertEquals ("baz", xtw.LookupPrefix ("http://mno.pqr"));
-                       AssertNull (xtw.LookupPrefix ("http://abc.def"));
-                       AssertNull (xtw.LookupPrefix ("http://ghi.jkl"));
+                       Assertion.AssertEquals ("baz", xtw.LookupPrefix ("http://mno.pqr"));
+                       Assertion.AssertNull (xtw.LookupPrefix ("http://abc.def"));
+                       Assertion.AssertNull (xtw.LookupPrefix ("http://ghi.jkl"));
 
-                       AssertNull (xtw.LookupPrefix ("http://bogus"));
+                       Assertion.AssertNull (xtw.LookupPrefix ("http://bogus"));
                }
 
-               public void TestNamespacesAttributesPassingInNamespaces ()
+               [Test]
+               public void NamespacesAttributesPassingInNamespaces ()
                {
                        xtw.Namespaces = false;
                        xtw.WriteStartElement ("foo");
@@ -416,13 +442,14 @@ namespace MonoTests.System.Xml
                        xtw.WriteAttributeString ("", "e", null, "f");
                        xtw.WriteAttributeString (null, "g", null, "h");
 
-                       AssertEquals ("<foo bar='baz' a='b' c='d' e='f' g='h'", StringWriterText);
+                       Assertion.AssertEquals ("<foo bar='baz' a='b' c='d' e='f' g='h'", StringWriterText);
 
                        // These should throw ArgumentException because they pass in a
                        // namespace when Namespaces = false.
                }
 
-               public void TestNamespacesElementsPassingInNamespaces ()
+               [Test]
+               public void NamespacesElementsPassingInNamespaces ()
                {
                        xtw.Namespaces = false;
 
@@ -437,128 +464,135 @@ namespace MonoTests.System.Xml
                        xtw.WriteStartElement ("", "c", null);
                        xtw.WriteStartElement ("", "d", "");
 
-                       AssertEquals ("<foo>bar</foo><baz><quux><quuux><a><b><c><d", StringWriterText);
+                       Assertion.AssertEquals ("<foo>bar</foo><baz><quux><quuux><a><b><c><d", StringWriterText);
 
                        // These should throw ArgumentException because they pass in a
                        // namespace when Namespaces = false.
                        try {
                                xtw.WriteElementString ("qux", "http://netsack.com/", String.Empty);
-                               Fail ("Expected an ArgumentException.");
+                               Assertion.Fail ("Expected an ArgumentException.");
                        } catch (ArgumentException) {}
 
                        try {
                                xtw.WriteStartElement ("foo", "http://netsack.com/");
-                               Fail ("Expected an ArgumentException.");
+                               Assertion.Fail ("Expected an ArgumentException.");
                        } catch (ArgumentException) {}
 
                        try {
                                xtw.WriteStartElement ("foo", "bar", "http://netsack.com/");
-                               Fail ("Expected an ArgumentException.");
+                               Assertion.Fail ("Expected an ArgumentException.");
                        } catch (ArgumentException) {}
 
                        try {
                                xtw.WriteStartElement ("foo", "bar", null);
-                               Fail ("Expected an ArgumentException.");
+                               Assertion.Fail ("Expected an ArgumentException.");
                        } catch (ArgumentException) {}
 
                        try {
                                xtw.WriteStartElement ("foo", "bar", "");
-                               Fail ("Expected an ArgumentException.");
+                               Assertion.Fail ("Expected an ArgumentException.");
                        } catch (ArgumentException) {}
 
                        try {
                                xtw.WriteStartElement ("foo", "", "");
-                               Fail ("Expected an ArgumentException.");
+                               Assertion.Fail ("Expected an ArgumentException.");
                        } catch (ArgumentException) {}
                }
 
-               public void TestNamespacesNoNamespaceClearsDefaultNamespace ()
+               [Test]
+               public void NamespacesNoNamespaceClearsDefaultNamespace ()
                {
                        xtw.WriteStartElement(String.Empty, "foo", "http://netsack.com/");
                        xtw.WriteStartElement(String.Empty, "bar", String.Empty);
                        xtw.WriteElementString("baz", String.Empty, String.Empty);
                        xtw.WriteEndElement();
                        xtw.WriteEndElement();
-                       AssertEquals ("XmlTextWriter is incorrectly outputting namespaces.",
+                       Assertion.AssertEquals ("XmlTextWriter is incorrectly outputting namespaces.",
                                "<foo xmlns='http://netsack.com/'><bar xmlns=''><baz /></bar></foo>", StringWriterText);
                }
 
-               public void TestNamespacesPrefix ()
+               [Test]
+               public void NamespacesPrefix ()
                {
                        xtw.WriteStartElement ("foo", "bar", "http://netsack.com/");
                        xtw.WriteStartElement ("foo", "baz", "http://netsack.com/");
                        xtw.WriteElementString ("qux", "http://netsack.com/", String.Empty);
                        xtw.WriteEndElement ();
                        xtw.WriteEndElement ();
-                       AssertEquals ("XmlTextWriter is incorrectly outputting prefixes.",
+                       Assertion.AssertEquals ("XmlTextWriter is incorrectly outputting prefixes.",
                                "<foo:bar xmlns:foo='http://netsack.com/'><foo:baz><foo:qux /></foo:baz></foo:bar>", StringWriterText);
                }
 
-               public void TestNamespacesPrefixWithEmptyAndNullNamespace ()
+               [Test]
+               public void NamespacesPrefixWithEmptyAndNullNamespace ()
                {
                        try {
                                xtw.WriteStartElement ("foo", "bar", "");
-                               Fail ("Should have thrown an ArgumentException.");
+                               Assertion.Fail ("Should have thrown an ArgumentException.");
                        } catch (ArgumentException) {}
 
                        try 
                        {
                                xtw.WriteStartElement ("foo", "bar", null);
-                               Fail ("Should have thrown an ArgumentException.");
+                               Assertion.Fail ("Should have thrown an ArgumentException.");
                        } 
                        catch (ArgumentException) {}
                }
 
-               public void TestNamespacesSettingWhenWriteStateNotStart ()
+               [Test]
+               public void NamespacesSettingWhenWriteStateNotStart ()
                {
                        xtw.WriteStartElement ("foo");
                        try 
                        {
                                xtw.Namespaces = false;
-                               Fail ("Expected an InvalidOperationException.");
+                               Assertion.Fail ("Expected an InvalidOperationException.");
                        } 
                        catch (InvalidOperationException) {}
-                       AssertEquals (true, xtw.Namespaces);
+                       Assertion.AssertEquals (true, xtw.Namespaces);
                }
 
-               public void TestProcessingInstructionValid ()
+               [Test]
+               public void ProcessingInstructionValid ()
                {
                        xtw.WriteProcessingInstruction("foo", "bar");
-                       AssertEquals ("WriteProcessingInstruction had incorrect output.", "<?foo bar?>", StringWriterText);
+                       Assertion.AssertEquals ("WriteProcessingInstruction had incorrect output.", "<?foo bar?>", StringWriterText);
                }
 
-               public void TestProcessingInstructionInvalid ()
+               [Test]
+               public void ProcessingInstructionInvalid ()
                {
                        try 
                        {
                                xtw.WriteProcessingInstruction("fo?>o", "bar");
-                               Fail("Should have thrown an ArgumentException.");
+                               Assertion.Fail("Should have thrown an ArgumentException.");
                        } 
                        catch (ArgumentException) { }
 
                        try 
                        {
                                xtw.WriteProcessingInstruction("foo", "ba?>r");
-                               Fail("Should have thrown an ArgumentException.");
+                               Assertion.Fail("Should have thrown an ArgumentException.");
                        } 
                        catch (ArgumentException) { }
 
                        try 
                        {
                                xtw.WriteProcessingInstruction("", "bar");
-                               Fail("Should have thrown an ArgumentException.");
+                               Assertion.Fail("Should have thrown an ArgumentException.");
                        } 
                        catch (ArgumentException) { }
 
                        try 
                        {
                                xtw.WriteProcessingInstruction(null, "bar");
-                               Fail("Should have thrown an ArgumentException.");
+                               Assertion.Fail("Should have thrown an ArgumentException.");
                        } 
                        catch (ArgumentException) { }
                }
 
-               public void TestQuoteCharDoubleQuote ()
+               [Test]
+               public void QuoteCharDoubleQuote ()
                {
                        xtw.QuoteChar = '"';
 
@@ -568,81 +602,86 @@ namespace MonoTests.System.Xml
                        // namespace declaration
                        xtw.WriteElementString ("foo", "http://netsack.com", "bar");
 
-                       AssertEquals ("<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?><foo xmlns=\"http://netsack.com\">bar</foo>", StringWriterText);
+                       Assertion.AssertEquals ("<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?><foo xmlns=\"http://netsack.com\">bar</foo>", StringWriterText);
 
 
                }
 
-               public void TestQuoteCharInvalid ()
+               [Test]
+               public void QuoteCharInvalid ()
                {
                        try {
                                xtw.QuoteChar = 'x';
-                               Fail ("Should have thrown an ArgumentException.");
+                               Assertion.Fail ("Should have thrown an ArgumentException.");
                        } catch (ArgumentException) {}
                }
 
-               public void TestWriteBase64 ()
+               [Test]
+               public void WriteBase64 ()
                {
                        UTF8Encoding encoding = new UTF8Encoding();
                        byte[] fooBar = encoding.GetBytes("foobar");
                        xtw.WriteBase64 (fooBar, 0, 6);
-                       AssertEquals("Zm9vYmFy", StringWriterText);
+                       Assertion.AssertEquals("Zm9vYmFy", StringWriterText);
 
                        try {
                                xtw.WriteBase64 (fooBar, 3, 6);
-                               Fail ("Expected an Argument Exception to be thrown.");
+                               Assertion.Fail ("Expected an Argument Exception to be thrown.");
                        } catch (ArgumentException) {}
 
                        try {
                                xtw.WriteBase64 (fooBar, -1, 6);
-                               Fail ("Expected an Argument Exception to be thrown.");
+                               Assertion.Fail ("Expected an Argument Exception to be thrown.");
                        } catch (ArgumentOutOfRangeException) {}
 
                        try {
                                xtw.WriteBase64 (fooBar, 3, -1);
-                               Fail ("Expected an Argument Exception to be thrown.");
+                               Assertion.Fail ("Expected an Argument Exception to be thrown.");
                        } catch (ArgumentOutOfRangeException) {}
 
                        try {
                                xtw.WriteBase64 (null, 0, 6);
-                               Fail ("Expected an Argument Exception to be thrown.");
+                               Assertion.Fail ("Expected an Argument Exception to be thrown.");
                        } catch (ArgumentNullException) {}
                }
 
-               public void TestWriteCharEntity ()
+               [Test]
+               public void WriteCharEntity ()
                {
                        xtw.WriteCharEntity ('a');
-                       AssertEquals ("&#x61;", StringWriterText);
+                       Assertion.AssertEquals ("&#x61;", StringWriterText);
 
                        xtw.WriteCharEntity ('A');
-                       AssertEquals ("&#x61;&#x41;", StringWriterText);
+                       Assertion.AssertEquals ("&#x61;&#x41;", StringWriterText);
 
                        xtw.WriteCharEntity ('1');
-                       AssertEquals ("&#x61;&#x41;&#x31;", StringWriterText);
+                       Assertion.AssertEquals ("&#x61;&#x41;&#x31;", StringWriterText);
 
                        xtw.WriteCharEntity ('K');
-                       AssertEquals ("&#x61;&#x41;&#x31;&#x4B;", StringWriterText);
+                       Assertion.AssertEquals ("&#x61;&#x41;&#x31;&#x4B;", StringWriterText);
 
                        try {
                                xtw.WriteCharEntity ((char)0xd800);
                        } catch (ArgumentException) {}
                }
 
-               public void TestWriteEndAttribute ()
+               [Test]
+               public void WriteEndAttribute ()
                {
                        try 
                        {
                                xtw.WriteEndAttribute ();
-                               Fail ("Should have thrown an InvalidOperationException.");
+                               Assertion.Fail ("Should have thrown an InvalidOperationException.");
                        }
                        catch (InvalidOperationException) {}
                }
 
-               public void TestWriteEndDocument ()
+               [Test]
+               public void WriteEndDocument ()
                {
                        try {
                                xtw.WriteEndDocument ();
-                               Fail ("Expected an ArgumentException.");
+                               Assertion.Fail ("Expected an ArgumentException.");
                        } catch (ArgumentException) {}
 
                        xtw.WriteStartDocument ();
@@ -650,91 +689,97 @@ namespace MonoTests.System.Xml
                        try 
                        {
                                xtw.WriteEndDocument ();
-                               Fail ("Expected an ArgumentException.");
+                               Assertion.Fail ("Expected an ArgumentException.");
                        } 
                        catch (ArgumentException) {}
 
                        xtw.WriteStartElement ("foo");
                        xtw.WriteStartAttribute ("bar", null);
-                       AssertEquals ("<?xml version='1.0' encoding='utf-16'?><foo bar='", StringWriterText);
+                       Assertion.AssertEquals ("<?xml version='1.0' encoding='utf-16'?><foo bar='", StringWriterText);
 
                        xtw.WriteEndDocument ();
-                       AssertEquals ("<?xml version='1.0' encoding='utf-16'?><foo bar='' />", StringWriterText);
-                       AssertEquals (WriteState.Start, xtw.WriteState);
+                       Assertion.AssertEquals ("<?xml version='1.0' encoding='utf-16'?><foo bar='' />", StringWriterText);
+                       Assertion.AssertEquals (WriteState.Start, xtw.WriteState);
                }
 
-               public void TestWriteEndElement ()
+               [Test]
+               public void WriteEndElement ()
                {
                        try {
                                xtw.WriteEndElement ();
-                               Fail ("Should have thrown an InvalidOperationException.");
+                               Assertion.Fail ("Should have thrown an InvalidOperationException.");
                        } catch (InvalidOperationException e) {
-                               AssertEquals ("Exception message is incorrect.", "There was no XML start tag open.", e.Message);
+                               Assertion.AssertEquals ("Exception message is incorrect.", "There was no XML start tag open.", e.Message);
                        }
 
                        xtw.WriteStartElement ("foo");
                        xtw.WriteEndElement ();
-                       AssertEquals ("<foo />", StringWriterText);
+                       Assertion.AssertEquals ("<foo />", StringWriterText);
 
                        xtw.WriteStartElement ("bar");
                        xtw.WriteStartAttribute ("baz", null);
                        xtw.WriteEndElement ();
-                       AssertEquals ("<foo /><bar baz='' />", StringWriterText);
+                       Assertion.AssertEquals ("<foo /><bar baz='' />", StringWriterText);
                }
 
-               public void TestFullEndElement ()
+               [Test]
+               public void FullEndElement ()
                {
                        xtw.WriteStartElement ("foo");
                        xtw.WriteFullEndElement ();
-                       AssertEquals ("<foo></foo>", StringWriterText);
+                       Assertion.AssertEquals ("<foo></foo>", StringWriterText);
 
                        xtw.WriteStartElement ("bar");
                        xtw.WriteAttributeString ("foo", "bar");
                        xtw.WriteFullEndElement ();
-                       AssertEquals ("<foo></foo><bar foo='bar'></bar>", StringWriterText);
+                       Assertion.AssertEquals ("<foo></foo><bar foo='bar'></bar>", StringWriterText);
 
                        xtw.WriteStartElement ("baz");
                        xtw.WriteStartAttribute ("bar", null);
                        xtw.WriteFullEndElement ();
-                       AssertEquals ("<foo></foo><bar foo='bar'></bar><baz bar=''></baz>", StringWriterText);
+                       Assertion.AssertEquals ("<foo></foo><bar foo='bar'></bar><baz bar=''></baz>", StringWriterText);
                }
 
-               public void TestWriteRaw ()
+               [Test]
+               public void WriteRaw ()
                {
                        xtw.WriteRaw("&<>\"'");
-                       AssertEquals ("&<>\"'", StringWriterText);
+                       Assertion.AssertEquals ("&<>\"'", StringWriterText);
 
                        xtw.WriteRaw(null);
-                       AssertEquals ("&<>\"'", StringWriterText);
+                       Assertion.AssertEquals ("&<>\"'", StringWriterText);
 
                        xtw.WriteRaw("");
-                       AssertEquals ("&<>\"'", StringWriterText);
+                       Assertion.AssertEquals ("&<>\"'", StringWriterText);
                }
 
-               public void TestWriteRawInvalidInAttribute ()
+               [Test]
+               public void WriteRawInvalidInAttribute ()
                {
                        xtw.WriteStartElement ("foo");
                        xtw.WriteStartAttribute ("bar", null);
                        xtw.WriteRaw ("&<>\"'");
                        xtw.WriteEndAttribute ();
                        xtw.WriteEndElement ();
-                       AssertEquals ("<foo bar='&<>\"'' />", StringWriterText);
+                       Assertion.AssertEquals ("<foo bar='&<>\"'' />", StringWriterText);
                }
 
-               public void TestWriteState ()
+               [Test]
+               public void WriteStateTest ()
                {
-                       AssertEquals (WriteState.Start, xtw.WriteState);
+                       Assertion.AssertEquals (WriteState.Start, xtw.WriteState);
                        xtw.WriteStartDocument ();
-                       AssertEquals (WriteState.Prolog, xtw.WriteState);
+                       Assertion.AssertEquals (WriteState.Prolog, xtw.WriteState);
                        xtw.WriteStartElement ("root");
-                       AssertEquals (WriteState.Element, xtw.WriteState);
+                       Assertion.AssertEquals (WriteState.Element, xtw.WriteState);
                        xtw.WriteElementString ("foo", "bar");
-                       AssertEquals (WriteState.Content, xtw.WriteState);
+                       Assertion.AssertEquals (WriteState.Content, xtw.WriteState);
                        xtw.Close ();
-                       AssertEquals (WriteState.Closed, xtw.WriteState);
+                       Assertion.AssertEquals (WriteState.Closed, xtw.WriteState);
                }
 
-               public void TestWriteString ()
+               [Test]
+               public void WriteString ()
                {
                        xtw.WriteStartDocument ();
                        try {
@@ -745,20 +790,22 @@ namespace MonoTests.System.Xml
 
                        xtw.WriteStartElement ("foo");
                        xtw.WriteAttributeString ("bar", "&<>");
-                       AssertEquals ("<?xml version='1.0' encoding='utf-16'?><foo bar='&amp;&lt;&gt;'", StringWriterText);
+                       Assertion.AssertEquals ("<?xml version='1.0' encoding='utf-16'?><foo bar='&amp;&lt;&gt;'", StringWriterText);
                }
 
-               public void TestWriteAttributeStringSingleQuoteChar()
+               [Test]
+               public void WriteAttributeStringSingleQuoteChar()
                {
                        // When QuoteChar is single quote then replaces single quotes within attributes
                        // but not double quotes.
                        xtw.WriteStartElement ("foo");
                        xtw.WriteAttributeString ("bar", "\"baz\"");
                        xtw.WriteAttributeString ("quux", "'baz'");
-                       AssertEquals ("<foo bar='\"baz\"' quux='&apos;baz&apos;'", StringWriterText);
+                       Assertion.AssertEquals ("<foo bar='\"baz\"' quux='&apos;baz&apos;'", StringWriterText);
                }
 
-               public void TestWriteAttributeStringDoubleQuoteChar()
+               [Test]
+               public void WriteAttributeStringDoubleQuoteChar()
                {
                        // When QuoteChar is double quote then replaces double quotes within attributes
                        // but not single quotes.
@@ -766,109 +813,112 @@ namespace MonoTests.System.Xml
                        xtw.WriteStartElement ("foo");
                        xtw.WriteAttributeString ("bar", "\"baz\"");
                        xtw.WriteAttributeString ("quux", "'baz'");
-                       AssertEquals ("<foo bar=\"&quot;baz&quot;\" quux=\"'baz'\"", StringWriterText);
+                       Assertion.AssertEquals ("<foo bar=\"&quot;baz&quot;\" quux=\"'baz'\"", StringWriterText);
                }
 
-               public void TestWriteStringWithEntities()
+               [Test]
+               public void WriteStringWithEntities()
                {
                        // Testing element values
                        xtw.QuoteChar = '\'';
                        xtw.WriteElementString ("foo", "&<>\"'");
-                       AssertEquals ("<foo>&amp;&lt;&gt;\"'</foo>", StringWriterText);
+                       Assertion.AssertEquals ("<foo>&amp;&lt;&gt;\"'</foo>", StringWriterText);
                }
 
-               public void TestXmlLang ()
+               [Test]
+               public void XmlLang ()
                {
-                       AssertNull (xtw.XmlLang);
+                       Assertion.AssertNull (xtw.XmlLang);
                        
                        xtw.WriteStartElement ("foo");
                        xtw.WriteAttributeString ("xml", "lang", null, "langfoo");
-                       AssertEquals ("langfoo", xtw.XmlLang);
-                       AssertEquals ("<foo xml:lang='langfoo'", StringWriterText);
+                       Assertion.AssertEquals ("langfoo", xtw.XmlLang);
+                       Assertion.AssertEquals ("<foo xml:lang='langfoo'", StringWriterText);
 
                        xtw.WriteAttributeString ("boo", "yah");
-                       AssertEquals ("langfoo", xtw.XmlLang);
-                       AssertEquals ("<foo xml:lang='langfoo' boo='yah'", StringWriterText);
+                       Assertion.AssertEquals ("langfoo", xtw.XmlLang);
+                       Assertion.AssertEquals ("<foo xml:lang='langfoo' boo='yah'", StringWriterText);
                        
                        xtw.WriteElementString("bar", "baz");
-                       AssertEquals ("langfoo", xtw.XmlLang);
-                       AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>", StringWriterText);
+                       Assertion.AssertEquals ("langfoo", xtw.XmlLang);
+                       Assertion.AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>", StringWriterText);
                        
                        xtw.WriteString("baz");
-                       AssertEquals ("langfoo", xtw.XmlLang);
-                       AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz", StringWriterText);
+                       Assertion.AssertEquals ("langfoo", xtw.XmlLang);
+                       Assertion.AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz", StringWriterText);
                        
                        xtw.WriteStartElement ("quux");
                        xtw.WriteStartAttribute ("xml", "lang", null);
-                       AssertEquals ("langfoo", xtw.XmlLang);
-                       AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='", StringWriterText);
+                       Assertion.AssertEquals ("langfoo", xtw.XmlLang);
+                       Assertion.AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='", StringWriterText);
                        
                        xtw.WriteString("langbar");
-                       AssertEquals ("langfoo", xtw.XmlLang);
-                       AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='", StringWriterText);
+                       Assertion.AssertEquals ("langfoo", xtw.XmlLang);
+                       Assertion.AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='", StringWriterText);
                        
                        xtw.WriteEndAttribute ();
-                       AssertEquals ("langbar", xtw.XmlLang);
-                       AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='langbar'", StringWriterText);
+                       Assertion.AssertEquals ("langbar", xtw.XmlLang);
+                       Assertion.AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='langbar'", StringWriterText);
 
                        // check if xml:lang repeats output even if same as current scope.
                        xtw.WriteStartElement ("joe");
                        xtw.WriteAttributeString ("xml", "lang", null, "langbar");
-                       AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='langbar'><joe xml:lang='langbar'", StringWriterText);
+                       Assertion.AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='langbar'><joe xml:lang='langbar'", StringWriterText);
 
                        
                        xtw.WriteElementString ("quuux", "squonk");
-                       AssertEquals ("langbar", xtw.XmlLang);
-                       AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='langbar'><joe xml:lang='langbar'><quuux>squonk</quuux>", StringWriterText);
+                       Assertion.AssertEquals ("langbar", xtw.XmlLang);
+                       Assertion.AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='langbar'><joe xml:lang='langbar'><quuux>squonk</quuux>", StringWriterText);
 
                        xtw.WriteEndElement ();
                        xtw.WriteEndElement ();
-                       AssertEquals ("langfoo", xtw.XmlLang);
-                       AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='langbar'><joe xml:lang='langbar'><quuux>squonk</quuux></joe></quux>", StringWriterText);
+                       Assertion.AssertEquals ("langfoo", xtw.XmlLang);
+                       Assertion.AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='langbar'><joe xml:lang='langbar'><quuux>squonk</quuux></joe></quux>", StringWriterText);
                        
                        xtw.WriteEndElement ();
-                       AssertNull (xtw.XmlLang);
-                       AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='langbar'><joe xml:lang='langbar'><quuux>squonk</quuux></joe></quux></foo>", StringWriterText);
+                       Assertion.AssertNull (xtw.XmlLang);
+                       Assertion.AssertEquals ("<foo xml:lang='langfoo' boo='yah'><bar>baz</bar>baz<quux xml:lang='langbar'><joe xml:lang='langbar'><quuux>squonk</quuux></joe></quux></foo>", StringWriterText);
                        
                        xtw.Close ();
-                       AssertNull (xtw.XmlLang);
+                       Assertion.AssertNull (xtw.XmlLang);
                }
 
                // TODO: test operational aspects
-               public void TestXmlSpace ()
+               [Test]
+               public void XmlSpaceTest ()
                {
                        xtw.WriteStartElement ("foo");
-                       AssertEquals (XmlSpace.None, xtw.XmlSpace);
+                       Assertion.AssertEquals (XmlSpace.None, xtw.XmlSpace);
 
                        xtw.WriteStartElement ("bar");
                        xtw.WriteAttributeString ("xml", "space", null, "preserve");
-                       AssertEquals (XmlSpace.Preserve, xtw.XmlSpace);
-                       AssertEquals ("<foo><bar xml:space='preserve'", StringWriterText);
+                       Assertion.AssertEquals (XmlSpace.Preserve, xtw.XmlSpace);
+                       Assertion.AssertEquals ("<foo><bar xml:space='preserve'",       StringWriterText);
 
                        xtw.WriteStartElement ("baz");
                        xtw.WriteAttributeString ("xml", "space", null, "preserve");
-                       AssertEquals (XmlSpace.Preserve, xtw.XmlSpace);
-                       AssertEquals ("<foo><bar xml:space='preserve'><baz xml:space='preserve'", StringWriterText);
+                       Assertion.AssertEquals (XmlSpace.Preserve, xtw.XmlSpace);
+                       Assertion.AssertEquals ("<foo><bar xml:space='preserve'><baz xml:space='preserve'", StringWriterText);
 
                        xtw.WriteStartElement ("quux");
                        xtw.WriteStartAttribute ("xml", "space", null);
-                       AssertEquals (XmlSpace.Preserve, xtw.XmlSpace);
-                       AssertEquals ("<foo><bar xml:space='preserve'><baz xml:space='preserve'><quux xml:space='", StringWriterText);
+                       Assertion.AssertEquals (XmlSpace.Preserve, xtw.XmlSpace);
+                       Assertion.AssertEquals ("<foo><bar xml:space='preserve'><baz xml:space='preserve'><quux xml:space='", StringWriterText);
 
                        xtw.WriteString ("default");
-                       AssertEquals (XmlSpace.Preserve, xtw.XmlSpace);
-                       AssertEquals ("<foo><bar xml:space='preserve'><baz xml:space='preserve'><quux xml:space='", StringWriterText);
+                       Assertion.AssertEquals (XmlSpace.Preserve, xtw.XmlSpace);
+                       Assertion.AssertEquals ("<foo><bar xml:space='preserve'><baz xml:space='preserve'><quux xml:space='", StringWriterText);
                        
                        xtw.WriteEndAttribute ();
-                       AssertEquals (XmlSpace.Default, xtw.XmlSpace);
-                       AssertEquals ("<foo><bar xml:space='preserve'><baz xml:space='preserve'><quux xml:space='default'", StringWriterText);
+                       Assertion.AssertEquals (XmlSpace.Default, xtw.XmlSpace);
+                       Assertion.AssertEquals ("<foo><bar xml:space='preserve'><baz xml:space='preserve'><quux xml:space='default'", StringWriterText);
 
                        xtw.WriteEndElement ();
-                       AssertEquals (XmlSpace.Preserve, xtw.XmlSpace);
+                       Assertion.AssertEquals (XmlSpace.Preserve, xtw.XmlSpace);
                        xtw.WriteEndElement ();
-                       AssertEquals (XmlSpace.Preserve, xtw.XmlSpace);
+                       Assertion.AssertEquals (XmlSpace.Preserve, xtw.XmlSpace);
                        xtw.WriteEndElement ();
-                       AssertEquals (XmlSpace.None, xtw.XmlSpace);
+                       Assertion.AssertEquals (XmlSpace.None, xtw.XmlSpace);
 
                        xtw.WriteStartElement ("quux");
                        try {
@@ -892,23 +942,25 @@ namespace MonoTests.System.Xml
                        } catch (ArgumentException) { }
                }
 
-               public void TestXmlSpaceRaw ()
+               [Test]
+               public void XmlSpaceRaw ()
                {
                        xtw.WriteStartElement ("foo");
                        xtw.WriteStartAttribute ("xml", "space", null);
-                       AssertEquals (XmlSpace.None, xtw.XmlSpace);
-                       AssertEquals ("<foo xml:space='", StringWriterText);
+                       Assertion.AssertEquals (XmlSpace.None, xtw.XmlSpace);
+                       Assertion.AssertEquals ("<foo xml:space='", StringWriterText);
 
                        xtw.WriteString ("default");
-                       AssertEquals (XmlSpace.None, xtw.XmlSpace);
-                       AssertEquals ("<foo xml:space='", StringWriterText);
+                       Assertion.AssertEquals (XmlSpace.None, xtw.XmlSpace);
+                       Assertion.AssertEquals ("<foo xml:space='", StringWriterText);
 
                        xtw.WriteEndAttribute ();
-                       AssertEquals (XmlSpace.Default, xtw.XmlSpace);
-                       AssertEquals ("<foo xml:space='default'", StringWriterText);
+                       Assertion.AssertEquals (XmlSpace.Default, xtw.XmlSpace);
+                       Assertion.AssertEquals ("<foo xml:space='default'", StringWriterText);
                }
 
-               public void TestWriteAttributes ()
+               [Test]
+               public void WriteAttributes ()
                {
                        XmlDocument doc = new XmlDocument();
                        StringWriter sw = new StringWriter();
@@ -920,7 +972,7 @@ namespace MonoTests.System.Xml
                        xtr.Read();     // read XMLDecl
                        wr.WriteAttributes(xtr, false);
                        // This method don't always have to take this double-quoted style...
-                       AssertEquals("#WriteAttributes.XmlDecl.1", "version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"", sw.ToString().Trim());
+                       Assertion.AssertEquals("#WriteAttributes.XmlDecl.1", "version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"", sw.ToString().Trim());
 
                        sb.Remove(0, sb.Length);        // init
                        ctx = new XmlParserContext(doc.NameTable, new XmlNamespaceManager(doc.NameTable), "", XmlSpace.Default);
@@ -928,7 +980,7 @@ namespace MonoTests.System.Xml
                        xtr.Read();     // read XMLDecl
                        wr.WriteAttributes(xtr, false);
                        // This method don't always have to take this double-quoted style...
-                       AssertEquals("#WriteAttributes.XmlDecl.2", "version=\"1.0\" standalone=\"no\"", sw.ToString().Trim());
+                       Assertion.AssertEquals("#WriteAttributes.XmlDecl.2", "version=\"1.0\" standalone=\"no\"", sw.ToString().Trim());
 
                        sb.Remove(0, sb.Length);        // init
                        xtr.Read();     // read root
@@ -937,7 +989,7 @@ namespace MonoTests.System.Xml
                        wr.WriteEndElement();
                        wr.Close();
                        // This method don't always have to take this double-quoted style...
-                       AssertEquals("#WriteAttributes.Element", "<root a1=\"A\" b2=\"B\" c3=\"C\" />", sw.ToString().Trim());
+                       Assertion.AssertEquals("#WriteAttributes.Element", "<root a1=\"A\" b2=\"B\" c3=\"C\" />", sw.ToString().Trim());
                }
        }
 }
index f114356b372efec818aff0e7c66d812dda5ce862..860dfb7e645234a2c10d710252de51055b82f494 100755 (executable)
@@ -1,10 +1,12 @@
 //
 // System.Xml.XmlWhitespaceTests.cs
 //
-// Author:
+// Authors:
 //     Duncan Mak  (duncan@ximian.com)
+//      Martin Willemoes Hansen (mwh@sysrq.dk)
 //
 // (C) Ximian, Inc.
+// (C) 2003 Martin Willemoes Hansen
 //
 
 using System;
@@ -14,7 +16,8 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Xml
 {
-       public class XmlWhitespaceTests : TestCase
+       [TestFixture]
+       public class XmlWhiteSpaceTests
        {
                XmlDocument document;
                XmlDocument doc2;
@@ -24,10 +27,8 @@ namespace MonoTests.System.Xml
                XmlNode deep;
                XmlNode shallow;
                
-               public XmlWhitespaceTests () : base ("MonoTests.System.Xml.XmlWhitespaceTests testsuite") {}
-               public XmlWhitespaceTests (string name) : base (name) {}
-
-               protected override void SetUp ()
+               [SetUp]
+               public void GetReady ()
                {
                        document = new XmlDocument ();
                        document.LoadXml ("<root><foo></foo></root>");
@@ -39,25 +40,27 @@ namespace MonoTests.System.Xml
                        doc2.PreserveWhitespace = true;
                }
 
-               public void TestInnerAndOuterXml ()
+               [Test]
+               public void InnerAndOuterXml ()
                {
                        whitespace = doc2.CreateWhitespace ("\r\n\t ");
-                       AssertEquals (String.Empty, whitespace.InnerXml);
-                       AssertEquals ("\r\n\t ", whitespace.OuterXml);
+                       Assertion.AssertEquals (String.Empty, whitespace.InnerXml);
+                       Assertion.AssertEquals ("\r\n\t ", whitespace.OuterXml);
                }
                        
-               internal void TestXmlNodeBaseProperties (XmlNode original, XmlNode cloned)
+               internal void XmlNodeBaseProperties (XmlNode original, XmlNode cloned)
                {
 //                     assertequals (original.nodetype + " was incorrectly cloned.",
 //                                   original.baseuri, cloned.baseuri);                        
-                       AssertNull (cloned.ParentNode);
-                       AssertEquals ("Value incorrectly cloned",
+                       Assertion.AssertNull (cloned.ParentNode);
+                       Assertion.AssertEquals ("Value incorrectly cloned",
                                       cloned.Value, original.Value);
                        
-                        Assert ("Copies, not pointers", !Object.ReferenceEquals (original,cloned));
+                        Assertion.Assert ("Copies, not pointers", !Object.ReferenceEquals (original,cloned));
                }
 
-               public void TestXmlWhitespaceBadConstructor ()
+               [Test]
+               public void XmlWhitespaceBadConstructor ()
                {
                        try {
                                broken = document.CreateWhitespace ("black");                           
@@ -66,52 +69,57 @@ namespace MonoTests.System.Xml
                                return;
 
                        } catch (Exception) {
-                               Fail ("Incorrect Exception thrown.");
+                               Assertion.Fail ("Incorrect Exception thrown.");
                        }
                }
 
-               public void TestXmlWhitespaceConstructor ()
+               [Test]
+               public void XmlWhitespaceConstructor ()
                {
-                       AssertEquals ("whitespace char didn't get copied right",
+                       Assertion.AssertEquals ("whitespace char didn't get copied right",
                                      "\r\n", whitespace.Data);
                }
-               
-              
-               public void TestXmlWhitespaceName ()
+                              
+               [Test]
+               public void XmlWhitespaceName ()
                {
-                       AssertEquals (whitespace.NodeType + " Name property broken",
+                       Assertion.AssertEquals (whitespace.NodeType + " Name property broken",
                                      whitespace.Name, "#whitespace");
                }
 
-               public void TestXmlWhitespaceLocalName ()
+               [Test]
+               public void XmlWhitespaceLocalName ()
                {
-                       AssertEquals (whitespace.NodeType + " LocalName property broken",
+                       Assertion.AssertEquals (whitespace.NodeType + " LocalName property broken",
                                      whitespace.LocalName, "#whitespace");
                }
 
-               public void TestXmlWhitespaceNodeType ()
+               [Test]
+               public void XmlWhitespaceNodeType ()
                {
-                       AssertEquals ("XmlWhitespace NodeType property broken",
+                       Assertion.AssertEquals ("XmlWhitespace NodeType property broken",
                                      whitespace.NodeType.ToString (), "Whitespace");
                }
 
-               public void TestXmlWhitespaceIsReadOnly ()
+               [Test]
+               public void XmlWhitespaceIsReadOnly ()
                {
-                       AssertEquals ("XmlWhitespace IsReadOnly property broken",
+                       Assertion.AssertEquals ("XmlWhitespace IsReadOnly property broken",
                                      whitespace.IsReadOnly, false);
                }
 
-               public void TestXmlWhitespaceCloneNode ()
+               [Test]
+               public void XmlWhitespaceCloneNode ()
                {
                        original = whitespace;
 
                        shallow = whitespace.CloneNode (false); // shallow
-                       TestXmlNodeBaseProperties (original, shallow);
+                       XmlNodeBaseProperties (original, shallow);
                                                
                        deep = whitespace.CloneNode (true); // deep
-                       TestXmlNodeBaseProperties (original, deep);                     
+                       XmlNodeBaseProperties (original, deep);                 
 
-                        AssertEquals ("deep cloning differs from shallow cloning",
+                        Assertion.AssertEquals ("deep cloning differs from shallow cloning",
                                      deep.OuterXml, shallow.OuterXml);
                }
        }
index f2fc1cbf2dd77256dc5c008b22c2ca44f06f01b8..176d06b1006360b57f87425122fff31e69a2e0b5 100644 (file)
@@ -1,17 +1,17 @@
 //\r
 // System.Xml.XmlTextWriterTests\r
 //\r
-// Author:\r
+// Authors:\r
 //   Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>\r
+//   Martin Willemoes Hansen <mwh@sysrq.dk>\r
 //\r
 // (C) 2003 Atsushi Enomoto\r
+// (C) 2003 Martin Willemoes Hansen\r
 //\r
 //\r
 //  This class mainly checks inheritance and behaviors of XmlWriter.\r
 //\r
 \r
-\r
-\r
 using System;\r
 using System.IO;\r
 using System.Text;\r
@@ -21,30 +21,25 @@ using NUnit.Framework;
 \r
 namespace MonoTests.System.Xml\r
 {\r
-       public class XmlWriterTests : TestCase\r
+       [TestFixture]\r
+       public class XmlWriterTests\r
        {\r
-               public XmlWriterTests () : base ("MonoTests.System.Xml.XmlWriterTests testsuite") {}\r
-               public XmlWriterTests (string name) : base (name) {}\r
-\r
-               protected override void SetUp ()\r
-               {\r
-               }\r
-\r
                // MS.NET's not-overriden XmlWriter.WriteStartElement(name)\r
                // invokes WriteStartElement(null, name, null). \r
                // WriteStartElement(name, ns) invokes (null, name, ns), too.\r
-               public void TestStartElement ()\r
+               [Test]\r
+               public void StartElement ()\r
                {\r
                        StartElementTestWriter xw = new StartElementTestWriter ();\r
                        xw.WriteStartDocument ();\r
                        xw.WriteStartElement ("test");\r
-                       AssertEquals ("StartElementOverride.NS", null, xw.NS);\r
-                       AssertEquals ("StartElementOverride.Prefix", null, xw.Prefix);\r
+                       Assertion.AssertEquals ("StartElementOverride.NS", null, xw.NS);\r
+                       Assertion.AssertEquals ("StartElementOverride.Prefix", null, xw.Prefix);\r
                        xw.NS = String.Empty;\r
                        xw.Prefix = String.Empty;\r
                        xw.WriteStartElement ("test", "urn:hoge");\r
-                       AssertEquals ("StartElementOverride.NS", "urn:hoge", xw.NS);\r
-                       AssertEquals ("StartElementOverride.Prefix", null, xw.Prefix);\r
+                       Assertion.AssertEquals ("StartElementOverride.NS", "urn:hoge", xw.NS);\r
+                       Assertion.AssertEquals ("StartElementOverride.Prefix", null, xw.Prefix);\r
                }\r
                \r
                class StartElementTestWriter : DefaultXmlWriter\r
index 814499ffe701962dca77a69c9202f30c688d19ee..1a6be28c47e0f594cb9d0fe7d08e3598aa09a6aa 100644 (file)
@@ -3,20 +3,25 @@ topdir = ../../..
 LIBRARY = System.XML_linux_test.dll
 
 LIB_LIST = System.XML_linux_test.args
-LIB_FLAGS = \
-       -r $(topdir)/class/lib/corlib.dll       \
-       -r $(topdir)/class/lib/System.Xml.dll   \
-       -r $(topdir)/class/lib/NUnitCore_mono.dll
+LIB_FLAGS =    \
+               -r $(topdir)/class/lib/corlib.dll       \
+               -r $(topdir)/class/lib/System.Xml.dll   \
+               -r $(topdir)/nunit20/NUnit.Framework.dll
 
-SOURCES_INCLUDE = *.cs
-SOURCES_EXCLUDE = ./TheTests.cs
+ifdef SUBDIR
+USE_SOURCE_RULES=1
+SOURCES_INCLUDE=./$(SUBDIR)/*.cs
+SOURCES_EXCLUDE=./TheTests.cs
+endif
 
 include $(topdir)/class/library.make
 
-MCS_FLAGS = --target library --noconfig
+NUNITCONSOLE=$(topdir)/nunit20/nunit-console.exe
+MONO_PATH = $(topdir)/nunit20:.
 
-TEST_SUITE_PREFIX = MonoTests.System.Xml.
-TEST_SUITE = AllTests
+test: $(LIBRARY) run_test
 
-test: $(LIBRARY)
-       -MONO_PATH=$(MONO_PATH) mono $(topdir)/class/lib/NUnitConsole_mono.exe $(TEST_SUITE_PREFIX)$(TEST_SUITE),System.XML_linux_test.dll
+.PHONY: run_test
+
+run_test:
+       -MONO_PATH=$(MONO_PATH) mono --debug $(NUNITCONSOLE) $(LIBRARY)