XML单元测试:.NET的XmlUnit替代品?

时间:2023-01-14 08:53:40

I'm looking for XmlUnit alternatives, since:

我正在寻找XmlUnit替代品,因为:

  • XmlUnit looks like a dead project: "The current release is XmlUnit .Net 0.4, April 2009";
  • XmlUnit看起来像一个死的项目:“当前版本是XmlUnit .Net 0.4,2009年4月”;
  • "Please be aware that the .Net code base is not as advanced as its Java counterpart, in particular there is currently no explicit support for namespaces." (that says it all)
  • “请注意.Net代码库不像Java版本那样先进,特别是目前没有对命名空间的明确支持。” (说明一切)
  • It's bugged Are there any alternatives to XmlUnit?
  • 它有问题XmlUnit还有其他选择吗?
  • I don't really like its static configuration: Are there any alternatives to XmlUnit?
  • 我真的不喜欢它的静态配置:XmlUnit还有其他选择吗?

How do you test your xml serialization/deserialization?

你如何测试你的xml序列化/反序列化?

PS: More details:

PS:更多细节:

  • I'm using NUnit
  • 我正在使用NUnit
  • I'm stuck with .NET 2
  • 我坚持使用.NET 2

1 个解决方案

#1


2  

I read that you look for a purely NUnit-based solution, but I think it's worth to mention that Gallio/MbUnit provides several interesting assertions for testing XML. More information and examples on the Gallio wiki.

我读到你在寻找一个纯粹基于NUnit的解决方案,但我认为值得一提的是Gallio / MbUnit为测试XML提供了几个有趣的断言。关于Gallio wiki的更多信息和示例。

Assert.Xml.AreEqual(
  "<value x='123' y='456'/>", 
  "<VALUE y='456' x='123'></VALUE>", 
  XmlOptions.Loose); // Pass!

#1


2  

I read that you look for a purely NUnit-based solution, but I think it's worth to mention that Gallio/MbUnit provides several interesting assertions for testing XML. More information and examples on the Gallio wiki.

我读到你在寻找一个纯粹基于NUnit的解决方案,但我认为值得一提的是Gallio / MbUnit为测试XML提供了几个有趣的断言。关于Gallio wiki的更多信息和示例。

Assert.Xml.AreEqual(
  "<value x='123' y='456'/>", 
  "<VALUE y='456' x='123'></VALUE>", 
  XmlOptions.Loose); // Pass!