public void Init()
        {
            nugetSettings = new NugetSettings
            {
                PackageMetadata = "https://api/test/metadata.nuget.org",
                Search          = "https://api/test/search.nuget.org",
            };

            Mock <IOptions <NugetSettings> > optionsMock = new Mock <IOptions <NugetSettings> >();

            optionsMock
            .Setup(options => options.Value)
            .Returns(nugetSettings);

            handlerMock = new Mock <HttpMessageHandler>(MockBehavior.Strict);
            handlerMock
            .Protected()
            .Setup <Task <HttpResponseMessage> >(
                "SendAsync",
                ItExpr.IsAny <HttpRequestMessage>(),
                ItExpr.IsAny <CancellationToken>()
                )
            .ReturnsAsync(new HttpResponseMessage()
            {
                StatusCode = HttpStatusCode.OK,
                Content    = new StringContent("[{'id':1,'value':'1'}]"),
            });

            HttpClient httpClient = new HttpClient(handlerMock.Object);

            nugetHttpService = new NugetHttpService(httpClient, optionsMock.Object);
        }
 public NugetSettings GetNugetSettings()
 {
     if (_nugetSettings == null)
     {
         string watcherSettingsjson = GetNugetSettingsJson();
         _nugetSettings = ObjectConverter.Instance.GetWatcherSettingsFromJson(watcherSettingsjson);
     }
     return(_nugetSettings);
 }
        public NugetHttpService(HttpClient httpClient, IOptions <NugetSettings> nugetSettings)
        {
            this.httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
            if (nugetSettings == null)
            {
                throw new ArgumentNullException(nameof(nugetSettings));
            }

            this.nugetSettings = nugetSettings.Value;
        }