/// <inheritdoc />
        public AggregateSeatAvailability GetAggregateSeatAvailability(string productId, int quantity, DateTime performance)
        {
            var parameters = new AggregateSeatAvailabilityParameters
            {
                PerformanceTime = performance,
                Quantity        = quantity,
            };

            return(GetAggregateSeatAvailability(productId, parameters));
        }
Beispiel #2
0
        public void GetAggregateSeatAvailability_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 AggregateSeatAvailabilityParameters
            {
                Quantity        = 1,
                PerformanceTime = availability.DateTime,
                Direction       = Direction.Desc,
            };

            var seats = service.GetAggregateSeatAvailability(productId, parameters);

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

            Assert.IsNotNull(context.ReceivedCorrelation);
        }
        /// <inheritdoc />
        public AggregateSeatAvailability GetAggregateSeatAvailability(string productId, AggregateSeatAvailabilityParameters parameters)
        {
            if (string.IsNullOrWhiteSpace(productId))
            {
                throw new ArgumentException("Product ID must be set");
            }

            if (parameters == null)
            {
                throw new ArgumentException("Parameters must be set");
            }

            var requestParameters = new ExecuteApiRequestParameters
            {
                Endpoint = $"v{ApiVersion}/products/{productId}/areas",
                Method   = RequestMethod.Get,
                Query    = new AggregateSeatAvailabilityQueryParameters(parameters),
            };
            var result = Executor.ExecuteApiWithWrappedResponse <AggregateSeatAvailability>(requestParameters);

            return(result.DataOrException);
        }