public async Task TestEditCarDataAsync_WithTestData_ShouldEditTheCarData() { // Arrange var contextFactory = new ApplicationDbContextFactory(); var context = contextFactory.CreateApplicationDbContext(); var mapperFactory = new AutoMapperFactory(); var mapper = mapperFactory.CreateMapper(); SeedDbWithCars(context); var carServices = new CarServices(context, mapper); var car = context.Cars.FirstOrDefault(); var carServiceModel = mapper.Map <CarServiceModel>(car); carServiceModel.Brand = "Tesla"; carServiceModel.Model = "Model S"; // Act await carServices.EditCarDataAsync(carServiceModel); var carFormDb = context.Cars.FirstOrDefault(c => c.Id == car.Id); var expectedBrand = "Tesla"; var expectedModel = "Model S"; var actualBrand = carFormDb.Brand; var actualModel = carFormDb.Model; // Assert Assert.True(expectedBrand == actualBrand && expectedModel == actualModel, "The method EditCarDataAsnc does not work!"); }