コード例 #1
0
        public async void GetOrdersAsyncQueryMultiPagesResult_ReturnCorrectList()
        {
            var client = new EcwidLegacyClient(_credentials)
            {
                Settings =
                {
                    ApiUrl = "http://www.mocky.io/v2/56fa76b61100007629a72187"
                             //one orders set with count and total and NON empty next url
                }
            };

            var result = await client.GetOrdersAsync(new { statuses = "paid" });

            Assert.Equal(2, result.Count());
        }
コード例 #2
0
        public void GetOrdersAsyncQueryMultiPagesResultCancellation_Exception()
        {
            var client = new EcwidLegacyClient(_credentials)
            {
                Settings =
                {
                    ApiUrl = "http://www.mocky.io/v2/56fa76b61100007629a72187"
                             //one orders set with count and total and NON empty next url
                }
            };

            try
            {
                var source = new CancellationTokenSource();
                var task   = client.GetOrdersAsync(new { limit = 1 }, source.Token);
                source.Cancel();
                Assert.NotNull(task);
            }
            catch (EcwidHttpException)
            {
                Assert.True(true);
            }
        }