We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
With #2147 we now try to convert the subject into an enum if the expectation is an enum. This does not work when the subject is of another enum type.
[Fact] public void Test() { var subject = new { EnumA.Value }; var expected = new { EnumB.Value }; subject.Should().BeEquivalentTo(expected, o => o.WithAutoConversion()); } enum EnumA { Value } enum EnumB { Value }
Test should pass
Message: System.ArgumentException : Object must be the same type as the enum. The type passed in was 'TestProject19.UnitTest1+EnumA'; the enum type was 'TestProject19.UnitTest1+EnumB'. Stack Trace: RuntimeType.IsEnumDefined(Object value) Enum.IsDefined(Type enumType, Object value) AutoConversionStep.TryChangeType(Object subject, Type expectationType, Object& conversionResult) AutoConversionStep.Handle(Comparands comparands, IEquivalencyValidationContext context, IEquivalencyValidator nestedValidator) EquivalencyValidator.TryToProveNodesAreEquivalent(Comparands comparands, IEquivalencyValidationContext context) EquivalencyValidator.RecursivelyAssertEquality(Comparands comparands, IEquivalencyValidationContext context) StructuralEqualityEquivalencyStep.AssertMemberEquality(Comparands comparands, IEquivalencyValidationContext context, IEquivalencyValidator parent, IMember selectedMember, IEquivalencyAssertionOptions options) StructuralEqualityEquivalencyStep.Handle(Comparands comparands, IEquivalencyValidationContext context, IEquivalencyValidator nestedValidator) EquivalencyValidator.TryToProveNodesAreEquivalent(Comparands comparands, IEquivalencyValidationContext context) EquivalencyValidator.RecursivelyAssertEquality(Comparands comparands, IEquivalencyValidationContext context) EquivalencyValidator.AssertEquality(Comparands comparands, EquivalencyValidationContext context) ObjectAssertions`2.BeEquivalentTo[TExpectation](TExpectation expectation, Func`2 config, String because, Object[] becauseArgs) UnitTest1.Fails() line 13
Yes, introduced with 6.11
No response
FluentAssertions 6.11.0
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Description
With #2147 we now try to convert the subject into an enum if the expectation is an enum.
This does not work when the subject is of another enum type.
Reproduction Steps
Expected behavior
Test should pass
Actual behavior
Regression?
Yes, introduced with 6.11
Known Workarounds
No response
Configuration
FluentAssertions 6.11.0
Other information
No response
The text was updated successfully, but these errors were encountered: