public async Task EditAsync_ShouldWorkCorrectly() { // Arrange var context = ApplicationDbContextInMemoryFactory.InitializeContext(); var seeder = new FlightsServiceTestsSeeder(); await seeder.SeedFlightAsync(context); var flightRepository = new EfDeletableEntityRepository <Flight>(context); var service = new FlightsService(flightRepository); var flight = flightRepository.All().First(); var model = new FlightViewModel { Id = flight.Id, FlightNumber = flight.FlightNumber, AvailableSeats = flight.AvailableSeats, PricePerPerson = flight.PricePerPerson, ReservationType = flight.ReservationType, StartPointId = flight.StartPointId, StartPointAirPort = flight.StartPointAirPort, EndPointId = flight.EndPointId, EndPointAirPort = flight.EndPointAirPort, DepartureDateTime = flight.DepartureDateTime, FlightTime = flight.FlightTime, CompanyId = flight.CompanyId, }; model.FlightNumber = "EditedFlightNumber"; model.AvailableSeats = 20; model.PricePerPerson = 50; model.ReservationType = ReservationType.Flight; model.StartPointId = 1; model.StartPointAirPort = "EditedStartAirPort"; model.EndPointId = 2; model.EndPointAirPort = "EditedEndAirPort"; model.DepartureDateTime = new DateTime(2020, 03, 03, 13, 00, 00); model.FlightTime = new TimeSpan(30, 30, 00); model.CompanyId = 1; // Act await service.EditAsync(model.Id, model); var actualResult = flightRepository.All().First(); var expectedResult = model; // Assert Assert.True(expectedResult.FlightNumber == actualResult.FlightNumber); Assert.True(expectedResult.AvailableSeats == actualResult.AvailableSeats); Assert.True(expectedResult.PricePerPerson == actualResult.PricePerPerson); Assert.True(expectedResult.ReservationType == actualResult.ReservationType); Assert.True(expectedResult.StartPointId == actualResult.StartPointId); Assert.True(expectedResult.StartPointAirPort == actualResult.StartPointAirPort); Assert.True(expectedResult.EndPointId == actualResult.EndPointId); Assert.True(expectedResult.EndPointAirPort == actualResult.EndPointAirPort); Assert.True(expectedResult.DepartureDateTime == actualResult.DepartureDateTime); Assert.True(expectedResult.FlightTime == actualResult.FlightTime); Assert.True(expectedResult.CompanyId == actualResult.CompanyId); }