public async Task can_access_inspection_data_from_response() { IEnumerable <Inspection> responseData; var fakeRepository = new Mock <IPsi2000Api>(); var fakeInspectionResponse = new InspectionResponse() { Data = new List <Inspection>() }; fakeInspectionResponse.Data.Add(new Inspection() { Id = fakeId, LocationDescription = fakeDescription }); fakeRepository .Setup(m => m.GetInspections(It.IsAny <string>())) .Returns(Task.FromResult(fakeInspectionResponse)); asbestosService = new AsbestosService(fakeRepository.Object, fakeLogger.Object); responseData = await asbestosService.GetInspection(fakeId.ToString()); Assert.Equal(fakeId, responseData.ElementAt(0).Id); Assert.Equal(fakeDescription, responseData.ElementAt(0).LocationDescription); }
public async Task <IEnumerable <Inspection> > GetInspection(string propertyId) { _logger.LogInformation($"Calling GetInspection() with {propertyId}"); var lInspection = await _asbestosService.GetInspection(propertyId); if (lInspection.Any() == false) { _logger.LogError($"No inspections returned for {propertyId}"); throw new MissingInspectionException(); } return(lInspection); }