public FetchService( ILogger <FetchService> logger, IExceptionFactory exceptionFactory, IRestApiService restApiService, IOptions <JsonConsumerSettings> settings) { _logger = logger; _exceptionFactory = exceptionFactory; _restApiService = restApiService; _settings = settings.Value; }
public async Task WhenJsonSourceIsNotValid_CanReturnAnEmptyList() { //Arrange List <OwnerInfo> registrations = null; var settings = new JsonConsumerSettings(); var stubILogger = StubHelper.StubILogger <FetchService>(); var stubIExceptionFactory = StubHelper.StubIExceptionFactory; var stubIRestApiService = StubHelper.StubIRestApiService; stubIRestApiService.Setup(x => x.GetRequestAsync <List <OwnerInfo> >(It.IsAny <string>())) .Returns(Task.FromResult(registrations)); var testedService = new FetchService(stubILogger.Object, stubIExceptionFactory.Object, stubIRestApiService.Object, Options.Create(settings)); //Act var actual = await testedService.GetRegistrations(); //Assert Assert.False(actual.Any()); }