Skip to content

Commit

Permalink
Added test to plug coverage gap in MustMatchByNameRule.cs.
Browse files Browse the repository at this point in the history
  • Loading branch information
logiclrd committed Mar 27, 2022
1 parent b9b62e6 commit f730ff4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Tests/FluentAssertions.Equivalency.Specs/SelectionRulesSpecs.cs
Expand Up @@ -1631,6 +1631,23 @@ public void When_property_is_non_browsable_only_in_subject_ignoring_non_browsabl
config => config.IgnoringNonBrowsableMembersOnSubject().ExcludingMissingMembers());
}

[Fact]
public void When_non_browsable_property_on_subject_is_ignored_but_is_present_on_expectation_it_should_fail()
{
// Arrange
var subject = new ClassWhereMemberThatCouldBeNonBrowsableIsNonBrowsable() { PropertyThatMightBeNonBrowsable = 0 };
var expectation = new ClassWhereMemberThatCouldBeNonBrowsableIsBrowsable() { PropertyThatMightBeNonBrowsable = 1 };

// Act
Action action =
() => subject.Should().BeEquivalentTo(expectation, config => config.IgnoringNonBrowsableMembersOnSubject());

// Assert
action.Should().Throw<XunitException>().WithMessage(
$"Expectation has * subject.*ThatMightBeNonBrowsable that is non-browsable in the other object, and non-browsable " +
$"members on the subject are ignored with the current configuration*");
}

[Fact]
public void When_property_is_non_browsable_only_in_expectation_excluding_non_browsable_members_should_make_it_succeed()
{
Expand Down

0 comments on commit f730ff4

Please sign in to comment.