fluentassertions / fluentassertions.json

NewtonSoft.Json extensions for FluentAssertions
Apache License 2.0
72 stars 26 forks source link

Improve error messages for ContainSubtree #36

Closed ronaldkroon closed 4 years ago

ronaldkroon commented 4 years ago

Before this PR ContainSubtree would just reporing some elements were missing, which is not very informative. Now the same logic and messages from BeEquivalentTo are reused, except that extra properties on the SUT are ignored. When comparing arrays, elements that have a match are skipped for the consecutive elements to compare. Which means that element that are expected multiple times, should really appear multiple times in the SUT, and also the order becomes important.

dennisdoomen commented 4 years ago

Released as https://www.nuget.org/packages/FluentAssertions.Json/5.5.0

ronaldkroon commented 4 years ago

I would probably have kept the two null cases in separate tests, to keep the tests completely free of conditionals.

Good point.