public void Setup() { _uut = Substitute.For <FlightParser>(); _fakeFlightTransponderHandler = Substitute.For <IFlightTransponderHandler>(); // Set multiple return values to simulate the first item being removed from // the flightTransponderHandler. _fakeFlightTransponderHandler.GetNext().Returns <string>( x => "ATR423;39045;12932;14000;20151006213456789", x => null ); }
public void GroupsFlightsWithTheSameFlightNumberAndAirline() { Flights flights = new Flights(); flights.Data.Arrivals.AddRange(new[] { new Flight { Airline = "Emirates", FlightNumber = "F111", Airport = "Glasgow", ScheduledTime = "time" }, new Flight { Airline = "FlyBe", FlightNumber = "F222", Airport = "Glasgow", ScheduledTime = "time" }, new Flight { Airline = "B1", FlightNumber = "X1" } }); FlightParser sut = new FlightParser(); var result = FlightParser.Parse(flights.Arrivals); Assert.Equal(2, result.Count()); Assert.Contains("F111", result.First().FlightNumbers); Assert.Contains("F222", result.First().FlightNumbers); Assert.Contains("Emirates", result.First().Airlines); Assert.Contains("FlyBe", result.First().Airlines); }
public async Task <IActionResult> Arrivals() { var result = await _flightService.Load(); return(new JsonResult(FlightParser.Parse(result.Arrivals))); }