snapshooter
snapshooter copied to clipboard
Add support for lambda expressions instead of json path for ignore and accept
This PR is a work in progress
We can now accept and ignore fields in a type safe way.
Open point: We have 3 syntax how we can assert a snapshot.
- With fluent assertions:
person.Should().MatchSnapshot()
- With the static snapshot class
Snapshot.Match(person)
- With the MatchSnapshot extension:
person.MatchSnapshot()
Due to limitations with generics we cannot support lambda expressions for both the MatchSnapshot and the fluent assertion way. The current state of the pr only supports lambda expressions for fluent assertions and for static snapshot matches.
We could support lambda expressions for all 3 ways if we would perform a rename. E.g. person.Should().MatchSnapshot()
would need to become person.Shoult().Match()
. Not sure if this is an acceptable solution or if we should just not support lambda expressions for the MatchSnapshot extension syntax.