public void CreateClient_ApplyDangerousAcceptAnyServerCertificate_Success()
        {
            var factory = new ForwarderHttpClientFactory(Mock <ILogger <ForwarderHttpClientFactory> >().Object);
            var options = new HttpClientConfig {
                DangerousAcceptAnyServerCertificate = true
            };
            var client = factory.CreateClient(new ForwarderHttpClientContext {
                NewConfig = options
            });

            var handler = GetHandler(client);

            Assert.NotNull(handler);
            Assert.NotNull(handler.SslOptions.RemoteCertificateValidationCallback);
            Assert.True(handler.SslOptions.RemoteCertificateValidationCallback(default, default, default, default));
        public void CreateClient_ApplySslProtocols_Success()
        {
            var factory = new ForwarderHttpClientFactory(Mock <ILogger <ForwarderHttpClientFactory> >().Object);
            var options = new HttpClientConfig
            {
                SslProtocols = SslProtocols.Tls12 | SslProtocols.Tls13,
            };
            var client = factory.CreateClient(new ForwarderHttpClientContext {
                NewConfig = options
            });

            var handler = GetHandler(client);

            Assert.NotNull(handler);
            Assert.Equal(SslProtocols.Tls12 | SslProtocols.Tls13, handler.SslOptions.EnabledSslProtocols);
            VerifyDefaultValues(handler, "SslProtocols");
        }
        public void CreateClient_Works()
        {
            var factory = new ForwarderHttpClientFactory(Mock <ILogger <ForwarderHttpClientFactory> >().Object);

            var actual1 = factory.CreateClient(new ForwarderHttpClientContext()
            {
                NewConfig = HttpClientConfig.Empty,
                OldConfig = HttpClientConfig.Empty
            });
            var actual2 = factory.CreateClient(new ForwarderHttpClientContext()
            {
                NewConfig = HttpClientConfig.Empty,
                OldConfig = HttpClientConfig.Empty
            });

            Assert.NotNull(actual1);
            Assert.NotNull(actual2);
            Assert.NotSame(actual2, actual1);
        }