public void GivenValidModel_CanUpdateItem()
        {
            TodoItemModel item = new TodoItemModel
            {
                Description = "description",
                Details = "details",
                Deadline = DateTime.Now,
                IsCompleted = false,

            };

            this.mockManager.Setup(x => x.UpdateTodoItem(It.IsAny<int>(), It.IsAny<TodoItem>()));
            var response = this.controller.Put(0, item);

            Assert.AreEqual(response.StatusCode, System.Net.HttpStatusCode.OK);
        }
        public void PutCanHandleException()
        {
            TodoItemModel item = new TodoItemModel
            {
                Description = "description",
                Details = "details",
                Deadline = DateTime.Now,
                IsCompleted = false,

            };

            this.mockManager.Setup(x => x.UpdateTodoItem(It.IsAny<int>(), It.IsAny<TodoItem>())).Throws(new Exception());
            var response = this.controller.Put(0, item);

            Assert.AreEqual(response.StatusCode, System.Net.HttpStatusCode.BadRequest);
        }
        public void GivenValidModel_CanPostNewItem()
        {
            TodoItemModel model = new TodoItemModel
            {
                Description = "description",
                Details = "details",
                Deadline = DateTime.Now,
                IsCompleted = false,
            };

            this.mockManager.Setup(x => x.AddTodoItem(It.IsAny<TodoItem>()));
            var response = this.controller.Post(model);

            Assert.AreEqual(response.StatusCode, System.Net.HttpStatusCode.OK);
            this.mockManager.Verify(x => x.AddTodoItem(It.IsAny<TodoItem>()), Times.Once());
        }