-
Notifications
You must be signed in to change notification settings - Fork 742
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
Allow Is.AnyOf to be called with arrays or other collections #4355
Comments
I'm not positive, but I feel like this may have been by-design to account for an edge case with strings being an I'd have to refresh myself on some of the design discussions in #2704 |
@stevenaw Yes, that issue was discussed in #2704, with a remark We could add the params now and do IEnumerable on demand later. I added a nunit test that proofs that the below work.
The one not working is:
But that one doesn't work in the master branch either, so isn't something broken. I would that to be written as:
This brings me to the point that
Which actually started the whole
So this PR has not broken anything, but added something we might or might not want. |
Good point @manfred-brands . So all this do is to change the a) syntax b) error message c) semantics (who is being checked) Given the code:
That raises the question if the Is.AnyOf should have been implemented with a redirect to the Does.Contain. Right now we have two pieces of code that actually does the same, if I get this right. Are there any differences really here? The semantics is slightly different though, the Is.AnyOf checks the 'x', whereas the Does.Contain checks the array 'ls'. |
Thanks @manfred-brands ! |
Hey how about
I want Has.All.AnyOf() :) |
This issue is closed. |
Follow-up to a great docs observation on nunit/docs#750 and nunit/nunit.analyzers#533
The
Is.AnyOf
only works if the members are specified as individual values, not if passed as an array or list.Example Gotcha:
It was suggested to make an Analyzer to warn about this, but it seems more prudent to fix it in the framework, so that these expected cases work.
The text was updated successfully, but these errors were encountered: