コード例 #1
0
        public void Is_Passed_An_Object_Of_Attachment_Then_Render_Returns_The_Html(CardControlRenderer renderer)
        {
            var attachment = new Card()
            {
                Description = "description",
                Title       = "title",
                HubType     = "hub",
                Slug        = "slug",
                Summary     = "summary",
                LandingPage = new CardLandingPage
                {
                    Hub   = "lhub",
                    Slug  = "lslug",
                    Title = "ltitle"
                }
            };

            var actual = renderer.Render(attachment);

            actual.Value.Should().NotBeNullOrWhiteSpace();
            actual.Value.Should().Be("<div class=\"govuk-grid-column-one-quarter\"><div class=\"fiu-card\"><span class=\"fiu-card__category\"><a class=\"fiu-card__category-link\" href=\"/lhub/lslug\">ltitle</a></span><h3 class=\"fiu-card__heading\">title</h3><p class=\"fiu-card__content\">summary</p><a href=\"/hub/slug\" class=\"fiu-card__link\">Learn more <span class=\"fiu-vh\"> about title</span></a></div></div>");
        }
コード例 #2
0
        public static HtmlString CardToHtml(this IHtmlControl control)
        {
            var renderer = new CardControlRenderer();

            return(renderer.Render(control));
        }