snapshooter
snapshooter copied to clipboard
Extensions for Xunit's Assert and FluentAssertion's ObjectAssertions
Is your feature request related to a problem? Please describe. Hi,
We're encountering the following warning in Visual Studio 19 when using Sonar for additional code quality checks.
The sonar rule is available here: https://rules.sonarsource.com/csharp/RSPEC-2699 As explained in their docu, they check for asserts from the following frameworks:
- MSTest
- NUnit
- XUnit
- FluentAssertions (4.x and 5.x)
- NSubstitute
Describe the solution you'd like For Fluent: An Extension Method to assert Snapshots for fluent's ObjectAssertions class would probably do the trick.
myObject.Should().MatchSnapshot()
Note: today this already sort-of works, the OjectAssertions Object gets properly serialized and snapshot and only contains a wrapper around the object that we are actually interested in.
For XUnit's Assert: TBD, probably not easily feasible.
when using
myObject.Should().MatchSnapshot()
the wrapper should no longer be in the snapshot. #57 and #124 are both included in the current version v0.6.0