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 Task <InspectionResponse> GetInspections(string propertyId) { if (propertyId == triggerExceptionId) { throw new TestExceptionInFakePSI(); } var fakeInspectionresponse = new InspectionResponse() { Success = true }; if (propertyId == nullResponseId) { fakeInspectionresponse.Data = new List <Inspection>(); } else { fakeInspectionresponse.Data = new List <Inspection>() { new Inspection() { Id = 655, LocationDescription = "A house" } }; } return(Task.FromResult(fakeInspectionresponse)); }