public void Does_handle_foreach_when_enumerable_is_empty_first_time() { var content = (string)dynamicListPageContent.Clone(); var markdownPage = new MarkdownPage(new MarkdownFormat(), dynamicListPagePath, "", content); markdownPage.Compile(); var model = new Person { Links = new List<Link>() }; var scopeArgs = new Dictionary<string, object> { { "Model", model } }; markdownPage.RenderToHtml(scopeArgs); // First time the list is empty var expected = "A new list item"; model.Links.Add(new Link { Name = expected } ); var html = markdownPage.RenderToHtml(scopeArgs); // Second time the list has 1 item Console.WriteLine(html); Assert.That(html, Contains.Substring(expected)); }
public void AddPage(MarkdownPage page) { try { page.Compile(); AddViewPage(page); } catch (Exception ex) { Log.Error("AddViewPage() page.Prepare(): " + ex.Message, ex); } try { var templatePath = page.Template; if (page.Template == null) return; if (MasterPageTemplates.ContainsKey(templatePath)) return; var templateFile = VirtualPathProvider.GetFile(templatePath); var templateContents = GetPageContents(templateFile); AddTemplate(templatePath, templateContents); } catch (Exception ex) { Log.Error("Error compiling template " + page.Template + ": " + ex.Message, ex); } }
public void AddPage(MarkdownPage page) { try { Log.InfoFormat("Compiling {0}...", page.FilePath); page.Compile(); AddViewPage(page); } catch (Exception ex) { Log.Error("AddViewPage() page.Prepare(): " + ex.Message, ex); } try { var templatePath = page.Template; if (page.Template == null) return; if (MasterPageTemplates.ContainsKey(templatePath)) return; //AddTemplate(templatePath, File.ReadAllText(templatePath)); var templateFile = VirtualPathProvider.GetFile(templatePath); var templateContents = templateFile.ReadAllText(); AddTemplate(templatePath, templateContents); } catch (Exception ex) { Log.Error("Error compiling template " + page.Template + ": " + ex.Message, ex); } }