public async Task CreateToDoAsyncControllerTest() { // arrange var toDos = GetTestData(); var mockToDoSet = SetupMockSetAsync(new Mock <DbSet <ToDo> >(), toDos); var mockContext = new Mock <AndresToDoListContext>(); mockContext.Setup(s => s.ToDos).Returns(mockToDoSet.Object); var newToDo = new ToDoViewModel { Id = 4, ToDoItem = "Find my lost cat" }; // act var toDoService = new ToDoService(mockContext.Object); var toDoController = new ToDoController(toDoService); var controllerActionResult = await toDoController.CreateToDo(newToDo); // assert Assert.IsInstanceOfType(controllerActionResult, typeof(OkNegotiatedContentResult <bool>)); }