public void RandomTest() { const int Tests = 100; for (int i = 0; i < Tests; ++i) { string test = String.Join(" ", String.Concat(new String('.', rnd.Next(40, 201)).Select(_ => chars[rnd.Next(0, chars.Length)])) .Split(' ').Where(s => !String.IsNullOrEmpty(s))).Trim(); string[] words = test.Split(' '); string minorWords = String.Join(" ", new string[] { words[rnd.Next(0, words.Length)], words[rnd.Next(0, words.Length)], words[rnd.Next(0, words.Length)], words[rnd.Next(0, words.Length)] }.Distinct()); string expected = TitleCaseTrue(test, minorWords); string actual = TitleCase.titleCase(test, minorWords); Assert.AreEqual(expected, actual); } }
public void MyTest2() { Assert.AreEqual("", TitleCase.titleCase("")); }
public void MyTest3() { Assert.AreEqual("The Quick Brown Fox", TitleCase.titleCase("the quick brown fox")); }
public void MyTest(string sampleTitle, string sampleMinorWords, string expected) { Assert.AreEqual(expected, TitleCase.titleCase(sampleTitle, sampleMinorWords)); }