snapshooter icon indicating copy to clipboard operation
snapshooter copied to clipboard

Add support for lambda expressions instead of json path for ignore and accept

Open TimHolzherr opened this issue 3 years ago • 3 comments

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:

Snapshot.Match(testPerson, snapshotName, o => o.AcceptField(p => p.Age));       
testPerson.Should().MatchSnapshot(o => o
                .AcceptField(m => m.Firstname)
                .AcceptField(m => m.DateOfBirth)
                .IgnoreFields(m => m.Children['*'].Name));

TimHolzherr avatar Mar 03 '23 10:03 TimHolzherr

CLA assistant check
All committers have signed the CLA.

swisslife-bot avatar Mar 03 '23 10:03 swisslife-bot

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

88 New issues
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

sonarqubecloud[bot] avatar Jan 03 '24 12:01 sonarqubecloud[bot]