Exemplo n.º 1
0
        public void GetToken_ReturnItalicToken_WhenTextContainsOneItalicTag()
        {
            var mark          = new ItalicMark();
            var expectedToken = new TokenMd("_aaaaa_", mark);
            var tags          = new Dictionary <Mark, IMarkParser>();
            var parser        = new MarkdownParser(tags);

            var tokens = parser.GetTokens("_aaaaa_");

            tokens.First().Token.Should().BeEquivalentTo(expectedToken.Token);
        }
Exemplo n.º 2
0
        public void GetToken_ReturnWordTokenWithInners_WhenWordContainsTag2()
        {
            var mark          = new ItalicMark();
            var expectedToken = new TokenMd("aaaa_b_", new EmptyMark());

            expectedToken.InnerTokens.Add(new TokenMd("aaaa", new EmptyMark(), expectedToken));
            expectedToken.InnerTokens.Add(new TokenMd("_b_", mark, expectedToken));
            var tags   = new Dictionary <Mark, IMarkParser>();
            var parser = new MarkdownParser(tags);

            var tokens = parser.GetTokens("aaaa_b_");

            tokens.First().Token.Should().BeEquivalentTo(expectedToken.Token);
        }
Exemplo n.º 3
0
        public void FormatToken_ReturnItalicFormattedToken_WhenTokenContainsOneItalicTag()
        {
            var MP            = new ItalicProcessor();
            var mark          = new ItalicMark();
            var expectedToken = new TokenMd("\\<em>12345\\</em>", mark);
            var tags          = new Dictionary <Mark, IMarkProcessor>();
            var tokens        = new List <TokenMd>();

            tokens.Add(new TokenMd("_12345_", mark));
            var processor = new MarkdownProcessor(tags);

            var formattedTokens = processor.FormatTokens(tokens);

            formattedTokens.First().Token.Should().BeEquivalentTo(expectedToken.Token);
        }