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);
     }
 }
Esempio n. 2
0
		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);
			}
		}