public void Can_Render_MarkdownPage() { var dynamicPage = new MarkdownPage(markdownFormat, dynamicPageContent, "DynamicTpl", dynamicPageContent); dynamicPage.Prepare(); Assert.That(dynamicPage.HtmlBlocks.Length, Is.EqualTo(9)); var expectedHtml = markdownFormat.Transform(dynamicPageContent) .Replace("@Model.FirstName", person.FirstName) .Replace("@Model.LastName", person.LastName); var templateOutput = dynamicPage.RenderToHtml(templateArgs); Console.WriteLine("Template Output: " + templateOutput); Assert.That(templateOutput, Is.EqualTo(expectedHtml)); }
public void Can_Render_DynamicPage() { var person = new Person { FirstName = "Demis", LastName = "Bellot" }; markdownFormat.RegisterMarkdownPages("~/".MapProjectPath()); var html = markdownFormat.RenderDynamicPageHtml("Dynamic", person); var expectedHtml = markdownFormat.Transform(dynamicPageContent) .Replace("@Model.FirstName", person.FirstName) .Replace("@Model.LastName", person.LastName); Console.WriteLine("Template: " + html); Assert.That(html, Is.EqualTo(expectedHtml)); }
public void Does_process_Markdown_pages() { var markdownHandler = new MarkdownHandler("/AppData/NoTemplate/Static") { MarkdownFormat = markdownFormat, }; var httpReq = new MockHttpRequest { QueryString = new NameValueCollection() }; var httpRes = new MockHttpResponse(); markdownHandler.ProcessRequest(httpReq, httpRes, "Static"); var expectedHtml = markdownFormat.Transform( File.ReadAllText("~/AppData/NoTemplate/Static.md".MapProjectPath())); httpRes.Close(); Assert.That(httpRes.Contents, Is.EqualTo(expectedHtml)); }
public void Can_Render_DynamicPage() { var person = new Person { FirstName = "Demis", LastName = "Bellot" }; markdownFormat.RegisterMarkdownPages("~/".MapProjectPath()); var html = markdownFormat.RenderDynamicPageHtml("Dynamic", person); var tplPath = "~/Views/Shared/_Layout.shtml".MapProjectPath(); var tplContent = File.ReadAllText(tplPath); var expectedHtml = markdownFormat.Transform(dynamicPageContent) .Replace("@Model.FirstName", person.FirstName) .Replace("@Model.LastName", person.LastName); expectedHtml = tplContent.Replace("<!--@Body-->", expectedHtml); "Template: {0}".Fmt(html).Print(); Assert.That(html, Is.EqualTo(expectedHtml)); }