Skip to content

Ambiguous invocation when using BeEquivalentTo with Excluding with <6.0 #1645

@valentasm1

Description

@valentasm1

This code brings compiler exception "ambiguous invocation" when using 6.0.0 version, but works with lower versions.

private class Test1
{
    public string Name { get; set; }
}

private class Test2
{
    public string Name { get; set; }
}

[Fact]
public async Task Test_Case()
{
    var test1 = new Test1();
    var test2 = new Test2();

    //Work around
    //Expression<Func<IMemberInfo, bool>> expression = info => info.Name == "Level.Level.Text";
    //test1.Should().BeEquivalentTo(test2, opts => opts.Excluding(expression));

    test1.Should().BeEquivalentTo(test2,
        opts => opts.Excluding(ctx => ctx.SelectedMemberPath == "Level.Level.Text"));
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions