Exemplo n.º 1
0
        public void HasPermission_BoardUserNull_ThrowsArgumentNullException()
        {
            var service = new BoardUserPermissionService();

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

            Assert.Throws <ArgumentNullException>(action);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }