Skip to content
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

Improve error messages for ContainSubtree #36

Merged

Conversation

ronaldkroon
Copy link
Contributor

  • Also require strict order for elements in an array when checking subtree

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.

* Also require strict order for elements in an array when checking subtree
@ronaldkroon ronaldkroon requested a review from jnyrup March 1, 2020 14:49
Copy link
Member

@jnyrup jnyrup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

@dennisdoomen dennisdoomen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the few situations where the [Theory] is used correctly.

@dennisdoomen dennisdoomen merged commit 8a2b582 into fluentassertions:master Mar 3, 2020
@dennisdoomen
Copy link
Member

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

@ronaldkroon
Copy link
Contributor Author

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

Good point.

@ronaldkroon ronaldkroon deleted the Proper_Contains_Subtree branch March 3, 2020 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants