Last active
July 24, 2020 09:23
-
-
Save musukvl/9343e25636912e49055590ec0e720059 to your computer and use it in GitHub Desktop.
Fluent assertions: skip checking for default fields in Expectation. (for cases if we want to check only defined non-default fields)
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
class IgnoreNullMembersInExpectation : IEquivalencyStep | |
{ | |
public bool CanHandle(IEquivalencyValidationContext context, IEquivalencyAssertionOptions config) => | |
context.Expectation is null || | |
context.Expectation is ValueType == default; | |
public bool Handle(IEquivalencyValidationContext context, IEquivalencyValidator parent, IEquivalencyAssertionOptions config) => true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment