Пример #1
0
        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>");
        }
Пример #2
0
        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);
        }
Пример #3
0
        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>");
        }
Пример #4
0
        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");
 }
Пример #6
0
        public void edit_if_the_user_does_not_have_a_role()
        {
            PrincipalRoles.SetCurrentRolesForTesting();

            expression.EditableForRole("admin").ToString().ShouldNotContain("input");
        }