Example #1
0
        public void Complete(int id)
        {
            var task = _taskManagerRepository.GetById(id);

            if (task == null)
            {
                throw new TaskNotFoundException(id);
            }

            if (task.State == TaskState.Complete)
            {
                throw new CanNotCompleteAlreadyCompletedTaskException(task);
            }

            _taskManagerRepository.UpdateState(id, TaskState.Complete);
        }