public void Setup() { var options = new NpuServerFetcherOptions { BaseAddress = "https://ei.npu.edu.ua/", CallEndPoint = "Server.php", RequestOptions = NpuServerFetcherOptions.DefaultNpuRequestFetcherOptions() }; _fetcher = new NpuServerFetcher(options); }
private static void AddNpuServerFetcher(this IServiceCollection services, Action <NpuServerFetcherOptions> optionsBuilder) { if (optionsBuilder == null) { throw new ArgumentNullException(nameof(optionsBuilder)); } var fetcherOptions = new NpuServerFetcherOptions(); optionsBuilder(fetcherOptions); fetcherOptions.RequestOptions ??= NpuServerFetcherOptions.DefaultNpuRequestFetcherOptions(); services.AddTransient(_ => fetcherOptions); services.AddSingleton <INpuServerFetcher, NpuServerFetcher>(); }