public IFetcher CreateFetcher(bool fakeFetcher, Primitive.Config.IHttpConfig config) { if (fakeFetcher) { if (localFetcher is null) { localFetcher = new LocalFetcher(config); } return(localFetcher); } else { if (httpFetcher is null) { var client = new HttpClientWrapper(); httpFetcher = new HttpFetcher(config, client); } return(httpFetcher); } }
public LocalFetcher(Primitive.Config.IHttpConfig config) : base(config) { var content = LoadAssemblyFile(mappingFilename); mapping = JsonConvert.DeserializeObject <Dictionary <string, string> >(content); }
public HttpFetcher(Primitive.Config.IHttpConfig config, IHttpClient httpClient) : base(config) { client = httpClient; client.BaseAddress = new Uri(config.BaseUrl); client.Timeout = TimeSpan.FromMilliseconds(config.RequestTimeoutMs); }
public LocalFetcherTests() { config = new Primitive.BaseConfig("test", "test-key"); }
public BaseFetcher(Primitive.Config.IHttpConfig config) { this.config = config; }