1
我使用VS 2010和运行我的单元测试与NUnit的。下面的线正确地检测,如果两个列表有所不同:如何有NUnit的收集比较调用的ToString时存在差异
CollectionAssert.AreEqual(expected, actual);
不过,我想比下面的一个更好的错误消息:
Expected and actual are both <System.Collections.Generic.List`1[MyNamespace.MyClass]> with 2 elements
Values differ at index [0]
Expected: <MyNamespace.MyClass>
But was: <MyNamespace.MyClass>
在MyNamespace.MyClass,我已实现了以下方法:
public new string ToString()
我希望NUnit的输出如下:
Expected and actual are both <System.Collections.Generic.List`1[MyNamespace.MyClass]> with 2 elements
Values differ at index [0]
Expected: <24 ounces of cold beer>
But was: <2.4 ounces of rotten tomatoes>
然而,NUnit的不调用它。我错过了什么?
这工作,并顺便说一句我爱你的书! –
@Arne:Goodo :) –
新的而不是重写只是一个错字 –