Removes IShortStringHelper.ReplaceMany, this should just be a normal string extension and removes the need to load in IUmbracoSettings for this simple purpose, this fixes some unit tests

This commit is contained in:
Shannon
2018-04-27 10:26:32 +10:00
parent 270f3a75ff
commit 3cdc0e1142
6 changed files with 42 additions and 104 deletions

View File

@@ -596,32 +596,7 @@ namespace Umbraco.Tests.Strings
Assert.AreEqual(expected, output);
}
[Test] // can't do cases with an IDictionary
public void ReplaceManyWithCharMap()
{
const string input = "télévisiön tzvâr ßup   pof";
const string expected = "television tzvar ssup pof";
IDictionary<string, string> replacements = new Dictionary<string, string>
{
{ "é", "e" },
{ "ö", "o" },
{ "â", "a" },
{ "ß", "ss" },
{ "&nbsp;", " " },
};
var output = _helper.ReplaceMany(input, replacements);
Assert.AreEqual(expected, output);
}
#region Cases
[TestCase("val$id!ate|this|str'ing", "$!'", '-', "val-id-ate|this|str-ing")]
[TestCase("val$id!ate|this|str'ing", "$!'", '*', "val*id*ate|this|str*ing")]
#endregion
public void ReplaceManyByOneChar(string input, string toReplace, char replacement, string expected)
{
var output = _helper.ReplaceMany(input, toReplace.ToArray(), replacement);
Assert.AreEqual(expected, output);
}
#region Cases
[TestCase("foo.txt", "foo.txt")]