public void ShouldParseCorrectlyFormattedPlainTextLineSuccess(
            string markdown
            )
        {
            MarkdownParser parser = new MarkdownParser(
                new string[] {
                markdown
            }
                );

            Assert.IsTrue(
                parser.Success
                );
            // Should produce exactly one piece of content
            Assert.IsTrue(
                parser.Content.Count == 1
                );
            string html = parser.ToHtml();

            // HTML should contain the provided text
            Assert.IsTrue(
                html.Contains(markdown)
                );
            // HTML should contain open/close paragraph tags
            Assert.IsTrue(
                html.Contains("<p>")
                );
            Assert.IsTrue(
                html.Contains("</p>")
                );
        }
        public void ShouldParseStartsWithStarMixedOrderedUnorderedAsUnorderedSuccess(
            string markdown,
            string targetHtml
            )
        {
            MarkdownParser parser = new MarkdownParser(
                markdown.Split("\n")
                );

            Assert.IsTrue(
                parser.Success
                );
            Assert.AreEqual(
                targetHtml,
                parser.ToHtml()
                );
        }
        public void ShouldParseUnorderedListDifferentSymbolsAsOneListSuccess(
            string markdown,
            string targetHtml
            )
        {
            MarkdownParser parser = new MarkdownParser(
                markdown.Split("\n")
                );

            Assert.IsTrue(
                parser.Success
                );
            Assert.AreEqual(
                targetHtml,
                parser.ToHtml()
                );
        }
        public void ShouldParseOrderedListLineAfterParagraphAsParagraphSuccess(
            string markdown,
            string targetHtml
            )
        {
            MarkdownParser parser = new MarkdownParser(
                markdown.Split("\n")
                );

            Assert.IsTrue(
                parser.Success
                );
            Assert.AreEqual(
                targetHtml,
                parser.ToHtml()
                );
        }
        public void ShouldParseOrderedListLinesAdjacentToWhitespaceLineWithParagraphsSuccess(
            string markdown,
            string targetHtml
            )
        {
            MarkdownParser parser = new MarkdownParser(
                markdown.Split("\n")
                );

            Assert.IsTrue(
                parser.Success
                );
            Assert.AreEqual(
                targetHtml,
                parser.ToHtml()
                );
        }
        public void ShouldParseOrderedListLinesNotSeparatedByWhitespaceDescendingSuccess(
            string markdown,
            string targetHtml
            )
        {
            MarkdownParser parser = new MarkdownParser(
                markdown.Split("\n")
                );

            Assert.IsTrue(
                parser.Success
                );
            Assert.AreEqual(
                targetHtml,
                parser.ToHtml()
                );
        }
        public void ShouldGroupLinesSameTypeSeparatedByManyWhitespaceLines(
            string markdown,
            string targetHtml
            )
        {
            MarkdownParser parser = new MarkdownParser(
                markdown.Split('\n')
                );

            Assert.IsTrue(
                parser.Success
                );
            string html = parser.ToHtml();

            Assert.AreEqual(
                targetHtml,
                html
                );
        }
        public void ShouldNotGroupLinesSameTypeSeparatedByLineOfDifferentType(
            string markdown,
            string targetHtml
            )
        {
            MarkdownParser parser = new MarkdownParser(
                markdown.Split('\n')
                );

            Assert.IsTrue(
                parser.Success
                );
            string html = parser.ToHtml();

            Assert.AreEqual(
                targetHtml,
                html
                );
        }
        public void ShouldNotParseDashHeadingLineFollowedByIncorrectCharacterSuccess(
            string markdown,
            string targetHtml
            )
        {
            MarkdownParser parser = new MarkdownParser(
                markdown.Split("\n")
                );

            Assert.IsTrue(
                parser.Success
                );
            string html = parser.ToHtml();

            Assert.AreEqual(
                targetHtml,
                html
                );
        }
        public void ShouldParseHeadingLineFollowedByOnlyDashSuccess(
            string markdown,
            string targetHtml
            )
        {
            MarkdownParser parser = new MarkdownParser(
                markdown.Split("\n")
                );

            Assert.IsTrue(
                parser.Success
                );
            string html = parser.ToHtml();

            Assert.AreEqual(
                targetHtml,
                html
                );
        }
예제 #11
0
        public void ShouldParseImproperlyDelimitedBacktickCodeBlockAsParagraphSuccess(
            string markdown,
            string targetHtml
            )
        {
            MarkdownParser parser = new MarkdownParser(
                markdown.Split('\n')
                );

            Assert.IsTrue(
                parser.Success
                );
            string html = parser.ToHtml();

            Assert.AreEqual(
                targetHtml,
                html
                );
        }
        public void ShouldParseImproperlyFormattedUnorderedListAsParagraphSuccess(
            string markdown,
            string targetHtml
            )
        {
            MarkdownParser parser = new MarkdownParser(
                new string[]
            {
                markdown
            }
                );

            Assert.IsTrue(
                parser.Success
                );
            Assert.AreEqual(
                targetHtml,
                parser.ToHtml()
                );
        }
        public void ShouldParseBlockquoteZeroToFourSpacesSuccessfully(
            string markdown,
            string targetHtml
            )
        {
            MarkdownParser parser = new MarkdownParser(
                new string[]
            {
                markdown
            }
                );

            Assert.IsTrue(
                parser.Success
                );
            Assert.AreEqual(
                targetHtml,
                parser.ToHtml()
                );
        }
        public void ShouldParseCorrectlyFormattedImageReferenceWithTitleSuccess(
            string markdown,
            string targetHtml
            )
        {
            MarkdownParser parser = new MarkdownParser(
                markdown.Split("\n")
                );

            Assert.IsTrue(
                parser.Success
                );
            string html = parser.ToHtml();

            // Check that the correct HTML is produced
            Assert.AreEqual(
                targetHtml,
                html
                );
        }
        public void ShouldParseUnorderedListOneToThreeSpacesSuccess(
            string markdown,
            string targetHtml
            )
        {
            MarkdownParser parser = new MarkdownParser(
                new string[]
            {
                markdown
            }
                );

            Assert.IsTrue(
                parser.Success
                );
            Assert.AreEqual(
                targetHtml,
                parser.ToHtml()
                );
        }
        public void ShouldParseTwoAdjacentLinesAsOneParagraphSuccess()
        {
            string[] testData = new string[]
            {
                "test1",
                "test2"
            };
            string         targetHtml = "<p>test1 test2</p>";
            MarkdownParser parser     = new MarkdownParser(
                testData
                );

            Assert.IsTrue(
                parser.Success
                );
            Assert.AreEqual(
                targetHtml,
                parser.ToHtml()
                );
        }
        public void ShouldParseIncorrectlyFormattedLinkAsParagraphSuccess(
            string markdown,
            string targetHtml
            )
        {
            MarkdownParser parser = new MarkdownParser(
                markdown.Split("\n")
                );

            Assert.IsTrue(
                parser.Success
                );
            string html = parser.ToHtml();

            // Check that the correct HTML is produced
            Assert.AreEqual(
                targetHtml,
                html
                );
        }
        public void ShouldParseOrderedListNotStartAtOneSuccess(
            string markdown,
            string targetHtml
            )
        {
            MarkdownParser parser = new MarkdownParser(
                new string[]
            {
                markdown
            }
                );

            Assert.IsTrue(
                parser.Success
                );
            Assert.AreEqual(
                targetHtml,
                parser.ToHtml()
                );
        }
예제 #19
0
        public void ShouldParseTooManyLeadingHashesSingleLineHeadingSuccess(
            string markdown,
            string targetHtml
            )
        {
            MarkdownParser parser = new MarkdownParser(
                new string[] {
                markdown
            }
                );

            Assert.IsTrue(
                parser.Success
                );
            string html = parser.ToHtml();

            Assert.AreEqual(
                targetHtml,
                html
                );
        }
        public void ShouldNotParseIncorrectlyFormattedHorizontalRuleFail(
            string markdown,
            string targetHtml
            )
        {
            MarkdownParser parser = new MarkdownParser(
                new string[] {
                markdown
            }
                );

            Assert.IsTrue(
                parser.Success
                );
            string html = parser.ToHtml();

            Assert.AreEqual(
                targetHtml,
                html
                );
        }
예제 #21
0
        public void ShouldParseCorrectlyFormattedWithSpaceSingleLineHeadingSuccess(
            string markdown,
            string targetHtml
            )
        {
            MarkdownParser parser = new MarkdownParser(
                new string[] {
                markdown
            }
                );

            Assert.IsTrue(
                parser.Success
                );
            string html = parser.ToHtml();

            Assert.AreEqual(
                targetHtml,
                html
                );
        }
예제 #22
0
        public void ShouldParseIncorrectlyDelimitedStrikethroughAsParagraphSuccess(
            string markdown,
            string targetHtml
            )
        {
            MarkdownParser parser = new MarkdownParser(
                new string[] {
                markdown
            }
                );

            Assert.IsTrue(
                parser.Success
                );
            string html = parser.ToHtml();

            // Check that the correct HTML is produced
            Assert.AreEqual(
                targetHtml,
                html
                );
        }
        public void ShouldParseCorrectlyFormattedUnderscoreStrongSuccess(
            string markdown,
            string targetHtml
            )
        {
            MarkdownParser parser = new MarkdownParser(
                new string[] {
                markdown
            }
                );

            Assert.IsTrue(
                parser.Success
                );
            string html = parser.ToHtml();

            // Check that the correct HTML is produced
            Assert.AreEqual(
                targetHtml,
                html
                );
        }
        public void ShouldParseCorrectlyEscapedEmphasisCharactersSuccess(
            string markdown,
            string targetHtml
            )
        {
            MarkdownParser parser = new MarkdownParser(
                new string[] {
                markdown
            }
                );

            Assert.IsTrue(
                parser.Success
                );
            string html = parser.ToHtml();

            // Check that the correct HTML is produced
            Assert.AreEqual(
                targetHtml,
                html
                );
        }
        public void ShouldNotParseIncorrectlyDelimitedEmphasisFail(
            string markdown,
            string targetHtml
            )
        {
            MarkdownParser parser = new MarkdownParser(
                new string[] {
                markdown
            }
                );

            Assert.IsTrue(
                parser.Success
                );
            string html = parser.ToHtml();

            // Check that the correct HTML is produced
            Assert.AreEqual(
                targetHtml,
                html
                );
        }