public void authorized_link_to_positive_directly_against_endpoint_service() { execute(page => { PrincipalRoles.SetCurrentRolesForTesting("Role1"); return(page.AuthorizedLinkTo(svc => svc.EndpointFor <ConventionEndpoint>(x => x.get_authorized_data()))); }); theResult.ShouldEqual("<a href=\"/authorized/data\"></a>"); }
public void authorized_link_to_negative_directly_against_endpoint_service() { execute(page => { PrincipalRoles.SetCurrentRolesForTesting("Role2"); return(page.AuthorizedLinkTo(svc => svc.EndpointFor <ConventionEndpoint>(x => x.get_authorized_data()))); }); theResult.ShouldBe(string.Empty); }
public void link_to_by_input_model_that_passes_authorization() { execute(page => { PrincipalRoles.SetCurrentRolesForTesting("Role1"); return(page.LinkTo(new SecuredInput { Name = "Max" })); }); theResult.ShouldEqual("<a href=\"/secured/by/role/Max\"></a>"); }
public void link_to_by_input_model_that_does_not_pass_authorization() { execute(page => { PrincipalRoles.SetCurrentRolesForTesting("Role2"); return(page.LinkTo(new SecuredInput { Name = "Max" })); }); theResult.ShouldBeEmpty(); }
public void SetUp() { PrincipalRoles.SetCurrentRolesForTesting("a", "b"); }
public void edit_if_the_user_does_not_have_a_role() { PrincipalRoles.SetCurrentRolesForTesting(); expression.EditableForRole("admin").ToString().ShouldNotContain("input"); }