public static LinkBuilder Link(this FluentHelper helper) { var htmlHelper = helper.HtmlHelper; var component = new Link(htmlHelper); var builder = new LinkBuilder(component); return builder; }
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\"><p>Testing</p></a>"); }
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>"); }
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>"); }