Exemple #1
0
        public async Task UpdateStatusAsync(int userId, int taskId, TaskStatus status)
        {
            if (!await _projectsDataAccessor.IsProjectCreatorByTaskId(userId, taskId) &&
                !await _permissionsDataAccessor.HasPermissionForTask(userId, taskId))
            {
                throw new NoPermissionsForOperationException(ErrorMessages.NoPermissionsForOperation);
            }

            var task = await _taskDataAccessor.UpdateStatusAsync(taskId, status);

            using (_connectionContext.EventScope())
            {
                _taskEventAccessor.StatusUpdated(task, await _projectsDataAccessor.GetAsync(taskId));
            }
        }
Exemple #2
0
        public void CompleteNotActiveTaskFailTest(int taskId)
        {
            Action action = () => { _taskDataAccessor.UpdateStatusAsync(taskId, TaskStatus.Completed).Wait(); };

            action.Should().Throw <InvalidArgumentException>().WithMessage(ErrorMessages.Tasks_CompleteUnactive);
        }