public PermissionFactory(IPermissionAuthorizer permissionAuthorizer) { this.permissionAuthorizer = permissionAuthorizer; this.privatePermissionRule = new PrivatePermissionRule(); this.propertyStatusRule = new PropertyStatusPermissionRule(); this.costumerPermissionRule = new CostumerPermissionRule(this.permissionAuthorizer); this.biddingLockedPermissionRule = new BiddingLockedPermissionRule(); }
private void InitializeVariables() { this.callContext = new CallContext(); this.roomUserPrivileges = new List <PropertyUserPrivilege>(); this.permissionAuthorizer = Substitute.For <IPermissionAuthorizer>(); this.permissionSettings = new PermissionSettings() { CallContext = callContext, PrivilegesByUserRoom = this.roomUserPrivileges }; this.sut = new CostumerPermissionRule(this.permissionAuthorizer); }
GetActionPrivilegeIds_WhenActionIsCheckBiddingStatus_ShouldPrivilegesIdContains2ItemsAndValuesAre1And2() { // Arrange var permissionSettings = new PermissionSettings() { Action = ActionEnum.CheckBiddingStatus }; // Act var actionPrivilegeIds = CostumerPermissionRule.GetActionPrivilegeIds(permissionSettings); // Assert Assert.That(actionPrivilegeIds, Has.Exactly(1).EqualTo(1) .And.Exactly(1).EqualTo(2)); }
GetActionPrivilegeIds_WhenActionEnumIsOnlyDependsOnePrivilege_ShouldListContains1MemberWhichExactlyTheGivenPrivilege( ActionEnum actionEnum, int privilegeId) { // Arrange var permissionSettings = new PermissionSettings() { Action = actionEnum }; // Act var actionPrivilegeIds = CostumerPermissionRule.GetActionPrivilegeIds(permissionSettings); // Assert Assert.That(actionPrivilegeIds, Has.Exactly(1).EqualTo(privilegeId)); }