public StaticLicenseSource(StaticLicenseConfiguration configuration, Func <HttpClient> httpClientFactory) { configuration.AssertNotNull(nameof(configuration)); httpClientFactory.AssertNotNull(nameof(httpClientFactory)); HttpClientFactory = httpClientFactory; _codeByUrl = CreateCodeByUrl(configuration.ByUrl); _urlByCode = CreateUrlByCode(configuration.ByCode); }
public void BeforeEachTest() { _mockHttp = new MockHttpMessageHandler(); _configuration = new StaticLicenseConfiguration(); using (var file = TempFile.FromResource(GetType(), "StaticLicenseSourceTest.appsettings.json")) { var root = new ConfigurationBuilder() .AddJsonFile(file.Location, false, false) .Build(); root.GetSection(StaticLicenseConfiguration.SectionName).Bind(_configuration); } _sut = new StaticLicenseSource(_configuration, _mockHttp.ToHttpClient); }