How can I display more info in an error message when using NUnit Assert in a loop?
- by Ian
Consider the following code:
[Test]
public void WidgetTest()
{
foreach (Widget widget in widgets)
{
Assert.AreEqual(0, widget.SomeValue);
}
}
If one of the asserts fails, I will get a very unhelpful error message like the one below:
1) Test Failure : WidgetTest.TestSomeValue
Expected: 0
But was: 1
at…