コード例 #1
0
        public void BuilderWithServerIdPropagatesToInstance()
        {
            // given
            const int serverId = 1;
            var       target   = new HttpClientConfiguration.Builder().WithServerId(serverId);

            // when
            var obtained = target.Build();

            // then
            Assert.That(obtained.ServerId, Is.EqualTo(serverId));
        }
コード例 #2
0
        public void BuilderWithTrustManagerPropagatesToInstance()
        {
            // given
            var trustManager = Substitute.For <ISSLTrustManager>();
            var target       = new HttpClientConfiguration.Builder().WithTrustManager(trustManager);

            // when
            var obtained = target.Build();

            // then
            Assert.That(obtained.SslTrustManager, Is.SameAs(trustManager));
        }
コード例 #3
0
        public void BuilderWithApplicationIdPropagatesToInstance()
        {
            // given
            const string applicationId = "some cryptic appId";
            var          target        = new HttpClientConfiguration.Builder().WithApplicationId(applicationId);

            // when
            var obtained = target.Build();

            // then
            Assert.That(obtained.ApplicationId, Is.EqualTo(applicationId));
        }
コード例 #4
0
        public void BuilderWithBaseUrlPropagatesToInstance()
        {
            // given
            const string baseUrl = "https://localhost:9999/1";
            var          target  = new HttpClientConfiguration.Builder().WithBaseUrl(baseUrl);

            // when
            var obtained = target.Build();

            // then
            Assert.That(obtained.BaseUrl, Is.EqualTo(baseUrl));
        }
コード例 #5
0
        public void BuilderWithHttpResponseInterceptorPropagatesToInstance()
        {
            // given
            var httpResponseInterceptor = Substitute.For <IHttpResponseInterceptor>();
            var target = new HttpClientConfiguration.Builder()
                         .WithHttpResponseInterceptor(httpResponseInterceptor);

            // when
            var obtained = target.Build();

            // then
            Assert.That(obtained.HttpResponseInterceptor, Is.SameAs(httpResponseInterceptor));
        }
コード例 #6
0
        public void EmptyBuilderCreatesEmptyInstance()
        {
            // given
            var target = new HttpClientConfiguration.Builder();

            // when
            var obtained = target.Build();

            // then
            Assert.That(obtained.BaseUrl, Is.Null);
            Assert.That(obtained.ApplicationId, Is.Null);
            Assert.That(obtained.SslTrustManager, Is.Null);
            Assert.That(obtained.ServerId, Is.EqualTo(-1));
        }