예제 #1
0
        public void Evaluate_should_fail_for_invalid_role()
        {
            var user   = TestUser.Create("1");
            var result = LocalRoleService.Evaluate(user, _role);

            result.Should().BeFalse();
        }
예제 #2
0
        public void Evaluate_should_succeed_for_valid_role()
        {
            _role.IdentityRoles.Add("foo");

            var user   = TestUser.Create("1", roles: new[] { "foo" });
            var result = LocalRoleService.Evaluate(user, _role);

            result.Should().BeTrue();
        }
예제 #3
0
        public void Evaluate_should_succeed_for_valid_subject()
        {
            _role.Subjects.Add("1");

            var user   = TestUser.Create("1");
            var result = LocalRoleService.Evaluate(user, _role);

            result.Should().BeTrue();
        }
예제 #4
0
        public void Evaluate_should_require_user()
        {
            Action a = () => LocalRoleService.Evaluate(null, _role);

            a.Should().Throw <ArgumentNullException>();
        }