public async Task <ActionResult <TodoItemDTO> > CreateTodoItem(TodoItemDTO todoItemDTO)
        {
            var todoItem = await BL.Create(todoItemDTO);

            return(CreatedAtAction(
                       nameof(GetTodoItem),
                       new { id = todoItem.Id },
                       TodoBL.ItemToDTO(todoItem)));
        }
Пример #2
0
        public async Task CreateTodoItem()
        {
            //Act
            todoRepository.Setup(a => a.GetAllEnumerable()).Returns(todoItems.AsEnumerable <TodoItem>());
            //Arrange
            var         todoBL = new TodoBL(todoRepository.Object);
            TodoItemDTO temp   = new TodoItemDTO {
                Name = "temp0", IsComplete = false
            };
            await todoBL.Create(temp);

            //Assert
            todoRepository.Verify(x => x.Insert(It.IsAny <TodoItem>()));
        }