public void CheckRule_MatchPermissionId_Should_Ok() { var logic = new RoleBasedCheckLogic(); var checkContext = MockHelper.CreatePermissionCheckContext("A, B, MockPermission", ""); var guestRule = RoleBasedPermissionRule.CreateGuestRule("MockPermission"); var result = logic.Check(guestRule, checkContext); result.LogJson().Category.ShouldEqual(PermissionCheckResultCategory.Allowed); }
public void CheckGuestRule_Anyone_Should_Ok() { var logic = new RoleBasedCheckLogic(); var guestRule = RoleBasedPermissionRule.CreateGuestRule("MockPermission"); var guestContext = MockHelper.CreatePermissionCheckContext("A, B, MockPermission", ""); logic.Check(guestRule, guestContext).LogJson().Category.ShouldEqual(PermissionCheckResultCategory.Allowed); var loginContext = MockHelper.CreatePermissionCheckContext("A, B, MockPermission", "bob"); logic.Check(guestRule, loginContext).LogJson().Category.ShouldEqual(PermissionCheckResultCategory.Allowed); }