Esempio n. 1
0
 public TestListResponse Get(TestListRequest request)
 {
     TestListResponse response = new TestListResponse ();
     response.Tests = new List<TestResponse> ();
     response.Tests.Add (new TestResponse { ID = 1, Test = "Test1" });
     return response;
 }
        public async Task RequestAllPagesAsync_CallsProxyUntilNoMoreData()
        {
            var request = new TestListRequest();
            ListResponse <TestResponse> result = await _proxy.Object.RequestAllPagesAsync <TestResponse>(request);

            result.Count.ShouldBe(_results.Count);

            _proxy.Verify(x => x.RequestAsync <ListResponse <TestResponse> >(It.IsAny <TestListRequest>()), Times.Exactly(4));
        }
        public void RequestAllPages_CustomPageSize_CallsProxyUntilNoMoreData()
        {
            var request = new TestListRequest {
                PageSize = 5
            };
            ListResponse <TestResponse> result = _proxy.Object.RequestAllPages <TestResponse>(request);

            result.Count.ShouldBe(_results.Count);

            _proxy.Verify(x => x.Request <ListResponse <TestResponse> >(It.IsAny <TestListRequest>()), Times.Exactly(7));
        }