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
Does not work with FluentAssertions 6.4.0 #72
Comments
This is unfortunate |
At least using Should().BeXXX() won't be available for FluentAssertions.Web anymore. What I can do is to migrate all Should().BeXXX to ShouldBeXXX which is not how FA users are used with. |
@alexeyshockov thanks for posting the issue. Unfortunately, the solution will introduce some breaking changes and will drive the FluentAssertions.Web into an unconventional usage. I think the best way to solve this is to rename the
The good part of this solution is the fact all FluentAssertions.Web assertions have better discoverability during the development time, as after you type ShouldIt() followed by . (dot), then the IDE will show you the scoped assertions to the HttResponseMessage with priority. The bad part is no one expects the ShouldIt naming from a FluentAssertions plugin Alternatively would be to introduce extension methods for all existing assertions, but this would add an obsolete usage like FA had with ShouldBeEquivalentTo. The things would look like
Both solutions would be resilient to FA's development in the way that FA will never introduce such extension methods. Any suggestion would be great. |
I find the "ShouldIt" suggestion a little unwieldy to read as it turns the assertion into a question, so I would prefer "ShouldBe200Ok(), ShouldHaveHeader(), ..." variant. If "we" are willing to deviate from FA's "Should" paradigm, we could simply switch to "Shall": |
@adrianiftode I chose the 'we' to express that I really like what you gave us here and that I as a users feel like we users shall help come to a good solution for all of us ... |
@alwo23 thanks, these are good suggestions. I was thinking also to invert the words.
But I really like the |
IMO any name will be bad here, because having a separate extension method is an ugly solution anyway. So either Have you considered making a PR to the FluentAssertions itself, BTW? If they have a matcher for HTTP response now, with basic assertions, maybe it's a good time to migrate the rest there? Just asking, do not know how complicated is it. |
FluentAssertions 6.4.0 have added equivalent methods, such as |
One of the important features from FluentAssertions.Web is outputting the HTTP response and request when the test fails, which is not present in the FluentAssertions 6.4.0. And other APIs like BeAs, Satisfy. If you only need HaveStatusCode and happy with the results when it fails, then FluentAssertions 6.4.0 should be more than fine. |
In that case, can't you move those extension methods to the new |
I received a good suggestion from the FA maintainers and testing it right now. I will have to create extensions over their
|
Fix the conflicts between FA 'Should' extension and FA.Web 'Should' extension Add a test to maintain the sync between FA.Web assertions and Primitives.HttpResponseMessageAssertions Closes #72
Fix the conflicts between FA 'Should' extension and FA.Web 'Should' extension Add a test to maintain the sync between FA.Web assertions and Primitives.HttpResponseMessageAssertions Closes #72
Fix the conflicts between FA 'Should' extension and FA.Web 'Should' extension Add a test to maintain the sync between FA.Web assertions and Primitives.HttpResponseMessageAssertions Closes #72
Thank you all for your feedback and a big shout out to the FluentAssertions team for providing the actual solution. |
After FluentAssertions 6.4.0 release where fluentassertions/fluentassertions#1737 was merged, this library now conflicts with the main one, so I have a bunch of errors like
I have no idea how I can resolve this manually.
Do you know a way to use the latest FluentAssertions and FluentAssertions.Web?
The text was updated successfully, but these errors were encountered: