-
-
Notifications
You must be signed in to change notification settings - Fork 554
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
Fix multiplied ConversionSelector's descriptions appearing in assertion message #941
Fix multiplied ConversionSelector's descriptions appearing in assertion message #941
Conversation
I have just run all the tests and haven't found a place when duplicated description would appear. @dennisdoomen are you aware of MCVE for the #738 that this fix does not cover? |
After @jnyrup comment, I found that I misspelt the assertion in test: |
No, I just noticed it while working on some other fix. |
Thanks. |
…ertionOptions.GetUserEquivalencySteps
Ok, by now I think I have gotten to the bottom of the issue. The more facts I gathered, the more clear it was that until this PR, the feature was working almost by accident :-). The most important parts of the code to understand it are:
I plan to add some more tests tomorrow, but I could use some review. I hope I did not miss anything important. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea about grouping predicates and descriptions into ConversionSelectorRule
👍
Src/FluentAssertions/Equivalency/SelfReferenceEquivalencyAssertionOptions.cs
Show resolved
Hide resolved
Ready for merge(with squash). I have added one test checking the exception message exactly, I hope you won't crucify me for that :-). My intent was to have at least one test that verifies the whole mechanism of gathering descriptions from the equivalency steps. As it was discussed, the PR introduces minor breaking change in public API. |
Refers to #738.
For sure it is a step forward, but I am not certain if it fixes the root cause. I will investigate more, and possibly follow up with another PR. But for the time being...
the problem was the
ConversionSelector.Clone
method that treateddescription
of typeStringBuilder
like it was immutablestring
. Obviously,StringBuilder
is mutable and needs to be cloned.Two main changes:
Create new
StringBuilder
inConversionSelector.Clone
Rename
description
field todescriptionBuilder
becausedescription
suggests it is astring
indeed.