Exemplo n.º 1
0
        public async Task NextPage_ReturnsFirstPageAsync()
        {
            // arrange
            var proxyIterator = new TwitterIteratorProxy <IUserIdentifier[], long, string>(_source, _transform);

            // act
            var page = await proxyIterator.NextPageAsync();

            // assert
            Assert.False(page.IsLastPage);
            Assert.False(proxyIterator.Completed);

            Assert.Equal("cursor_for_page_2", page.NextCursor);
            Assert.Equal("cursor_for_page_2", proxyIterator.NextCursor);

            Assert.Equal(_page1UserIds, page.ToArray());
        }
Exemplo n.º 2
0
        public async Task NextPageSecondTimes_ReturnsSecondPageAsync()
        {
            // arrange
            var proxyIterator = new TwitterIteratorProxy <IUserIdentifier[], long, string>(_source, _transform);

            // 1st iteration
            await proxyIterator.NextPageAsync();

            // act
            var page = await proxyIterator.NextPageAsync();

            // assert
            Assert.True(page.IsLastPage);
            Assert.True(proxyIterator.Completed);

            Assert.Equal("0", page.NextCursor);
            Assert.Equal("0", proxyIterator.NextCursor);

            Assert.Equal(_page2UserIds, page.ToArray());
        }