-
Notifications
You must be signed in to change notification settings - Fork 29
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
Reduce friction on importing FluentAssertions.Json
idea
#56
Comments
As we don't want to have Fluent Assertions take a dependency on NewtownSoft.Json, we decided to have a separate package, this repository. But a Roslyn analyzer could work. But unless somebody from the community is willing to assist here, we don't have to time to build one. |
I like this idea, in my team we had so many false positives and it took so long for people to find them that we ended up creating wrappers to make sure we are always using the FluentAssertions.Json method. An analyzer would be perfect indeed. |
I wonder what other imports cause this same problem. If anyone has some knowledge here it might be beneficial for whoever takes this ticket. |
Importing |
Hi. In the meantime, if I just put |
@vkhobor I imagine that would work. You should give it a test and let us know :) |
Will do. 👍🏻 |
To reduce false positives and improve user experience with
someJToken.Should().BeEquivalentTo(expectedJToken)
I was thinking a Roselyn Analyzer can be used to suggest a code fix.public AndConstraint<TAssertions> BeEquivalentTo<TExpectation>(TExpectation expectation, string because = "", params object[] becauseArgs)
I imagine we can find all references to this where TAssertions and TExpectation are JToken/JObject/JArray/JValue and suggest a code fix to import
FluentAssertions.Json
.I think another approach could be to move
JsonAssertionExtensions
,ObjectAssertionsExtensions
, andStringAssertionsExtensions
in theFluentAssertions
namespace? Related to #28The text was updated successfully, but these errors were encountered: