public async Task CreateAsync_ShouldSuccessfullyAddToDatabase() { // Arrange var context = ApplicationDbContextInMemoryFactory.InitializeContext(); var flightRepository = new EfDeletableEntityRepository <Flight>(context); var service = new FlightsService(flightRepository); var inputModel = new FlightInputModel(); inputModel.FlightNumber = "FlightNumber"; inputModel.AvailableSeats = 20; inputModel.PricePerPerson = 50; inputModel.ReservationType = ReservationType.Flight; inputModel.StartPointId = 1; inputModel.StartPointAirPort = "StartAirPort"; inputModel.EndPointId = 2; inputModel.EndPointAirPort = "EndAirPort"; inputModel.DepartureDateTime = new DateTime(2020, 03, 03, 13, 00, 00); inputModel.FlightTime = new TimeSpan(30, 30, 00); inputModel.CompanyId = 1; var expectedResult = 1; // Act await service.CreateAsync(inputModel); var actualResult = flightRepository.All().Count(); // Assert Assert.True(expectedResult == actualResult); }