Exemplo n.º 1
0
        public void When_GetTaskById_Then_VerifyResult()
        {
            var tasks = _mockProjectManagerService.GetTaskById(1);

            Assert.NotNull(tasks);

            tasks = _mockProjectManagerService.GetTaskById(3);

            Assert.NotNull(tasks);
        }
        public IHttpActionResult AddTask(TaskModel task)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            TaskModel oldTaskModel = pmService.GetTaskById(task.TaskId);

            if (oldTaskModel != null)
            {
                return(BadRequest());
            }
            var result = pmService.AddTask(task);

            if (result != null)
            {
                return(Ok());
            }
            return(BadRequest());
        }
 public IHttpActionResult GetTaskById(int id)
 {
     return(Ok(projectManagerService.GetTaskById(id)));
 }