コード例 #1
0
        public async Task CanGetFlightOffersAsync()
        {
            // Arrange
            const string apiKey  = "YOUR_API_KEY";
            var          request = new FlightOfferRequest {
                Origin = "AMS", OriginDepartureDate = "201508", Limit = 5
            };

            // Act
            var flightOffersClient  = FlightOffersClientFactory.CreateFlightOffersClient();
            var flightOfferResponse = await flightOffersClient.GetFlightOffersAsync(apiKey, request);

            // Assert
            flightOfferResponse.ShouldNotBeNull();
            flightOfferResponse.FlightOffer.ShouldNotBeEmpty();
            AssertValidFlightOffers(flightOfferResponse.FlightOffer);
        }
コード例 #2
0
        public async Task CanGetFlightOffersForReturnFlightsAsync()
        {
            // Arrange
            const string apiKey  = "YOUR_API_KEY";
            var          request = new FlightOfferRequest {
                Origin = "AMS", OriginDepartureDate = "201508", DestinationDepartureDate = "201509", Limit = 5
            };

            // Act
            var flightOffersClient  = FlightOffersClientFactory.CreateFlightOffersClient();
            var flightOfferResponse = await flightOffersClient.GetFlightOffersAsync(apiKey, request);

            // Assert
            flightOfferResponse.ShouldNotBeNull();
            flightOfferResponse.FlightOffer.ShouldNotBeEmpty();
            AssertValidFlightOffers(flightOfferResponse.FlightOffer);

            var hasOnlyReturnFlights = flightOfferResponse.FlightOffer.All(f => f.InboundFlight != null);

            hasOnlyReturnFlights.ShouldBeTrue();
        }