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

[suggestion] NUnit2014 doesn't flag Enumerable.Any(predicate) #749

Open
Bartleby2718 opened this issue Jun 2, 2024 · 3 comments
Open

[suggestion] NUnit2014 doesn't flag Enumerable.Any(predicate) #749

Bartleby2718 opened this issue Jun 2, 2024 · 3 comments

Comments

@Bartleby2718
Copy link
Contributor

Very similar to #748, but for .Any(). NUnit.Analyzers should be able to convert

Assert.That(numbers.Any<int>(x => x % 2 == 0));

to

Assert.That(numbers, Has.Some.Matches<int>(x => x % 2 == 0));

but it doesn't.

@manfred-brands manfred-brands changed the title [bug] NUnit2014 doesn't flag Enumerable.Any(predicate) [suggestion] NUnit2014 doesn't flag Enumerable.Any(predicate) Jun 2, 2024
@manfred-brands
Copy link
Member

To call never asked for functionality a bug is a bit steep isn't it.

@Bartleby2718
Copy link
Contributor Author

Well, the description for NUnit2014 is "Use SomeItemsConstraint for better assertion messages in case of failure" as opposed to "Use ContainConstraint for better assertion messages in case of failure." 🤷

I can change the wording if you believe this should not be part of NUnit2014 .

@manfred-brands
Copy link
Member

If you are going to quote documentation, then be complete:

Using `Does.Contain` (or `Does.Not.Contain`) constraint will lead to better assertion messages in case of failure,
so this analyzer marks all usages of string `Contains` method where it is possible to replace
with `Does.Contain` constraint.

Nothing in here about Any or Matches

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

No branches or pull requests

2 participants