예제 #1
0
        public IObservable<IEnumerable<Flight>> GetFlightsFrom(Airport fromAirport)
        {
            var airports = new AirportNamesService().GetAirports();
            var airlines = new AirlineNamesService().GetAirlines();
            var statuses = new StatusService().GetStautses();

            var referenceData = airports
                .ForkJoin(airlines, (allAirports, allAirlines) =>
                                    {
                                        Airports.AddRange(allAirports);
                                        Airlines.AddRange(allAirlines);
                                        return new Unit();
                                    })
                .ForkJoin(statuses, (nothing, allStatuses) =>
                                    {
                                        Statuses.AddRange(allStatuses);
                                        return new Unit();
                                    });

            string url = string.Format(_serviceUrl, 1, 5, fromAirport.Code);

            var flights = from data in referenceData
                          from flight in GetFlightsFrom(url)
                          select flight;

            return flights;
        }
예제 #2
0
        public IObservable <IEnumerable <Flight> > GetFlightsFrom(Airport fromAirport)
        {
            var airports = new AirportNamesService().GetAirports();
            var airlines = new AirlineNamesService().GetAirlines();
            var statuses = new StatusService().GetStautses();


            var referenceData = airports
                                .ForkJoin(airlines, (allAirports, allAirlines) =>
            {
                Airports.AddRange(allAirports);
                Airlines.AddRange(allAirlines);
                return(new Unit());
            })
                                .ForkJoin(statuses, (nothing, allStatuses) =>
            {
                Statuses.AddRange(allStatuses);
                return(new Unit());
            });

            string url = string.Format(_serviceUrl, 1, 5, fromAirport.Code);

            var flights = from data in referenceData
                          from flight in GetFlightsFrom(url)
                          select flight;

            return(flights);
        }
예제 #3
0
 public void Setup()
 {
     service = new StatusService();
 }