Ejemplo n.º 1
0
        public void CorrectRendering_WhenNestingTagsInLine()
        {
            var line      = "#_a_";
            var headerTag = new ParsedSubline(0, line.Length, new Header());
            var boldTag   = new ParsedSubline(1, 3, new Cursive());
            var parsed    = new List <ParsedSubline>()
            {
                headerTag, boldTag
            };

            var render = new TextRender(Utils.GetAllAvailableRules());
            var result = render.RenderLine(line, parsed);

            result.Should().BeEquivalentTo("<h1><em>a</em></h1>");
        }
Ejemplo n.º 2
0
        public void CorrectParsing_WhenNestingTagsInLine()
        {
            var line = "#_a_";

            var parser = new TextParser(Utils.GetAllAvailableRules());
            var result = parser.ParseLine(line);

            var headerTag = new ParsedSubline(0, line.Length, new Header());
            var boldTag   = new ParsedSubline(1, 3, new Cursive());
            var expected  = new List <ParsedSubline>()
            {
                headerTag, boldTag
            };

            result.Should().BeEquivalentTo(expected);
        }
Ejemplo n.º 3
0
        public void CorrectRendering_WhenFewTagsInLine()
        {
            var line         = "_a_ __b__";
            var cursiveTag   = new ParsedSubline(0, 2, new Cursive());
            var boldTag      = new ParsedSubline(4, 7, new Bold());
            var paragraphTag = new ParsedSubline(-1, line.Length, new Paragraph());
            var parsed       = new List <ParsedSubline>()
            {
                cursiveTag, boldTag, paragraphTag
            };

            var render = new TextRender(Utils.GetAllAvailableRules());
            var result = render.RenderLine(line, parsed);

            result.Should().BeEquivalentTo("<p><em>a</em> <strong>b</strong></p>");
        }
Ejemplo n.º 4
0
        public void CorrectParsing_WhenFewTagsInLine()
        {
            var line = "_a_ __b__";

            var parser = new TextParser(Utils.GetAllAvailableRules());
            var result = parser.ParseLine(line);

            var cursiveTag   = new ParsedSubline(0, 2, new Cursive());
            var boldTag      = new ParsedSubline(4, 7, new Bold());
            var paragraphTag = new ParsedSubline(-1, line.Length, new Paragraph());
            var expected     = new List <ParsedSubline>()
            {
                cursiveTag, boldTag, paragraphTag
            };

            result.Should().BeEquivalentTo(expected);
        }