public async Task can_access_document_data_from_response() { IEnumerable <Document> responseData; var fakeRepository = new Mock <IPsi2000Api>(); var fakeInspectionResponse = new DocumentResponse() { Data = new List <Document>() }; fakeInspectionResponse.Data.Add(new Document() { Id = fakeId, Description = fakeDescription }); fakeRepository .Setup(m => m.GetDocument(It.IsAny <string>(), It.IsAny <string>())) .Returns(Task.FromResult(fakeInspectionResponse)); asbestosService = new AsbestosService(fakeRepository.Object, fakeLogger.Object); responseData = await asbestosService.GetDocument(fakeId.ToString(), ""); Assert.Equal(fakeId, responseData.ElementAt(0).Id); Assert.Equal(fakeDescription, responseData.ElementAt(0).Description); }
public async Task <IEnumerable <Document> > GetDocument(string inspectionId, string fileType) { _logger.LogInformation($"Calling GetInspection() with {inspectionId}"); var lDocument = await _asbestosService.GetDocument(inspectionId, fileType); if (lDocument.Any() == false) { _logger.LogError($"No Documents returned for {inspectionId}"); throw new MissingDocumentException(); } return(lDocument); }