Beispiel #1
0
 public override IReturns <IDocumentsOperations, Task <AzureOperationResponse <long> > > Setup()
 {
     return(DocumentOperations
            .Setup(x => x.CountWithHttpMessagesAsync(
                       It.IsAny <SearchRequestOptions>(),
                       It.IsAny <Dictionary <string, List <string> > >(),
                       It.IsAny <CancellationToken>())));
 }
Beispiel #2
0
 public override IReturns <IDocumentsOperations, Task <AzureOperationResponse <DocumentSearchResult <object> > > > Setup()
 {
     return(DocumentOperations
            .Setup(x => x.SearchWithHttpMessagesAsync <object>(
                       It.IsAny <string>(),
                       It.IsAny <SearchParameters>(),
                       It.IsAny <SearchRequestOptions>(),
                       It.IsAny <Dictionary <string, List <string> > >(),
                       It.IsAny <CancellationToken>())));
 }
Beispiel #3
0
            public async Task DoesNotWrapIndexBatchException()
            {
                DocumentOperations
                .Setup(x => x.IndexWithHttpMessagesAsync(
                           It.IsAny <IndexBatch <object> >(),
                           It.IsAny <SearchRequestOptions>(),
                           It.IsAny <Dictionary <string, List <string> > >(),
                           It.IsAny <CancellationToken>()))
                .ThrowsAsync(new IndexBatchException(new DocumentIndexResult(new List <IndexingResult>())));

                await Assert.ThrowsAsync <IndexBatchException>(
                    () => Target.IndexAsync(new IndexBatch <object>(Enumerable.Empty <IndexAction <object> >())));
            }
Beispiel #4
0
            public async Task DoesNotRetryOnNullReferenceException()
            {
                DocumentOperations
                .Setup(x => x.IndexWithHttpMessagesAsync(
                           It.IsAny <IndexBatch <object> >(),
                           It.IsAny <SearchRequestOptions>(),
                           It.IsAny <Dictionary <string, List <string> > >(),
                           It.IsAny <CancellationToken>()))
                .ThrowsAsync(new NullReferenceException());

                var ex = await Assert.ThrowsAsync <NullReferenceException>(
                    () => Target.IndexAsync(new IndexBatch <object>(Enumerable.Empty <IndexAction <object> >())));

                Assert.Equal(1, DocumentOperations.Invocations.Count);
            }
Beispiel #5
0
            public async Task DoesNotHandleNotFoundException()
            {
                DocumentOperations
                .Setup(x => x.IndexWithHttpMessagesAsync(
                           It.IsAny <IndexBatch <object> >(),
                           It.IsAny <SearchRequestOptions>(),
                           It.IsAny <Dictionary <string, List <string> > >(),
                           It.IsAny <CancellationToken>()))
                .ThrowsAsync(new CloudException
                {
                    Response = new HttpResponseMessageWrapper(new HttpResponseMessage(HttpStatusCode.NotFound), string.Empty),
                });

                await Assert.ThrowsAsync <CloudException>(
                    () => Target.IndexAsync(new IndexBatch <object>(Enumerable.Empty <IndexAction <object> >())));
            }