Ejemplo n.º 1
0
        public void Setup()
        {
            var options = new NpuServerFetcherOptions
            {
                BaseAddress    = "https://ei.npu.edu.ua/",
                CallEndPoint   = "Server.php",
                RequestOptions = NpuServerFetcherOptions.DefaultNpuRequestFetcherOptions()
            };

            _fetcher = new NpuServerFetcher(options);
        }
Ejemplo n.º 2
0
        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>();
        }