-
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
Add support for lambda expressions instead of json path for ignore and accept #175
base: master
Are you sure you want to change the base?
Conversation
Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice
@@ -97,5 +97,18 @@ public void MatchSnapshot_Null_Throws() | |||
// act & assert | |||
Assert.Throws<ArgumentNullException>(() => testPerson.MatchSnapshot()); | |||
} | |||
|
|||
[Test] | |||
public void MatchSnapshot_ShouldFluentAssertionsWithLambda_RemovesSubject() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In NUnit it does not create a accept. and the ignore we dont know yet.
public void MatchSnapshot_ShouldFluentAssertions_RemovesSubject() | ||
{ | ||
// arrange | ||
TestPerson testPerson = TestDataBuilder.TestPersonMarkWalton().Build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to add random input for accepted and ignored fields
src/Snapshooter/Snapshooter.csproj
Outdated
@@ -14,6 +14,7 @@ | |||
</PropertyGroup> | |||
|
|||
<ItemGroup> | |||
<PackageReference Include="FluentAssertions" Version="6.7.0" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should discuss if we want to have a fluent assertions reference within snapshooter (project) or if we can create a snapshooter.fluentassertions or so...
@@ -0,0 +1,56 @@ | |||
{ | |||
"Id": "c78c698f-9ee5-4b4b-9a0e-ef729b1f8ec8", | |||
"Firstname": "Mark", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accept did not work
ac40e1f
to
21c9d8f
Compare
Quality Gate passedThe SonarCloud Quality Gate passed, but some issues were introduced. 88 New issues |
When using fluent assertions, e.g.
person.Should().MatchSnapshot()
or the static snapshot class, e.g.Snapshot.Match(person)
a generic overload now ensures that we can use lambda expressions to accept and ignore fields.Examples: