[BUG] AsyncPageable.FromPages doesn't return a pageable object #22705
Labels
Azure.Core
Client
This issue points to a problem in the data-plane of the library.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
needs-team-attention
Workflow: This issue needs attention from Azure service team or SDK team
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
For one of my test I'm trying to mock an AsyncPageable object. I use the FromPages, AsPages and FromValues methods.
I read this article that explain mocking and asyncpageable but multi page is not mentionned.
My code is similar to this :
When I'm requesting the first page, without a
continuationToken
valuecurrentPage
contains 2 elements (A
,B
) and thecontinuationToken
is set toX
.When I'm requesting for the second page, with a
continuationToken
ofX
currentPage
is still the first page and not the second page.Expected behavior
When we query for another page with a valid
continuationToken
we obtain the corresponding page and not the first page.Actual behavior (include Exception or Stack Trace)
The issue only happens when I'm using mocking an
AsyncPageable
withFromPages
. When I'm requesting data from CosmosDb everything works normally.The issue seems to come from Pageable.cs#L127.
FromPages
returns aStaticPageable
and then in theAsPages
method ThecontinuationToken
is ignored.To Reproduce
Environment:
dotnet --info
output for .NET Core projects):The text was updated successfully, but these errors were encountered: