/// <inheritdoc /> /// <summary> /// FlightReport /// </summary> /// <param name="flightPeriod">flightPeriod</param> /// <param name="flightName">flightName</param> /// <returns>flightReport</returns> public TuiNewFlight FlightReport(string flightPeriod, string flightName) { this._logger?.LogInformation("Entering FlightReport() from TuiDataServices"); var flightReport = new TuiNewFlight(flightPeriod, flightName) { FlightPeriod = flightPeriod }; return(flightReport); }
/// <inheritdoc /> /// <summary> /// GetFlights /// </summary> /// <param name="departureAirport">departureAirport</param> /// <param name="arrivalAirport">arrivalAirport</param> /// <param name="startDate">startDate</param> /// <param name="endDate">endDate</param> /// <returns>TuiNewFlight</returns> public IEnumerable <TuiNewFlight> GetFlights( string departureAirport, string arrivalAirport, string startDate, string endDate) { var requestedFlight = new TuiNewFlight(departureAirport, arrivalAirport, startDate, endDate); var flights = this.TuiUnitOfWork.FlightRepository.GetFlights(requestedFlight); return(flights); }
// Write fligth Report through event bus private void GenerateReport(TuiNewFlight fligth) { this._logger?.LogInformation("Entering HomeController GenerateReport()"); var fligthReportEvent = new GenerateReportsIntegrationEvent( fligth.FlightId, fligth.DepartureAirport, fligth.ArrivalAirport, fligth.FlightPeriod); // Flight report : Publish Through EventBus this.TuiIntegrationEventService.PublishThroughEventBusAsync(fligthReportEvent); this._logger?.LogInformation("Leaving HomeController GenerateReport()"); }
public static void ShouldReturnFlights(string departureAirport, string arrivalAirport, string flightStartDate, string flightEndDate) { var mockTuicontext = MockTuiContextInMemoryWithData.MockContext(); var flightRepository = new FlightRepository(mockTuicontext); Assert.IsNotNull(flightRepository); var requestedFlight = new TuiNewFlight(departureAirport, arrivalAirport, flightStartDate, flightEndDate); var requestedFlightId = flightRepository.GetFlights(requestedFlight); Assert.IsNotNull(requestedFlightId); var expectedFlightId = new[] { "13584", "13585", "13586", "13587", "13588", "13589", "13590", "13591", "13592", "13593", "13594", "13595", "13596", "11303", "11304", "11305", "11306", "11307" }; Assert.AreEqual(requestedFlightId, expectedFlightId); }
public static void ShouldReturnFlights(string departureAirport, string arrivalAirport, string flightStartDate, string flightEndDate) { // Gets an instance of SQL DBContex : the real NON MOCKED SQL database var sqlDbContext = SqlTuiContext(); var flightRepository = new FlightRepository(sqlDbContext); Assert.IsNotNull(flightRepository); var requestedFlight = new TuiNewFlight(departureAirport, arrivalAirport, flightStartDate, flightEndDate); var requestedFlightId = flightRepository.GetFlights(requestedFlight); Assert.IsNotNull(requestedFlightId); var expectedFlightId = new[] { "13584", "13585", "13586", "13587", "13588", "13589", "13590", "13591", "13592", "13593", "13594", "13595", "13596", "11303", "11304", "11305", "11306", "11307" }; Assert.AreEqual(requestedFlightId, expectedFlightId); }
/// <summary> /// FlightReport /// </summary> /// <param name="departureAirport">departureAirport</param> /// <param name="arrivalAirport">arrivalAirport</param> /// <param name="flightStartDate">flightStartDate</param> /// <param name="flightEndDate">flightEndDate</param> /// <returns>TuiNewFlight</returns> public TuiNewFlight FlightReport(string departureAirport, string arrivalAirport, string flightStartDate, string flightEndDate) { this._logger?.LogInformation("Entering FlightReport() from TuiDataServices"); var flightIds = this.TuiUnitOfWork.FlightRepository.GetSummaryFlights(departureAirport, arrivalAirport, flightStartDate, flightEndDate); var flightReport = new TuiNewFlight(flightIds, departureAirport, arrivalAirport, flightStartDate, flightEndDate) { FlightIds = flightIds, DepartureAirport = departureAirport, ArrivalAirport = arrivalAirport, FlightStartDate = flightStartDate, FlightEndDate = flightEndDate }; return(flightReport); }