Exemple #1
0
        public void ParserConvertMarkDown_Test()
        {
            var builder = new MarkdownBuilder();
            var parser  = new Parser.Parser();

            Assert.That(parser.Convert(builder, ""), Is.EqualTo(""));
            Assert.That(parser.Convert(builder.Clear(), "h1Not header"), Is.EqualTo(""));
            Assert.That(parser.Convert(builder.Clear(), "h1 header"), Is.EqualTo("# header #\r\n"));
            Assert.That(parser.Convert(builder.Clear(), "h1   header"), Is.EqualTo("#   header #\r\n"));
            Assert.That(parser.Convert(builder.Clear(), "ignore this"), Is.EqualTo(""));
            Assert.That(parser.Convert(builder.Clear(), "p text bullist not actually bullist"), Is.EqualTo("text bullist not actually bullist\r\n"));
            Assert.That(parser.Convert(builder.Clear(), "bullist one two"), Is.EqualTo("\r\n"));
            Assert.That(parser.Convert(builder.Clear(), "bullist \r\none\r\ntwo"), Is.EqualTo("* one\r\n* two\r\n"));
            Assert.That(parser.Convert(builder.Clear(), "ordlist \r\none\r\ntwo"), Is.EqualTo("1. one\r\n1. two\r\n"));
            Assert.That(parser.Convert(builder.Clear(), "h1 header\r\n\r\np text"), Is.EqualTo("# header #\r\n\r\ntext\r\n"));
        }
Exemple #2
0
        public void ParserConvertHtml_Test()
        {
            var builder = new HtmlBuilder();
            var parser  = new Parser.Parser();

            Assert.That(parser.Convert(builder, ""), Is.EqualTo(""));
            Assert.That(parser.Convert(builder.Clear(), "h1Not header"), Is.EqualTo(""));
            Assert.That(parser.Convert(builder.Clear(), "h1 header"), Is.EqualTo("<h1>header</h1>\r\n"));
            Assert.That(parser.Convert(builder.Clear(), "h1   header"), Is.EqualTo("<h1>  header</h1>\r\n"));
            Assert.That(parser.Convert(builder.Clear(), "ignore this"), Is.EqualTo(""));
            Assert.That(parser.Convert(builder.Clear(), "p text bullist not actually bullist"), Is.EqualTo("<p>text bullist not actually bullist</p>\r\n"));
            Assert.That(parser.Convert(builder.Clear(), "bullist one two"), Is.EqualTo("<ul>\r\n</ul>\r\n"));
            Assert.That(parser.Convert(builder.Clear(), "bullist \r\none\r\ntwo"), Is.EqualTo("<ul>\r\n<li>one</li>\r\n<li>two</li>\r\n</ul>\r\n"));
            Assert.That(parser.Convert(builder.Clear(), "ordlist \r\none\r\ntwo"), Is.EqualTo("<ol>\r\n<li>one</li>\r\n<li>two</li>\r\n</ol>\r\n"));
            Assert.That(parser.Convert(builder.Clear(), "h1 header\r\n\r\np text"), Is.EqualTo("<h1>header</h1>\r\n\r\n<p>text</p>\r\n"));
        }