-
Notifications
You must be signed in to change notification settings - Fork 731
Closed
Labels
Description
Description
When .BeEquivalentTo<Enum>(..., because-text) fails, it does not print the because-text.
Reproduction Steps
This gist demonstrates that the printed text depends on the element type:
public enum E { e0, e1, e2 }
[Fact]
public void FailingEnumSetEquivalenceTestShouldPrintReason()
{
var xs0 = new[] { E.e1 };
var xs1 = new[] { E.e2 };
xs1.Should().BeEquivalentTo(xs0, "we expect them to be equivalent");
// "Expected xs1[0] to equal E.e1 {value: 1} by value, but found E.e2 {value: 2}."
}
[Fact]
public void FailingIntSetEquivalenceTestShouldPrintReason()
{
var xs0 = new[] { 1 };
var xs1 = new[] { 2 };
xs1.Should().BeEquivalentTo(xs0, "we expect them to be equivalent");
// "Expected xs1[0] to be 1 because we expect them to be equivalent, but found 2."
}Expected behavior
because-text should always be printed when an assertion fails.
Actual behavior
The because-text is not printed when the element type is an enum type.
Regression?
No response
Known Workarounds
No response
Configuration
Fluentassertions 6.11.0
Target: .NET 6
Other information
No response