public void SavePageInHelloWorldSite() { var page = _site.CreatePage("TestPages/" + Guid.NewGuid().ToString()); var mainContentBlock = new PageBlock(); mainContentBlock.AddComponent(new HtmlContentComponent { Contents = "<div> <strong>XD</strong> </div>" }); mainContentBlock.AddComponent(new SuperSimpleViewEngineTemplateComponent { TemplateLocation = Path.Combine(_dir, "Template.html") }); page.AddBlock(mainContentBlock); page.Save(); }
public static void Init(TestContext context) { _renderHtml = new RenderHtmlContentSystem(); _layoutHtml = new LayoutHtmlContentSystem(); _context = new Dictionary <string, object> { { "Request", new Request("GET", "/TestPages/PageWithContents", "http") }, { "Response", new Response() } }; _page = _site.CreatePage("TestPages/PageWithContents"); if (_page.Exists) { return; } _page.AddBlock(b => b .With(new SuperSimpleViewEngineTemplateComponent { TemplateLocation = Path.Combine(_dir, "Templates", "Site.html") }) ); _page.AddBlock(b => b .With(new HtmlContentComponent { Contents = "<h1>Hello!</h1> <p>This content and all it's siblings will end up in the default slot!</p>", }) .With(new HtmlContentComponent { Contents = "<p>Me and my bro above are in the default slot!</p>" }) ); _page.AddBlock(b => b .With(new HtmlContentComponent { Contents = @"<ul> <li> <h2>I am the Menu!</h2> <p>And I end up in the Menu Slot</p> </li> <li><a href=""#"">Link1</a></li> <li><a href=""#"">Link2</a></li> <li><a href=""#"">Link3</a></li> <li><a href=""#"">Link4</a></li> </ul>" }) .With(new BlockLayoutComponent { Slot = "MainMenu" }) ); _page.AddBlock(b => b .With(new HtmlContentComponent { Contents = @"<p>I'm from the sewers, I live at the bottom!</p>" }) .With(new BlockLayoutComponent { Slot = "Footer" }) ); _page.Save(); }