public void CalculateLongestCommonWhitespacePrefix() { var samples = new Dictionary <string, int> { { "", 0 }, { " a\r\n b", 3 }, { "a\r\n b", 0 }, { "a\r\nb", 0 }, { " a\r\n\r\n b", 1 }, { " a\r\nb", 0 }, { " a\r\n b other spaces\t \r\n baz\t", 2 } }; foreach (var sample in samples) { var actual = HtmlMarkupProvider.CalculateLongestCommonWhitespacePrefix(sample.Key) ?? string.Empty; Assert.AreEqual(sample.Value, actual.Length); } }