Ejemplo n.º 1
0
        public static LinkBuilder Link(this FluentHelper helper)
        {
            var htmlHelper = helper.HtmlHelper;
            var component = new Link(htmlHelper);
            var builder = new LinkBuilder(component);

            return builder;
        }
Ejemplo n.º 2
0
        public void LinkHtmlEncode()
        {
            var htmlHelper = MvcHelper.GetHtmlHelper();

            var component = new Link(htmlHelper);
            var builder = new LinkBuilder(component);

            builder
                .Name<Contact, string>(c => c.Name)
                .Action("Schedule", "Invoice")
                .Text("<p>Testing</p>");


            var html = builder.ToHtmlString();
            html.Should().Be("<a href=\"/test/app/Invoice/Schedule\" id=\"Name\">&lt;p&gt;Testing&lt;/p&gt;</a>");
        }
Ejemplo n.º 3
0
        public void LinkSecureNoAccessTest()
        {
            var htmlHelper = MvcHelper.GetHtmlHelper();

            var component = new Link(htmlHelper);
            var builder = new LinkBuilder(component);

            builder
                .Name("CreditLimit")
                .Action("Schedule", "Invoice")
                .Text("1000")
                .Secure("Finance", "Administrator");


            var html = builder.ToHtmlString();
            html.Should().Be("<a class=\"access-denied\" disabled=\"disabled\" id=\"CreditLimit\">1000</a>");

        }
Ejemplo n.º 4
0
        public void LinkSecureAccessTest()
        {
            var htmlHelper = MvcHelper.GetHtmlHelper("test.user", new[] { "Finance" });

            var component = new Link(htmlHelper);
            var builder = new LinkBuilder(component);

            builder
                .Name("CreditLimit")
                .Action("Schedule", "Invoice")
                .Text("1000")
                .Secure("Finance", "Administrator");


            var html = builder.ToHtmlString();
            html.Should().Be("<a href=\"/test/app/Invoice/Schedule\" id=\"CreditLimit\">1000</a>");

        }