public async System.Threading.Tasks.Task TestPostTeacher_Succesfull_ReturnsCreatedTeacher() { //Arrange var context = TestingUtilities.CreateInMemoryDatabaseContext("PostTeacherSuccefull"); var testEntity = new Teacher() { Id = 42 }; var controller = new TeachersController(context); //Act var result = await controller.Post(testEntity); //Assert Assert.IsType <CreatedAtActionResult>(result.Result); Assert.Equal(testEntity, context.Teachers.Last()); context.Database.EnsureDeleted(); }