Ambiguous invocation when using BeEquivalentTo with Excluding with <6.0
See original GitHub issueThis 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"));
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Ambiguous Call when using Should().NotBeNull() on As item
This started happening when I upgraded from fluent assertions 5 to 6. Any Idea as to how I can go about resolving this...
Read more >Upgrading to version 6.0 - Fluent Assertions
With Fluent Assertion 5.0 we redefined equivalency to let the expectation drive the comparison. If your expectation is an interface we will by...
Read more >Fluent Assertions 6.0, the biggest release ever
In the past, we would invoke asynchronous code by wrapping it in a synchronously blocking call. ... using the same engine as BeEquivalentTo...
Read more >Classes - C# language specification
In this case, the invocation creates an instance of the parameter array type with a length corresponding to the number of arguments, initializes ......
Read more >Red Hat JBoss Enterprise Application Platform 7.4
your deployments, invocations between deployments using different security ... Due to the changes in JBoss EAP 6 to use modular class loading, you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
SelectedMemberPath was renamed to Path. So
test1.Should().BeEquivalentTo(test2, opts => opts.Excluding(ctx => ctx.Path == "Level.Level.Text"));
should work.The docs unfortunately do not reflect this yet. Nor was it mentioned as a breaking change in the release notes.
@dennisdoomen There is also the issue of the docs all mentioning the “old” way and not the new. Is there a guideline on how to write the documentation? (I think only https://github.com/fluentassertions/fluentassertions/blob/master/docs/_pages/objectgraphs.md mentions it)