예제 #1
0
        public static void AssertOutputEquals(this IMarkdownElement element, string expectedMarkdown, string expectedHtml = null)
        {
            var markdown = element.ToMarkdown();

            markdown.WriteToTraceWithDelimiter("Markdown");

            Trace.WriteLine("");

            var markdownSharp = new MarkdownToHtmlConverter();
            var html = markdownSharp.Transform(markdown);

            html.WriteToTraceWithDelimiter("HTML");

            Trace.WriteLine("");

            if (expectedMarkdown != markdown)
                Assert.Fail("Unexpected Markdown:\r\n\r\n{0}", BuildOutputWithDelimiter(expectedMarkdown, "Expected Markdown"));
            else
                Trace.WriteLine("Markdown output meets expectations");

            if (expectedHtml != null)
            {
                if (expectedHtml != html)
                    Assert.Fail("Unexpected HTML:\r\n\r\n{0}", BuildOutputWithDelimiter(html, "Expected HTML"));
                else
                    Trace.WriteLine("HTML output meets expectations");
            }
        }
예제 #2
0
        public static void WriteToTrace(this IMarkdownElement element)
        {
            var markdown = element.ToMarkdown();

            markdown.WriteToTraceWithDelimiter("Markdown");

            Trace.WriteLine("");
            
            var markdownSharp = new MarkdownToHtmlConverter();
            var html = markdownSharp.Transform(markdown);

            html.WriteToTraceWithDelimiter("HTML");
        }