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. |
jnyrup
left a comment
There was a problem hiding this comment.
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.Clonemethod that treateddescriptionof typeStringBuilderlike it was immutablestring. Obviously,StringBuilderis mutable and needs to be cloned.Two main changes:
Create new
StringBuilderinConversionSelector.CloneRename
descriptionfield todescriptionBuilderbecausedescriptionsuggests it is astringindeed.