Пример #1
0
        public void GetClient_Should_Return_IHttpClientProvider(string url)
        {
            // Act
            var response = _clientProvider.GetClient(url);

            // Assert
            Assert.NotNull(response);
            Assert.IsInstanceOf <IHttpClientProvider>(response);
        }
        public object CreateFor(Type type, Uri host)
        {
            var client     = HttpClientProvider.GetClient(this.HttpClientSettings, this.HttpClientSettings.DelegatingHandlers.Select(i => i()).ToArray());
            var proxyClass = new HttpClientWrapper(type, client, host, this.HttpClientSettings);

            return(proxyClass.GetTransparentProxy());
        }
Пример #3
0
        public virtual async Task LoadAsync()
        {
            var content = await HttpClientProvider.GetClient().GetStringAsync(Uri);

            using var stream = new StringReader(content);
            using var sgml   = new SgmlReader { DocType = "HTML", CaseFolding = CaseFolding.ToLower, InputStream = stream };

            Content = XDocument.Load(sgml);

            Namespace = Content.Root.Name.Namespace;
        }
Пример #4
0
 protected virtual async Task <HttpClient> GetHttpClient()
 {
     return(await _httpClientProvider.GetClient(Options.Purpose));
 }