U4-2635 add failing test

Only first occurrence of oldString is replaced.
This commit is contained in:
John
2014-04-29 12:53:51 +02:00
parent b60aa3031c
commit c1781c2f4b

View File

@@ -80,6 +80,15 @@ namespace Umbraco.Tests.CoreStrings
Assert.AreEqual(shouldBe, trimmed);
}
[TestCase("Hello this is my string", "hello", "replaced", "replaced this is my string", StringComparison.CurrentCultureIgnoreCase)]
[TestCase("Hello this is hello my string", "hello", "replaced", "replaced this is replaced my string", StringComparison.CurrentCultureIgnoreCase)]
[TestCase("Hello this is my string", "nonexistent", "replaced", "Hello this is my string", StringComparison.CurrentCultureIgnoreCase)]
public void ReplaceWithStringComparison(string input, string oldString, string newString, string shouldBe, StringComparison stringComparison)
{
var replaced = input.Replace(oldString, newString, stringComparison);
Assert.AreEqual(shouldBe, replaced);
}
[TestCase(null, null)]
[TestCase("", "")]
[TestCase("x", "X")]