コード例 #1
0
        public void HasPermission_BoardUserNull_ThrowsArgumentNullException()
        {
            var service = new BoardUserPermissionService();

            void action() => service.HasPermission(null, BoardUserPermission.CAN_CREATE_ACTIVITY);

            Assert.Throws <ArgumentNullException>(action);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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);
        }