예제 #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>())));
 }
예제 #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>())));
 }
예제 #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> >())));
            }
예제 #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);
            }
예제 #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> >())));
            }