You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I improved the message, it not only says the failing property name, but also the value of that property:
Multiple failures or warnings in test:
1) Assert.That(new StructWithSomeToleranceAwareMembers(2, 1.1, "1.1", SomeEnum.One), Is.EqualTo(instance).UsingPropertiesComparer())
Values differ at property StructWithSomeToleranceAwareMembers.ValueA
Expected: 1
But was: 2
2) Assert.That(new StructWithSomeToleranceAwareMembers(1, 1.2, "1.1", SomeEnum.One), Is.EqualTo(instance).UsingPropertiesComparer())
Values differ at property StructWithSomeToleranceAwareMembers.ValueB
Expected: 1.1000000000000001d
But was: 1.2d
3) Assert.That(new StructWithSomeToleranceAwareMembers(1, 1.1, "1.2", SomeEnum.One), Is.EqualTo(instance).UsingPropertiesComparer())
Values differ at propertyStructWithSomeToleranceAwareMembers.ValueC
String lengths are both 3. Strings differ at index 2.
Expected: "1.1"
But was: "1.2"
-------------^
4) Assert.That(new StructWithSomeToleranceAwareMembers(1, 1.1, "1.1", SomeEnum.Two), Is.EqualTo(instance).UsingPropertiesComparer())
Values differ at property StructWithSomeToleranceAwareMembers.ValueD
Expected: One
But was: Two
If a property 3 levels down inside an array fails:
Assert.That(two, Is.EqualTo(one).UsingPropertiesComparer())
Values differ at property ParentClass.Two
Values differ at property ChildClass.Values
Expected and actual are both <NUnit.Framework.Tests.Assertions.AssertThatTests+GrandChild[2]>
Values differ at index [1]
Values differ at property GrandChildClass.Value
Expected: 3
But was: 4
Can the
PropertiesComparer
return which property was unequal? It seems it currently fails without that information:When a type has multiple properties, this only outputs the name of the type (or whatever
ToString()
happens to return), e.g.The text was updated successfully, but these errors were encountered: