コード例 #1
0
        public void Equals_Different_Value_Returns_False()
        {
            // Arrange
            var options1 = new HealthCheckOptions
            {
                Enabled  = true,
                Interval = TimeSpan.FromSeconds(2),
                Timeout  = TimeSpan.FromSeconds(1),
                Port     = 123,
                Path     = "/a",
            };

            var options2 = new HealthCheckOptions
            {
                Enabled  = false,
                Interval = TimeSpan.FromSeconds(4),
                Timeout  = TimeSpan.FromSeconds(2),
                Port     = 246,
                Path     = "/b",
            };

            // Act
            var equals = HealthCheckOptions.Equals(options1, options2);

            // Assert
            Assert.False(equals);
        }
コード例 #2
0
        public void Equals_Second_Null_Returns_False()
        {
            var options1 = new HealthCheckOptions();

            var equals = options1.Equals(null);

            Assert.False(equals);
        }
コード例 #3
0
        public void Equals_Both_Null_Returns_True()
        {
            // Arrange

            // Act
            var equals = HealthCheckOptions.Equals(null, null);

            // Assert
            Assert.True(equals);
        }
コード例 #4
0
        public void Equals_Second_Null_Returns_False()
        {
            // Arrange
            var options1 = new HealthCheckOptions
            {
                Enabled  = true,
                Interval = TimeSpan.FromSeconds(2),
                Timeout  = TimeSpan.FromSeconds(1),
                Port     = 123,
                Path     = "/a",
            };

            // Act
            var equals = HealthCheckOptions.Equals(options1, null);

            // Assert
            Assert.False(equals);
        }
コード例 #5
0
        public void Equals_First_Null_Returns_False()
        {
            // Arrange
            var options2 = new HealthCheckOptions
            {
                Enabled  = false,
                Interval = TimeSpan.FromSeconds(4),
                Timeout  = TimeSpan.FromSeconds(2),
                Port     = 246,
                Path     = "/b",
            };

            // Act
            var equals = HealthCheckOptions.Equals(null, options2);

            // Assert
            Assert.False(equals);
        }
コード例 #6
0
        public void Equals_Different_Value_Returns_False()
        {
            var options1 = new HealthCheckOptions
            {
                Active = new ActiveHealthCheckOptions
                {
                    Enabled  = true,
                    Interval = TimeSpan.FromSeconds(2),
                    Timeout  = TimeSpan.FromSeconds(1),
                    Policy   = "Any5xxResponse",
                    Path     = "/a",
                },
                Passive = new PassiveHealthCheckOptions
                {
                    Enabled            = true,
                    Policy             = "Passive",
                    ReactivationPeriod = TimeSpan.FromSeconds(5),
                }
            };

            var options2 = new HealthCheckOptions
            {
                Active = new ActiveHealthCheckOptions
                {
                    Enabled  = true,
                    Interval = TimeSpan.FromSeconds(2),
                    Timeout  = TimeSpan.FromSeconds(1),
                    Policy   = "Different",
                    Path     = "/a",
                },
                Passive = new PassiveHealthCheckOptions
                {
                    Enabled            = true,
                    Policy             = "Passive",
                    ReactivationPeriod = TimeSpan.FromSeconds(5),
                }
            };

            var equals = options1.Equals(options2);

            Assert.False(equals);
        }