[Feature Request] Specify string comparison for `string.Contain()` and friends
See original GitHub issuePlease consider adding support to specify string comparison options, to: Contain()
, ContainAll()
, ContainAny()
, NotContain()
, NotContainAll()
, NotContainAny()
.
Then instead of this:
foo.ToUpperInvariant().Should().NotContainAny(
nameof(Foo.Spam).ToUpperInvariant(),
nameof(Foo.Ham).ToUpperInvariant(),
nameof(Foo.Eggs).ToUpperInvariant(),
nameof(Something).ToUpperInvariant(),
"bar".ToUpperInvariant()
);
We could do this:
foo.Should().NotContainAny(
StringComparison.InvariantCultureIgnoreCase,
nameof(Foo.Spam),
nameof(Foo.Ham),
nameof(Foo.Eggs),
nameof(Something),
"bar"
);
(Yes, I chose the ugliest example. I needed to make a point! 😄 Thanks.)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Unable to compare String from query parameter in nodejs
I'm new to node.js and javascript. Can you please tell, why this comparison is not working? My route handler code: friends = [{...
Read more >CA1307: Specify StringComparison for clarity (code analysis)
A string comparison operation uses a method overload that does not set a StringComparison parameter. Rule description. Many string compare ...
Read more >C# Compare Strings?
Hello guys, I am having an issue with comparing strings in C#. ... Do you have an array of strings, and you're trying...
Read more >Find if a string is interleaved of two other strings | DP-33
Write a function that checks whether C is an interleaving of A and B. C is said to be interleaving A and B,...
Read more >Python Strings (With Examples)
In computer programming, a string is a sequence of characters. For example, "hello" is a string containing a sequence of characters 'h' ,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Also a good point. In my experience, sometimes, when the problem seems too complicated the best option is to do nothing. Often it’s a problem that doesn’t require solving.
My code won’t explode if these overloads aren’t added. If it’s easier to ignore my feature request, please do so. And thanks for maintaining this awesome library.
ContainAllEquivalentOf
->ContainOnlyEquivalentOf