Skip to content
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

Add the ability to exclude non-browsable members from equivalency tests #1827

Merged
merged 4 commits into from Apr 16, 2022

Commits on Apr 15, 2022

  1. Added property ExcludeNonBrowsable to IEquivalencyAssertionOptions.cs…

    …. Implemented it in SelfReferenceEquivalencyAssertionOptions.cs and CollectionMemberAssertionOptionsDecorator.cs and UsersOfGetClosedGenericInterfaces.cs.
    
    Added property IsBrowsable to IMember.cs and implemented it in Field.cs and Property.cs.
    Added benchmark CheckIfMemberIsBrowsable.
    Adjusted the implementation of AssertMemberEquality in StructuralEqualityEquivalencyStep.cs to combine these fields to allow for non-browsable members to be skipped when checking equivalence.
    Added automated tests of the new functionality to SelectionRulesSpec.cs.
    Accepted API changes into the approved API.
    Updated objectgraphs.md to document the new non-browsable "hidden" members exclusion feature.
    Updated releases.md to describe the new feature.
    logiclrd committed Apr 15, 2022
    Copy the full SHA
    abc5351 View commit details
    Browse the repository at this point in the history
  2. Changed ExcludeNonBrowsable in IEquivalencyAssertionOptions into sepa…

    …rate properties IgnoreNonBrowsableOnSubject and ExcludeNonBrowsableOnExpectation.
    
    Updated implementations of the interface accordingly.
    Subject: Added new selection rule ExcludeNonBrowsableMembersRule.cs and updated SelfReferenceEquivalencyAssertionOptions.SelectionRules to inject an instance of it after AllPropertiesSelectionRule and AllFieldsSelectionRule but before explicit member selection rules.
    Expectation: Updated AssertMemberEquality in StructuralEqualityEquivalencyStep.cs to factor in whether the selected member is browsable.
    Updated the ToString implementation in SelfReferenceEquivalencyAssertionOptions.cs to consider ignoreNonBrowsableOnSubject and excludeNonBrowsableOnExpectation independently.
    Added tests exercising all combinations of non-browsable fields and properties in the subject and expectation.
    Reran AcceptApiChanges.ps1.
    logiclrd committed Apr 15, 2022
    Copy the full SHA
    ec2715c View commit details
    Browse the repository at this point in the history
  3. PR feedback:

    - <see cref> in XML docs.
    - Bug fix: MustMatchByNameRule.cs raises an error if it's supposed to be pretending that a member in the subject doesn't exist because of .IgnoringNonBrowsableMembersOnSubject.
    - ExcludeNonBrowsableMembersRule.cs makes the list of selected members concrete before returning instead of returning the LINQ query.
    - Removed the IncludingNonBrowsableMembers method from SelfReferenceEquivalencyAssertionOptions.cs.
    - Removed redundant tests from SelectionRulesSpecs.cs.
    - Removed redundant word from releases.md.
    Typo fix in SelectionRulesSpecs.cs.
    Reran AcceptApiChanges.ps1.
    logiclrd committed Apr 15, 2022
    Copy the full SHA
    b965564 View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    e0bf53b View commit details
    Browse the repository at this point in the history