예제 #1
0
        public void CreateRequest_RequestVersionProperties(string versionString)
        {
            var version = versionString != null?Version.Parse(versionString) : null;

            var clusterConfig = GetClusterConfig("cluster0",
                                                 new ActiveHealthCheckOptions()
            {
                Enabled = true,
                Policy  = "policy",
            },
                                                 version
#if NET
                                                 , HttpVersionPolicy.RequestVersionExact
#endif
                                                 );
            var destinationConfig = new DestinationConfig("https://localhost:10000/", null);
            var factory           = new DefaultProbingRequestFactory();

            var request = factory.CreateRequest(clusterConfig, destinationConfig);

            Assert.Equal(version ?? HttpVersion.Version20, request.Version);
#if NET
            Assert.Equal(HttpVersionPolicy.RequestVersionExact, request.VersionPolicy);
#endif
        }
        public void CreateRequest_HealthEndpointIsNotDefined_UseDestinationAddress(string address, string health, string healthPath, string expectedRequestUri)
        {
            var clusterConfig     = GetClusterConfig("cluster0", new ClusterActiveHealthCheckOptions(true, null, null, "policy", healthPath), HttpVersion.Version20);
            var destinationConfig = new DestinationConfig(address, health);
            var factory           = new DefaultProbingRequestFactory();

            var request = factory.CreateRequest(clusterConfig, destinationConfig);

            Assert.Equal(expectedRequestUri, request.RequestUri.AbsoluteUri);
        }