在测试中,我试图断言两个 TextSpan 列表的相等/等价,如下所示:
var expectedSpans = new List<TextSpan>()
{
new TextSpan { iStartLine = 1, iEndLine = 1, iStartIndex = 1, iEndIndex = 1}
};
var obtainedSpans = new List<TextSpan>()
{
new TextSpan { iStartLine = 2, iEndLine = 2, iStartIndex = 1, iEndIndex = 1}
};
Assert.That(obtainedSpans, Is.EqualTo(expectedSpans), "Unexpected spans found");
我得到的信息是:
Expected tags were not obtained.
Expected is <System.Collections.Generic.List`1[Microsoft.VisualStudio.TextManager.Interop.TextSpan]> with 1 elements, actual is <System.Collections.Generic.List`1[Microsoft.VisualStudio.TextManager.Interop.TextSpan]> with 1 elements
Values differ at index [0]
Expected: Microsoft.VisualStudio.TextManager.Interop.TextSpan
But was: Microsoft.VisualStudio.TextManager.Interop.TextSpan
我怎样才能获得更详细的消息,至少显示所有值让我找出相等/等价在哪里丢失?在等价断言的情况下,该消息也没有提供信息。