public async Task return_0_items_when_not_contain_any_documents() { var documents = new List <Document>(); var pagedResultBaseMock = new PagedResultBaseMock(); var pageDocuments = PagedResult <Document> .From(pagedResultBaseMock, documents); _documentRepository.Setup(r => r.BrowseAsync(_query)).ReturnsAsync(pageDocuments); //Act var handler = new BrowseDocumentsByExternalIdHandler(_documentRepository.Object, _logger.Object); var result = await handler.HandleAsync(_query); //Assert Assert.NotNull(result); Assert.Equal(documents.Count, result.Count()); }
public async Task return_one_item_when_result_contains_one_item() { //Arrange var documents = new List <Document> { new Document(_guid, null, null, _guid) }; var pagedResultBaseMock = new PagedResultBaseMock(); var pageDocuments = PagedResult <Document> .From(pagedResultBaseMock, documents); _documentRepository.Setup(r => r.BrowseAsync(_query)).ReturnsAsync(pageDocuments); //Act var handler = new BrowseDocumentsByExternalIdHandler(_documentRepository.Object, _logger.Object); var result = await handler.HandleAsync(_query); //Assert Assert.NotNull(result); Assert.Equal(documents.Count, result.Count()); }