Exemple #1
0
        public void BuilderFromHttpClientConfigTakesHttpResponseInterceptor()
        {
            // given
            var httpResponseInterceptor = Substitute.For <IHttpResponseInterceptor>();
            var httpConfig = Substitute.For <IHttpClientConfiguration>();

            httpConfig.HttpResponseInterceptor.Returns(httpResponseInterceptor);

            // when
            var target = HttpClientConfiguration.ModifyWith(httpConfig).Build();

            // then
            _ = httpConfig.Received(1).HttpResponseInterceptor;
            Assert.That(target.HttpResponseInterceptor, Is.SameAs(httpResponseInterceptor));
        }
Exemple #2
0
        public void BuilderFromHttpClientConfigTakesOverServerId()
        {
            // given
            const int serverId   = 1;
            var       httpConfig = Substitute.For <IHttpClientConfiguration>();

            httpConfig.ServerId.Returns(serverId);

            // when
            var target = HttpClientConfiguration.ModifyWith(httpConfig).Build();

            // then
            _ = httpConfig.Received(1).ServerId;
            Assert.That(target.ServerId, Is.EqualTo(serverId));
        }
Exemple #3
0
        public void BuilderFromHttpClientConfigTakesOverApplicationId()
        {
            // given
            const string applicationId = "some cryptic appId";
            var          httpConfig    = Substitute.For <IHttpClientConfiguration>();

            httpConfig.ApplicationId.Returns(applicationId);

            // when
            var target = HttpClientConfiguration.ModifyWith(httpConfig).Build();

            // then
            _ = httpConfig.Received(1).ApplicationId;
            Assert.That(target.ApplicationId, Is.SameAs(applicationId));
        }
Exemple #4
0
        public void BuilderFromHttpClientConfigTakesOverTrustManager()
        {
            // given
            var trustManager = Substitute.For <ISSLTrustManager>();
            var httpConfig   = Substitute.For <IHttpClientConfiguration>();

            httpConfig.SslTrustManager.Returns(trustManager);

            // when
            var target = HttpClientConfiguration.ModifyWith(httpConfig).Build();

            // then
            _ = httpConfig.Received(1).SslTrustManager;
            Assert.That(target.SslTrustManager, Is.SameAs(trustManager));
        }
Exemple #5
0
        public void BuilderFromHttpClientConfigTakesOverBaseUrl()
        {
            // given
            const string baseUrl    = "https://localhost:9999/1";
            var          httpConfig = Substitute.For <IHttpClientConfiguration>();

            httpConfig.BaseUrl.Returns(baseUrl);

            // when
            var target = HttpClientConfiguration.ModifyWith(httpConfig).Build();

            // then
            _ = httpConfig.Received(1).BaseUrl;
            Assert.That(target.BaseUrl, Is.EqualTo(baseUrl));
        }