Skip to content

Explicitly implemented properties on the subject are not found during object graph comparison #2146

@edwardbarford

Description

@edwardbarford
interface IPerson
{
    string Name { get }
}

class Person : IPerson
{
    string IPerson.Name => "Bob";
}

IPerson person = new Person();

person.Should().BeEquivalentTo(new { Name = "Bob" });

Expected: Should not throw
Actual: Throws with message "Expectation has property person.Name that the other object does not have."

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

✅ Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions