How to mock DocumentClient CreateDocumentQuery AsDocumentQuery

Only for viewing there were two questions, one was not answered, and one was an unacceptable answer (maybe I just did not understand). I want to make fun of it:

var eventsFeed = this.documentClient.CreateDocumentQuery(this.collectionUri, 
sqlExpression, feedOptions).AsDocumentQuery();
var events = await eventsFeed.ExecuteNextAsync(cancellationToken); 

It seems to me that I can get this error:

Unable to pass an object of type 'System.Linq.EnumerableQuery for input of type' Microsoft.Azure.Documents.Linq.IDocumentQuery

There is a possible answer here:

Cannot use an object of type 'System.Linq.EnumerableQuery to enter' Microsoft.Azure.Documents.Linq.IDocumentQuery

but I can’t find the JTokenEx type used in the example and there is no explanation on how to write the mock code?

Ideally, I would like to return some mock results so I can test ExecuteNextAsync.

, , , :

( ) DocumentClient DocumentDb?

.

+4

Source: https://habr.com/ru/post/1692587/


All Articles