コード例 #1
0
        public void HasOperation_GIVEN_Has_Operation_ABC_WHEN_operationName_IS_DEF_THEN_Returns_False()
        {
            const string OperationName = "ABC";
            const string CheckOperationName = "DEF";

            var role = new Role { Name = "role" };
            role.AddOperation(new Operation { Name = OperationName });

            var user = new User();
            user.SetProperty(u => u.Id, 1);
            user.AddRole(role);

            var principal = new JumbleblocksPrincipal(new JumbleblocksUserIdentity(user), user);

            var result = principal.HasOperation(CheckOperationName);

            result.ShouldBeFalse();
        }
コード例 #2
0
        public void HasOperation_GIVEN_Ctor_user_Is_Null_THEN_Returns_False()
        {
            var principal = new JumbleblocksPrincipal(new JumbleblocksAnonymousIdentity(), null);
            var result = principal.HasOperation("abc");

            result.ShouldBeFalse();
        }