public PackageDownloader( HttpClient httpClient, ICommonTelemetryService telemetryService, ILogger <PackageDownloader> logger) { _httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient)); _telemetryService = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public FileDownloader( HttpClient httpClient, ICommonTelemetryService telemetryService, IOptionsSnapshot <FileDownloaderConfiguration> downloaderConfigurationAccessor, ILogger <FileDownloader> logger) { _httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient)); _telemetryService = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService)); if (downloaderConfigurationAccessor == null) { throw new ArgumentNullException(nameof(downloaderConfigurationAccessor)); } if (downloaderConfigurationAccessor.Value.BufferSize <= 0) { throw new ArgumentException($"{nameof(downloaderConfigurationAccessor.Value.BufferSize)} cannot be less than 1", nameof(downloaderConfigurationAccessor)); } _configuration = downloaderConfigurationAccessor.Value; _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }