Beispiel #1
0
        public void SetUp()
        {
            chain = new BehaviorChain();

            var node = new AuthorizationNode();

            node.AddRole("RoleA");
            node.AddRole("RoleB");
            node.AddRole("RoleC");

            chain.AddToEnd(node);

            endpointObjectDef = node.As <IAuthorizationRegistration>().ToEndpointAuthorizorObjectDef();
        }
        public void adding_multiple_roles()
        {
            var node = new AuthorizationNode();
            node.AddRole("RoleA");
            node.AddRole("RoleB");
            node.AddRole("RoleC");

            var authorizationBehavior = toBehavior(node);
            authorizationBehavior.Policies.Count().ShouldBe(3);

            authorizationBehavior.Policies.ToArray()[0].ShouldBeOfType<AllowRole>().Role.ShouldBe("RoleA");
            authorizationBehavior.Policies.ToArray()[1].ShouldBeOfType<AllowRole>().Role.ShouldBe("RoleB");
            authorizationBehavior.Policies.ToArray()[2].ShouldBeOfType<AllowRole>().Role.ShouldBe("RoleC");
        }
Beispiel #3
0
        public void adding_multiple_roles()
        {
            var node = new AuthorizationNode();

            node.AddRole("RoleA");
            node.AddRole("RoleB");
            node.AddRole("RoleC");

            var authorizationBehavior = toBehavior(node);

            authorizationBehavior.Policies.Count.ShouldEqual(3);

            authorizationBehavior.Policies[0].ShouldBeOfType <AllowRole>().Role.ShouldEqual("RoleA");
            authorizationBehavior.Policies[1].ShouldBeOfType <AllowRole>().Role.ShouldEqual("RoleB");
            authorizationBehavior.Policies[2].ShouldBeOfType <AllowRole>().Role.ShouldEqual("RoleC");
        }
Beispiel #4
0
        public void with_rules()
        {
            var node = new AuthorizationNode();

            node.AddRole("Role A");

            node.HasRules().ShouldBeTrue();
        }
        public void adding_a_role()
        {
            var node = new AuthorizationNode();
            node.AddRole("RoleA");

            var authorizationBehavior = toBehavior(node);
            authorizationBehavior.Policies.Count().ShouldBe(1);
            authorizationBehavior.Policies.First().ShouldBeOfType<AllowRole>().Role.ShouldBe("RoleA");
        }
Beispiel #6
0
        public void adding_a_role()
        {
            var node = new AuthorizationNode();

            node.AddRole("RoleA");

            var authorizationBehavior = toBehavior(node);

            authorizationBehavior.Policies.Count.ShouldEqual(1);
            authorizationBehavior.Policies.First().ShouldBeOfType <AllowRole>().Role.ShouldEqual("RoleA");
        }
        public void with_rules()
        {
            var node = new AuthorizationNode();
            node.AddRole("Role A");

            node.HasRules().ShouldBeTrue();
        }