public void HasPermission_BoardUserNull_ThrowsArgumentNullException() { var service = new BoardUserPermissionService(); void action() => service.HasPermission(null, BoardUserPermission.CAN_CREATE_ACTIVITY); Assert.Throws <ArgumentNullException>(action); }
public void HasPermission_AllCardAndActivityPermissions_IsCollaborator_ReturnsTrue(BoardUserPermission permission) { var service = new BoardUserPermissionService(); var boardUser = new BoardUser(1, "user-id", BoardUserType.Collaborator); var result = service.HasPermission(boardUser, permission); Assert.True(result); }
public void HasPermission_CanViewBoard_IsCollaborator_ReturnsTrue() { var service = new BoardUserPermissionService(); var boardUser = new BoardUser(1, "user-id", BoardUserType.Collaborator); var result = service.HasPermission(boardUser, BoardUserPermission.CAN_VIEW_BOARD); Assert.True(result); }
public void HasPermission_CanDeleteBoard_IsCollaborator_ReturnsFalse() { var service = new BoardUserPermissionService(); var boardUser = new BoardUser(1, "user-id", BoardUserType.Collaborator); var result = service.HasPermission(boardUser, BoardUserPermission.CAN_DELETE_BOARD); Assert.False(result); }
public void HasPermission_IsOwner_ReturnsTrue(BoardUserPermission permission) { var service = new BoardUserPermissionService(); var boardUser = new BoardUser(1, "user-id", BoardUserType.Owner); var result = service.HasPermission(boardUser, permission); Assert.True(result); }
public void HasPermission_PermissionNotValid_ThrowsInvalidOperationException() { var service = new BoardUserPermissionService(); var boardUser = new BoardUser(1, "user-id", BoardUserType.Collaborator); void action() => service.HasPermission(boardUser, (BoardUserPermission)100000000); Assert.Throws <InvalidOperationException>(action); }
public void HasPermission_IsNone_ReturnsFalse(BoardUserPermission permission) { var service = new BoardUserPermissionService(); var boardUser = new BoardUser(1, "user-id", BoardUserType.None); var result = service.HasPermission(boardUser, permission); Assert.False(result); }