示例#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);
        }
 public void Setup()
 {
     service = new StatusService();
 }