public void PathToUri(string path, string expected) { var helper = new FormatHtmlHelper(); string actual = helper.PathToUri(path); Assert.AreEqual(expected, actual); }
public void BreakWord(string text, string expected) { var helper = new FormatHtmlHelper(); string actual = helper.BreakWord(text); Assert.AreEqual(expected, actual); }
public void NormalizeEndOfLines() { var helper = new FormatHtmlHelper(); string actual = helper.NormalizeEndOfLines("line 1\nline 2\r\nline 3\n"); Assert.AreEqual("line 1<br>line 2<br>line 3<br>", actual); }
public void GenerateUniqueIds() { var helper = new FormatHtmlHelper(); var list = new List <string>(); for (int i = 0; i < 1000; i++) { string id = helper.GenerateId(); Assert.DoesNotContain(list, id); list.Add(id); } }
public void Flatten() { string xml = "<root>" + "\r\n" + " <parent a='123'>blah " + "\r\n" + " blah</parent>" + "\n" + // simulate inconsistent new lines. " <parent " + "\r\n" + " b='456'><child>" + "\r\n" + " abcefg" + "\r\n" + " </child></parent>" + "\r\n" + " </root>"; string flat = FormatHtmlHelper.Flatten(xml); Assert.AreEqual("<root><parent a='123'>blah blah</parent><parent b='456'><child>abcefg</child></parent></root>", flat); // Semantics should be unchanged. }
public void Flatten_null_string() { string flat = FormatHtmlHelper.Flatten(null); Assert.IsEmpty(flat); }