示例#1
0
        public async Task InitializeQueryAsyncReturnsSuccessResponse()
        {
            // arrange
            var request = CreateValidInitialRequest();

            // act
            var response = await _client.InitializeQueryAsync(request);

            // assert
            Assert.True(response.Succeeded);
            Assert.NotNull(response.Id);
            Assert.Null(response.ErrorMessage);
        }
        /// <summary>
        /// {host}/api/NewRequest
        /// </summary>
        /// <returns></returns>
        private static async Task <InitialResponse> QueryInitializationAsync()
        {
            using (var client = new AirlineClient())
            {
                var request = new InitialRequest("testapid", FlightClass.Economy);

                request.SetPassengerCount(1);
                request.AddRoute(new Route("lon", "mow", new DateTime(2019, 8, 12)));

                var response = await client.InitializeQueryAsync(request);

                Console.WriteLine($"[Query initialization]: NewRequest is {response.Id}\n");

                return(response);
            }
        }