public HttpRequestParamsCalculator(HttpRequestParamsCalculatorOptions options)
        {
            _options = options ?? throw new ArgumentNullException(nameof(options));

            options.AssertValid();

            _bytesPerSecond = options.DataRateMBps * (int)1E6;
        }
Beispiel #2
0
        /// <summary>
        /// Adds to IoC <see cref="IHttpRequestParamsCalculator"/>
        /// </summary>
        public static IServiceCollection AddHttpRequestTimesCalculator(
            this IServiceCollection services,
            HttpRequestParamsCalculatorOptions options)
        {
            options.AssertValid();

            services.TryAddSingleton(options);
            services.TryAddSingleton <IHttpRequestParamsCalculator, HttpRequestParamsCalculator>();

            return(services);
        }