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
I am personnaly not a big fan of StringAssert and CollectionAssert classes as they hurt a lot API discovery and don't bring much value (in my eyes). So I would vote for more assertions in Assert, deprecating StringAssert is "hard" if we don't have a code refactoring to move people over as the value is small and we force them to change (often fine for OSS users but a major problem for entreprise users).
Summary
Assert.Contains
can accept a string parameter and might cause confusion if someone were to use that method overStringAssert.Contains
Background and Motivation
Since
String
inheritsIEnumerable<char>
, it's possible to use the newAssert.Contains
method with a string and char parameter.Ex:
When doing an assertion on a string I think it could cause some confusion since the new method also accepts a string parameter
Proposed Feature
It could be good to have an analyzer to prefer
StringAssert.Contains
overAssert.Contains
with a codefix for switching toStringAssert.Contains
Ex:
Alternative Designs
Another option could be to deprecate
StringAssert.Contains
and copy over the string assertion functionality as a new overload forAssert.Contains
The text was updated successfully, but these errors were encountered: