forked from fluentassertions/fluentassertions
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the naming of the IEquivalencyStep signature
The name of EquivalencyResult.AssertionCompleted wasn't clear what it tried to accomplish. This has been improved. Also improved the interface that equivalency steps can use for recursive assertions.
- Loading branch information
1 parent
c91cc96
commit 47c6269
Showing
31 changed files
with
96 additions
and
91 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
namespace FluentAssertions.Equivalency; | ||
namespace FluentAssertions.Equivalency; | ||
|
||
/// <summary> | ||
/// Convenient implementation of <see cref="IEquivalencyStep"/> that will only invoke | ||
/// </summary> | ||
public abstract class EquivalencyStep<T> : IEquivalencyStep | ||
{ | ||
public EquivalencyResult Handle(Comparands comparands, IEquivalencyValidationContext context, | ||
IEquivalencyValidator nestedValidator) | ||
IValidateChildNodeEquivalency valueChildNodes) | ||
{ | ||
if (!typeof(T).IsAssignableFrom(comparands.GetExpectedType(context.Options))) | ||
{ | ||
return EquivalencyResult.ContinueWithNext; | ||
} | ||
|
||
return OnHandle(comparands, context, nestedValidator); | ||
return OnHandle(comparands, context, valueChildNodes); | ||
} | ||
|
||
/// <summary> | ||
/// Implements <see cref="IEquivalencyStep.Handle"/>, but only gets called when the expected type matches <typeparamref name="T"/>. | ||
/// </summary> | ||
protected abstract EquivalencyResult OnHandle(Comparands comparands, IEquivalencyValidationContext context, | ||
IEquivalencyValidator nestedValidator); | ||
IValidateChildNodeEquivalency nested); | ||
} |
This file contains 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
4 changes: 2 additions & 2 deletions
4
...ions/Equivalency/IEquivalencyValidator.cs → ...ivalency/IValidateChildNodeEquivalency.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
namespace FluentAssertions.Equivalency; | ||
|
||
public interface IEquivalencyValidator | ||
public interface IValidateChildNodeEquivalency | ||
{ | ||
/// <summary> | ||
/// Runs a deep recursive equivalency assertion on the provided <paramref name="comparands"/>. | ||
/// </summary> | ||
void RecursivelyAssertEquality(Comparands comparands, IEquivalencyValidationContext context); | ||
void AssertEquivalencyOf(Comparands comparands, IEquivalencyValidationContext context); | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.