What is the best way to compare XML files for equality?

前端 未结 7 1295
春和景丽
春和景丽 2020-12-20 12:59

I\'m using .NET 2.0, and a recent code change has invalidated my previous Assert.AreEqual call (which compared two strings of XML). Only one element of the XML is actually

7条回答
  •  孤城傲影
    2020-12-20 13:23

    I wrote a small library with asserts for serialization, source.

    Sample:

    [Test]
    public void Foo()
    {
       ...
       XmlAssert.Equal(expected, actual, XmlAssertOptions.IgnoreDeclaration | XmlAssertOptions.IgnoreNamespaces);
    }
    

提交回复
热议问题