public async Task <Element> GetElement(string elementId) { _logger.LogInformation($"Calling GetElement() with {elementId}"); var element = await _asbestosService.GetElement(elementId); if (element == null) { _logger.LogError($"No element returned for {elementId}"); throw new MissingElementException(); } return(element); }
public async Task can_access_element_data_from_response() { Element responseData; var fakeRepository = new Mock <IPsi2000Api>(); var fakeElementResponse = new ElementResponse() { Data = new Element() { Id = fakeId, Description = fakeDescription } }; fakeRepository .Setup(m => m.GetElement(It.IsAny <string>())) .Returns(Task.FromResult(fakeElementResponse)); asbestosService = new AsbestosService(fakeRepository.Object, fakeLogger.Object); responseData = await asbestosService.GetElement("random string"); Assert.Equal(fakeId, responseData.Id); Assert.Equal(fakeDescription, responseData.Description); }