You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NUnit2025 fires for the second line: The contains constraint cannot be used with an actual value of 'object[]'.
However the tests succeed in NUnit.
In the analyzer, the rule fires always if actual is neither a string nor an IEnumerable<string>.
The ContainsClassicModelAssertUsageCodeFix converts Assert.Contain into Does.Contain.
I made the latter because that was the code we used a lot in our projects.
As NUnit has multiple ways to do the same thing, maybe the it is the wrong method, but NUnit itself considers it ok,
hence so should the analyzer.
Note that Contains.Item has no equivalent for not, e.g. Contains.No.Item does not exist.
We do have Has.Member and Has.No.Member.
The text was updated successfully, but these errors were encountered:
There was an explicit commit to allow Does.Contain` for collections:
Author: Rob Prouse <rob@prouse.org>
Date: 26/08/2014 04:42:06
Commit hash: 88cbece5c5c40d4dccf368453cbc0f0d9fb043f2
Added collections to the Does.Contain syntax and cleaned up the various Contain/Contains methods to return the right type of Contraints for strings and collections.
Given:
NUnit2025 fires for the second line: The contains constraint cannot be used with an actual value of 'object[]'.
However the tests succeed in NUnit.
In the analyzer, the rule fires always if actual is neither a
string
nor anIEnumerable<string>
.The
ContainsClassicModelAssertUsageCodeFix
convertsAssert.Contain
intoDoes.Contain
.I made the latter because that was the code we used a lot in our projects.
As NUnit has multiple ways to do the same thing, maybe the it is the wrong method, but NUnit itself considers it ok,
hence so should the analyzer.
Note that
Contains.Item
has no equivalent for not, e.g.Contains.No.Item
does not exist.We do have
Has.Member
andHas.No.Member
.The text was updated successfully, but these errors were encountered: