CppStars / mb-unit

Automatically exported from code.google.com/p/mb-unit
0 stars 0 forks source link

Assert.Contains for strings should support case insensitivity. #760

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Assert.Contains(string actualValue, string expectedSubstring) should support 
case insensitivity matching.

Example:
string actualValue = "Edgar Allan Poe (January 19, 1809 – October 7, 1849)";
string expectedSubstring = "ALLAN POE";
Assert.Contains(actualValue, expectedSubstring, 
StringComparison.OrdinalIgnoreCase);

Remark: under the hood, this assertion relies on String.Contains which does not 
have any override that supports case insensitivity searches. So it might be 
necessary to implement a custom text search routine, or to use another BCL 
method.

Original issue reported on code.google.com by Yann.Tre...@gmail.com on 21 Oct 2010 at 7:46

GoogleCodeExporter commented 8 years ago
http://stackoverflow.com/questions/444798/case-insensitive-containsstring

Thank you Graham!

Original comment by Yann.Tre...@gmail.com on 21 Oct 2010 at 9:52

GoogleCodeExporter commented 8 years ago
A patch that adds StringComparison parameter to Contains, DoesNotContain, 
StartsWith, EndsWith methods of Assert class.

Original comment by biv...@gmail.com on 28 Jan 2011 at 5:25

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by Yann.Tre...@gmail.com on 31 Jan 2011 at 6:41

GoogleCodeExporter commented 8 years ago

Original comment by Yann.Tre...@gmail.com on 31 Jan 2011 at 12:49

GoogleCodeExporter commented 8 years ago

Original comment by Yann.Tre...@gmail.com on 3 Feb 2011 at 9:39