Пример #1
0
        public void Equals_Same_Value_Returns_True()
        {
            var options1 = new ActiveHealthCheckConfig
            {
                Enabled  = true,
                Interval = TimeSpan.FromSeconds(2),
                Timeout  = TimeSpan.FromSeconds(1),
                Policy   = "Any5xxResponse",
                Path     = "/a",
            };

            var options2 = new ActiveHealthCheckConfig
            {
                Enabled  = true,
                Interval = TimeSpan.FromSeconds(2),
                Timeout  = TimeSpan.FromSeconds(1),
                Policy   = "any5xxResponse",
                Path     = "/a",
            };

            var equals = options1.Equals(options2);

            Assert.True(equals);
            Assert.Equal(options1.GetHashCode(), options2.GetHashCode());
        }
        private ClusterModel GetClusterConfig(string id, ActiveHealthCheckConfig healthCheckOptions, Version version
#if NET
                                              , HttpVersionPolicy versionPolicy = HttpVersionPolicy.RequestVersionExact
#endif
                                              )
        {
            return(new ClusterModel(
                       new ClusterConfig
            {
                ClusterId = id,
                HealthCheck = new HealthCheckConfig()
                {
                    Active = healthCheckOptions,
                },
                HttpRequest = new ForwarderRequestConfig
                {
                    Timeout = TimeSpan.FromSeconds(60),
                    Version = version,
#if NET
                    VersionPolicy = versionPolicy,
#endif
                }
            },
                       new HttpMessageInvoker(new HttpClientHandler())));
        }
Пример #3
0
        public void Equals_Second_Null_Returns_False()
        {
            var options1 = new ActiveHealthCheckConfig();

            var equals = options1.Equals(null);

            Assert.False(equals);
        }
Пример #4
0
        public void Equals_Different_Value_Returns_False()
        {
            var options1 = new ActiveHealthCheckConfig
            {
                Enabled  = true,
                Interval = TimeSpan.FromSeconds(2),
                Timeout  = TimeSpan.FromSeconds(1),
                Policy   = "Any5xxResponse",
                Path     = "/a",
            };

            var options2 = new ActiveHealthCheckConfig
            {
                Enabled  = false,
                Interval = TimeSpan.FromSeconds(4),
                Timeout  = TimeSpan.FromSeconds(2),
                Policy   = "AnyFailure",
                Path     = "/b",
            };

            var equals = options1.Equals(options2);

            Assert.False(equals);
        }