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
Cleaner implementation of the equivalency validator #1026
Cleaner implementation of the equivalency validator #1026
Conversation
9ffae61
to
f83920f
Compare
f83920f
to
0c1bee3
Compare
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.
Is it correct that the only semantical change is deferred execution of AssertionScope.Current.AddNonReportable("cyclic_reference_detector", objectTracker)
?
7bfeff8
to
da42ecc
Compare
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.
Really minor note: it was a bit difficult to read the diff on GH when methods was move around and refactored in the same commit.
{ | ||
Key = key; | ||
Value = value; | ||
this.reportability = reportability; | ||
Reportable = reportable; | ||
RequiresFormatting = requiresFormatting; |
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.
🙃 double whitespace
|
||
public bool Reportable => reportability == Reportability.Reportable; | ||
public bool RequiresFormatting {get; } |
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.
🙃 missing whitespace {get
{ | ||
if (config.AllowInfiniteRecursion || !HasReachedMaximumRecursionDepth(memberAccessPath)) | ||
if (expectation == null) |
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.
🙃 is null
@@ -1,16 +1,17 @@ | |||
#region | |||
|
|||
|
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.
🙃 empty line
da42ecc
to
386ff2b
Compare
@@ -2,6 +2,6 @@ namespace FluentAssertions.Equivalency | |||
{ | |||
public interface IEquivalencyValidator | |||
{ | |||
void AssertEqualityUsing(IEquivalencyValidationContext context); | |||
void RecursivelyAssertEquality(IEquivalencyValidationContext context); |
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.
@dennisdoomen renaming this is a breaking change and should be reverted.
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.
How so?
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.
From the CoreFX Breaking Change Rules
Removing or renaming a member, including a getter or setter from a property or enum members
Though I can't find any code on the internet that implements IEquivalencyValidator
except EquivalencyValidator
, Every change breaks someone's workflow and last time we thought it didn't matter, it turned out bad.
I think the benefit of renaming a public method versus the risk of introducing a breaking change, does not seem justified.
While preparing a talk about maintainable code, I realized that the
EquivalencyValidator
was the perfect candidate for refactoring.