public static HtmlString SiteMapLinksToHtml(this IEnumerable <Url> control) { var renderer = new SiteMapUrlRenderer(); var siteMapUrls = new SiteMapUrls { Urls = control.ToList() }; return(renderer.Render(siteMapUrls)); }
public void Is_Passed_An_Object_Of_SiteMapUrls_Then_Render_Returns_The_Html(SiteMapUrlRenderer renderer) { var urls = new SiteMapUrls(); urls.Urls.Add(new Url { PageType = "hub", Title = "hub", Hub = "hub", ParentSlug = "", Slug = "hub" }); urls.Urls.Add(new Url { PageType = "LandingPage", Title = "LandingPage", Hub = "hub", ParentSlug = "", Slug = "LandingPage" }); urls.Urls.Add(new Url { PageType = "article", Title = "article", Hub = "hub", ParentSlug = "LandingPage", Slug = "article" }); var actual = renderer.Render(urls); actual.Value.Should().NotBeNullOrWhiteSpace(); actual.Value.Should().Be("<div class=\"govuk-grid-row\"><div class=\"govuk-grid-column-one-third\"><div class=\"fiu-feature-text\"><a class=\"fiu-tag fiu-tag--hub fiu-panel__tag\" href=\"/hub\">hub</a></div><ul class=\"govuk-list fiu-sitemap-list\"><li><a href=\"/hub/LandingPage\" class=\"fiu-link fiu-link--hub fiu-sitemap-list__link\">LandingPage</a><ul class=\"govuk-list fiu-sitemap-list__child-list\"><li><a href=\"/hub/article\" class=\"fiu-link fiu-link--hub\">article</a></li></ul></li></ul></div></div>"); }