コード例 #1
0
        public void GetSeatAvailability_IfAllParamsAreSet_Successful()
        {
            var productId    = configuration["Inventory:TestProductId"];
            var startDate    = new DateTime(2020, 10, 11);
            var endDate      = new DateTime(2020, 12, 31);
            var availability = service.GetAvailabilities(productId, 1, startDate, endDate).First();
            var parameters   = new SeatAvailabilityParameters
            {
                PerformanceTime = availability.DateTime,
                Direction       = Direction.Desc,
                GroupingLimit   = 1,
                Sort            = "",
            };

            var seats = service.GetSeatAvailability(productId, 1, parameters);

            Assert.IsNotEmpty(seats.Areas);
            foreach (var area in seats.Areas)
            {
                Assert.NotNull(area.AvailableCount);
                Assert.False(string.IsNullOrEmpty(area.Name));
                Assert.False(string.IsNullOrEmpty(area.ItemReference));
            }

            Assert.IsNotNull(context.ReceivedCorrelation);
        }
コード例 #2
0
        public SeatAvailability GetSeatAvailability(string productId, int quantity, DateTime?performance = null)
        {
            var optionalParameters = new SeatAvailabilityParameters {
                PerformanceTime = performance
            };

            return(GetSeatAvailability(productId, quantity, optionalParameters));
        }
コード例 #3
0
        public SeatAvailability GetSeatAvailability(string productId, int quantity, SeatAvailabilityParameters parameters)
        {
            if (string.IsNullOrWhiteSpace(productId))
            {
                throw new ArgumentException("Product ID must be set");
            }

            var requestParameters = new ExecuteApiRequestParameters
            {
                Endpoint = $"v{ApiVersion}/europa/availability/products/{productId}/quantity/{quantity}/seats",
                Method   = RequestMethod.Get,
                Query    = new SeatAvailabilityQueryParameters(parameters),
            };
            var result = Executor.ExecuteApiWithWrappedResponse <SeatAvailability>(requestParameters);

            return(result.DataOrException);
        }