using System;
-using System.Xml;\r
+using System.Xml;
using NUnit.Framework;
namespace MonoTests
-{\r
+{
public class XmlComparer
{
[Flags]
public string Expected
{
get { return _expected; }
- }\r
-\r
- public static void AssertAreEqual (string expected, string actual) {\r
- AssertAreEqual (expected, actual, String.Empty);\r
- }\r
-\r
- public static void AssertAreEqual (string expected, string actual, string msg) {\r
-\r
- try {\r
- XmlDocument or = new XmlDocument ();\r
- or.LoadXml (expected);\r
- XmlDocument dr = new XmlDocument ();\r
- dr.LoadXml (actual);\r
- XmlComparer comparer = new XmlComparer ();\r
- if (!comparer.AreEqual (or, dr))\r
- Assert.AreEqual (comparer.Expected, comparer.Actual, msg);\r
- }\r
- catch (AssertionException) {\r
- throw;\r
- }\r
- catch (Exception e) {\r
- //swallow e when there is XML error and fallback\r
- //to the text comparison\r
- Assert.AreEqual (expected, actual, msg);\r
- }\r
+ }
+
+ public static void AssertAreEqual (string expected, string actual) {
+ AssertAreEqual (expected, actual, String.Empty);
+ }
+
+ public static void AssertAreEqual (string expected, string actual, string msg) {
+
+ try {
+ XmlDocument or = new XmlDocument ();
+ or.LoadXml (expected);
+ XmlDocument dr = new XmlDocument ();
+ dr.LoadXml (actual);
+ XmlComparer comparer = new XmlComparer ();
+ if (!comparer.AreEqual (or, dr))
+ Assert.AreEqual (comparer.Expected, comparer.Actual, msg);
+ }
+ catch (AssertionException) {
+ throw;
+ }
+ catch (Exception e) {
+ //swallow e when there is XML error and fallback
+ //to the text comparison
+ Assert.AreEqual (expected, actual, msg);
+ }
}
}
}