예제 #1
0
        public void PathToUri(string path, string expected)
        {
            var    helper = new FormatHtmlHelper();
            string actual = helper.PathToUri(path);

            Assert.AreEqual(expected, actual);
        }
예제 #2
0
        public void BreakWord(string text, string expected)
        {
            var    helper = new FormatHtmlHelper();
            string actual = helper.BreakWord(text);

            Assert.AreEqual(expected, actual);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
            }
        }
예제 #5
0
        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.
        }
예제 #6
0
        public void Flatten_null_string()
        {
            string flat = FormatHtmlHelper.Flatten(null);

            Assert.IsEmpty(flat);
        }