Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[Fact]
public async Task Should_continue_query()
{
// Setup our Database and add a new Customer
var dbSetup = new DatabaseSetup(_client);
await dbSetup.Init(DatabaseId, CollectionId);
var addCustomer1 = new Customer(Guid.NewGuid().ToString(), "Demo1");
await dbSetup.AddCustomer(addCustomer1);
var addCustomer2 = new Customer(Guid.NewGuid().ToString(), "Demo2");
await dbSetup.AddCustomer(addCustomer2);
var query1 = dbSetup.Client.CreateDocumentQuery<Document>(dbSetup.Collection.SelfLink, new FeedOptions
{
MaxItemCount = 1
}).Where(x => x.Id == addCustomer1.Id.ToString() || x.Id == addCustomer2.Id.ToString()).AsDocumentQuery();
var result1 = await query1.ExecuteNextAsync<Document>();
var query2 = dbSetup.Client.CreateDocumentQuery<Document>(dbSetup.Collection.SelfLink, new FeedOptions
{
MaxItemCount = 1,
RequestContinuation = result1.ResponseContinuation
}).Where(x => x.Id == addCustomer1.Id.ToString() || x.Id == addCustomer2.Id.ToString()).AsDocumentQuery();
var result2 = await query2.ExecuteNextAsync<Document>();
result2.Count.ShouldBe(1);
var resultCustomer = (Customer) (dynamic) result2.First();
resultCustomer.Id.ShouldBe(addCustomer2.Id);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.