Пример #1
0
        public void Parse_BuildCorrectTree_WithItalicTag()
        {
            const string text   = "foo";
            var          tokens = new[]
            {
                new Token(0, Italic.Representation, TokenType.OpeningTag, Italic),
                new Token(1, text, TokenType.Text),
                new Token(4, Italic.Representation, TokenType.ClosingTag, Italic)
            };
            var expected = new MarkdownItalicElement(Italic.Representation);

            expected.ChildNodes.Add(new Text(text));

            TestParsing(tokens, expected);
        }
Пример #2
0
        public void Parse_BuildCorrectTree_WhenBoldIsEmbeddedInItalicTag()
        {
            const string text   = "baz";
            var          tokens = new[]
            {
                new Token(0, Italic.Representation, TokenType.OpeningTag, Italic),
                new Token(1, Bold.Representation, TokenType.OpeningTag, Bold),
                new Token(3, text, TokenType.Text),
                new Token(6, Bold.Representation, TokenType.ClosingTag, Bold),
                new Token(8, Italic.Representation, TokenType.ClosingTag, Italic)
            };
            var expected = new MarkdownItalicElement(Italic.Representation);

            expected.ChildNodes.Add(new Text(Bold.Representation));
            expected.ChildNodes.Add(new Text(text));
            expected.ChildNodes.Add(new Text(Bold.Representation));

            TestParsing(tokens, expected);
        }