コード例 #1
0
        public async Task <Shout[]> GetNextShoutsPage()
        {
            var token    = _continuationTokenHelper.GetNextPageToken();
            var response = await _apiClient.GetShoutsResponse(token);

            _continuationTokenHelper.AddToken(response.ContinuationToken);
            return(response.Shouts.ToArray());
        }
コード例 #2
0
        public void GetNextPageToken_TokensAddedUpToFourthPage_NextPageTokenIsNewestTokenAdded()
        {
            // Arrange
            var tokenToSecond = new ContinuationToken();
            var tokenToThird  = new ContinuationToken();
            var tokenToFourth = new ContinuationToken();
            var tokenToFifth  = new ContinuationToken();

            // Act

            // Go to 1st page
            _continuationTokenHelper.AddToken(tokenToSecond);
            var actualTokenToSecond = _continuationTokenHelper.GetNextPageToken();

            // Go to 2nd page
            _continuationTokenHelper.AddToken(tokenToThird);
            var actualTokenToThird = _continuationTokenHelper.GetNextPageToken();

            // Go to 3rd page
            _continuationTokenHelper.AddToken(tokenToFourth);
            var actualTokenToFourth = _continuationTokenHelper.GetNextPageToken();

            // Go to 4th page
            _continuationTokenHelper.AddToken(tokenToFifth);
            var actualTokenToFifth = _continuationTokenHelper.GetNextPageToken();

            // Assert
            Assert.Equal(tokenToSecond, actualTokenToSecond);
            Assert.Equal(tokenToThird, actualTokenToThird);
            Assert.Equal(tokenToFourth, actualTokenToFourth);
            Assert.Equal(tokenToFifth, actualTokenToFifth);
        }