I'm trying to assert that a list contains a certain string. Since I'd need the condition to be evaluated case insensitively, I used a workaround (something along this blog post).
However, I'd like to know why there seems not to be a way to make the Assert.Contains method perform the comparison without regard of case sensitivity. Or is there a way to do that? (When I googled it, I only got hits on constraints for the Assert.That method on the official page for nUnit.)
StringAssert.AreEqualIgnoringCase
method you could use here. Alternatively, you couldToUpper()
both strings in your comparison as another bandaid. – BedsoreAssert.Some
looks, you could useAssert.IsTrue(string.Equals(left, right, StringComparison.OrdinalIgnoreCase));
– Bedsore