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"); }
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"); }
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"); }
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"); }