Improve reporting the differences between differently sized collections in BeEquivalentTo#3133
Merged
dennisdoomen merged 1 commit intofluentassertions:mainfrom Feb 21, 2026
Merged
Conversation
Qodana for .NETIt seems all right 👌 No new problems were found according to the checks applied 💡 Qodana analysis was run in the pull request mode: only the changed files were checked Contact Qodana teamContact us at [email protected]
|
Qodana for .NETIt seems all right 👌 No new problems were found according to the checks applied 💡 Qodana analysis was run in the pull request mode: only the changed files were checked Contact Qodana teamContact us at [email protected]
|
be98b04 to
4faab61
Compare
bb5e10a to
367d811
Compare
This was referenced Apr 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit significantly improves how FluentAssertions reports differences when comparing collections of different sizes using
BeEquivalentTo.Previously, the error messages would simply state that collections had different counts. Now, the messages explicitly identify which items are missing from the actual collection and which items are extraneous (unexpected). The commit refactors the collection comparison logic by extracting two strategies: one for strictly-ordered comparisons and another for loosely-ordered comparisons that uses permutation analysis to find the best matches between items.
Additionally, it introduces a new
WithFullDump()option that includes the complete contents of the subject collection in failure messages, making it easier to diagnose complex comparison failures. The implementation adds helper classes to track indexed items and uses caching to avoid redundant comparisons during the matching process.An example of what it can report now is
#378