Skip to content

Commit

Permalink
SAVEPOINT
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisdoomen committed Mar 6, 2022
1 parent d93bc09 commit bf447a2
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Tests/FluentAssertions.Equivalency.Specs/MemberMatchingSpecs.cs
Expand Up @@ -428,6 +428,38 @@ public void The_member_name_on_a_nested_type_mapping_must_be_a_valid_member()
.Throw<ArgumentException>()
.WithMessage("*does not have member NonExistingProperty*");
}

[Fact]
public void Exclusion_of_missing_members_works_with_mapping()
{
// Arrange
var subject = new { Property1 = 1 };

var expectation = new { Property2 = 2, Ignore = 3 };

// Act / Assert
subject.Should()
.NotBeEquivalentTo(expectation, opt => opt
.WithMapping("Property2", "Property1")
.ExcludingMissingMembers()
);
}

[Fact]
public void Mapping_works_with_exclusion_of_missing_members()
{
// Arrange
var subject = new { Property1 = 1 };

var expectation = new { Property2 = 2, Ignore = 3 };

// Act / Assert
subject.Should()
.NotBeEquivalentTo(expectation, opt => opt
.ExcludingMissingMembers()
.WithMapping("Property2", "Property1")
);
}

internal class ParentOfExpectationWithProperty2
{
Expand Down

0 comments on commit bf447a2

Please sign in to comment.