public ApiResponse Save([FromBody] Task task) { var cmp = new TaskComponent(); cmp.Save(task); return(new ApiResponse { Success = true, Object = task }); }
public void Test1() { var cmp = new TaskComponent(); var task = new Task { TaskItem = "This is a test" }; var listBefore = cmp.GetAllTasks().Count(); cmp.Save(task); var listAfter = cmp.GetAllTasks().Count(); Assert.AreEqual(listBefore + 1, listAfter); cmp.Delete(task.Id); var listAfterDel = cmp.GetAllTasks().Count(); Assert.AreEqual(listBefore, listAfterDel); }