Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CodeFix for Assert with null message causes ambiguous code. #700

Closed
manfred-brands opened this issue Mar 4, 2024 · 2 comments · Fixed by #698
Closed

CodeFix for Assert with null message causes ambiguous code. #700

manfred-brands opened this issue Mar 4, 2024 · 2 comments · Fixed by #698
Milestone

Comments

@manfred-brands
Copy link
Member

Assert.AreEqual(2d, 3d, null);

would generate

Assert.That(3d, Is.EqualTo(2d), null);

which does not compile

The call is ambiguous between the following methods or properties:
'Assert.That<TActual>(TActual, IResolveConstraint, FormattableString,
string, string)' and 'Assert.That<TActual>(TActual, IResolveConstraint,
Func<string>, string, string)'
@manfred-brands
Copy link
Member Author

The same holds if an tolerance value is supplied:

Assert.AreEqual(2d, 3d, 0.1, null);
```

Which results in:
```
Assert.That(3d, Is.EqualTo(2d).Within(0.1), null);
```

@manfred-brands
Copy link
Member Author

Fixed by #698

@mikkelbu mikkelbu added this to the Release 4.1 milestone Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants