public async void GetDocumentAsync() { _logger.LogInformation("GetDocumentAsync..."); var pageRequest = new PageRequest() { SortBy = "LastWrite", SortOrder = SortOrders.DESC, PageIndex = 0, PageSize = 50 }; using (var dbConnection = await _dbConnectionFactory.OpenUserConnectionAsync(_userId)) { var result = await _repository.GetDocumentsAsync(dbConnection, pageRequest); Assert.NotNull(result); var firstDocument = result.Items.First(); Assert.Empty(firstDocument.Data); var document = await _repository.GetDocumentAsync(dbConnection, firstDocument.DocumentId); Assert.NotEmpty(document.Data); } }
private async Task <Document> GetDocument(int documentId) { var document = await _documentsRepository.GetDocumentAsync(documentId).ConfigureAwait(false); if (document == null) { throw new ServiceException(ErrorCodes.FileNotExist, "this document is not exist anymore"); } return(document); }