-
Notifications
You must be signed in to change notification settings - Fork 748
And constraint on Has.Member throws #2411
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
Comments
Before implementing a solution to this I think we should have tests that cover all the functionality of CollectionContainsConstraint - as it were in version 3.7 - and then use these tests to ensure that we have kept all the behaviour. I'll try to look into writing these tests tonight (if I have time). The tests should also cover #2412. |
I've tried to go through all the changes done in #2239 and write tests for each change. All the tests pass in version 3.7.1, but in 3.8.1:
https://gist.github.com/mikkelbu/370fe6a735c41906dca1fad28282f19e |
@rprouse I've added this issue to the 3.8.2 milestone. |
I am currently using nunit.framework v3.9.0.0 and still have problems when using a Has.One.Member(...) constraint:
Test fails with the following error:
Does this mean this issue is not completely fixed, is it a new issue or am I doing something wrong? |
@Snaaio - would you file a new issue for this please? 🙂 I'm not entirely sure how the syntax should work here off the top of my head - is this a regression from a previous version of the framework? |
I'm suspicious of the syntax |
@Snaaio As far as I can tell from the PR you can write the assertion as
But note that this will also be satisfied by a collection with more than one element, as long as exactly one element is equal to
can be used (note that I'm usually not using these long method sequences, so it can be that it can be written more succinct 😄 ). @ChrisMaddock The |
An example
Fails with this exception in 3.8.1
This is a regression from 3.6 and I suspect was introduced by #2239.
The right hand constraint of the
And
is getting evaluated against each item of the array instead of against the enumerable. I have tried stepping through and figuring out where things go wrong but without success.I presume I am using the API correctly - I expected the assertion to check that the array contained
donkey
and did not containmule
. If I am wrong, I would appreciate some guidance on how to chain these constraints using the fluent API - or should one write 2 separate assertions?The text was updated successfully, but these errors were encountered: