| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
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 us at qodana-support@jetbrains.com
|
Sorry, something went wrong.
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 us at qodana-support@jetbrains.com
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
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
Expected property actual[0].Name to be "Dennis" with a length of 6, but "Jits" has a length of 4, differs near "Jit" (index 0). Expected property actual[0].Age to be 52, but found 13. Expected actual to contain exactly one item, but found one extraneous item FluentAssertions.Equivalency.Specs.Customer { Age = 16, Birthdate = <0001-01-01 00:00:00.000>, Id = 0L, Name = "Teddie" } Full dump of actual: { FluentAssertions.Equivalency.Specs.Customer { Age = 13, Birthdate = <0001-01-01 00:00:00.000>, Id = 0L, Name = "Jits" }, FluentAssertions.Equivalency.Specs.Customer { Age = 16, Birthdate = <0001-01-01 00:00:00.000>, Id = 0L, Name = "Teddie" } } With configuration: - Prefer the declared type of the members - Compare enums by value - Compare tuples by their properties - Compare anonymous types by their properties - Compare records by their members - Include non-browsable members - Include all non-private properties - Include all non-private fields - Exclude member Id - Match (JSON) member by name (or throw) - Be strict about the order of items in byte arrays - Without automatic conversion#378