New issue
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
Hidden breaking change in 5.5.0: Assertions on Func lose access to ObjectAssertions #1198
Comments
Thanks for reporting this and the elaborate issue description. Technically you're right. But I'm in doubt whether we should fix this. What kind of behavior would you expect when using
|
I agree, I feel like just amending the release notes to mention this is a good enough resolution for this issue. |
Sure. How would you phrase it? |
I'm not sure, maybe an addition to the bottom note of "Since the addition of |
Updated the release motes. |
Description
I came across this while bumping the version we use in our repository. Basically any code that used assertions from
ObjectAssertions
like.Should().Be()
onFunc<T>
types won't compile whenFluentAssertion
is bumped to5.5.0
, becauseFuncAssertions
was added and inherits fromReferenceTypeAssertions
, but not fromObjectAssertions
.I think most if not all use cases for assertions on
Func<T>
are covered byReferenceTypeAssertions
, soBe
can easily be swapped byBeSameAs
. However, this sort of breaking change is unexpected and confusing.Complete minimal example reproducing the issue
FluentAssertions
5.4.2
and use aShould().Be()
assertion on aFunc<T>
object.5.5.0
.Expected behavior:
The minor version bump is seamless and no breaking changes are encountered.
Actual behavior:
A compilation error is encountered:
Additional Information
5.5.0
, including5.5.3
and latest5.9.0
.FunctionAssertions
was added.ObjectAssertions
but notReferenceTypeAssertions
, namelyBe
,NotBe
,BeEquivalentTo
,HaveFlag
andNotHaveFlag
.Be()
byBeSameAs()
.The text was updated successfully, but these errors were encountered: