Exemplo n.º 1
0
        public ApiResponse Save([FromBody] Task task)
        {
            var cmp = new TaskComponent();

            cmp.Save(task);

            return(new ApiResponse
            {
                Success = true,
                Object = task
            });
        }
Exemplo n.º 2
0
        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);
        }