Exemple #1
0
        public void GetForceFixed_UsesDefaultValueIfNoSpecificValueOrDefaultValueConfigured_DefaultIsFalse()
        {
            // Arrange

            const bool expectedDefaultForceFixed = false;

            var groupKey = AnyGroupKey;

            var mockConfig = new MjolnirConfiguration
            {
                DefaultBreakerConfiguration = new BreakerConfiguration
                {
                    ForceFixed = expectedDefaultForceFixed
                }
            };
            var config = new FailurePercentageCircuitBreakerConfig(mockConfig);

            // Act

            var value = config.GetForceFixed(groupKey);

            // Assert

            Assert.Equal(expectedDefaultForceFixed, value);
        }
Exemple #2
0
        public void GetForceFixed_UsesSpecificValueIfConfigured()
        {
            // Arrange

            var groupKey            = AnyGroupKey;
            var expectedConfigValue = AnyBool;

            var mockConfig = new MjolnirConfiguration
            {
                BreakerConfigurations = new Dictionary <string, BreakerConfiguration>
                {
                    {
                        groupKey.Name,
                        new BreakerConfiguration
                        {
                            ForceFixed = expectedConfigValue
                        }
                    }
                }
            };

            var config = new FailurePercentageCircuitBreakerConfig(mockConfig);

            // Act

            var value = config.GetForceFixed(groupKey);

            // Assert

            Assert.Equal(expectedConfigValue, value);
        }
Exemple #3
0
        public void GetForceFixed_UsesDefaultValueIfNoSpecificValueConfigured()
        {
            // Arrange

            var groupKey            = AnyGroupKey;
            var expectedConfigValue = AnyBool;

            var mockConfig = new MjolnirConfiguration
            {
                DefaultBreakerConfiguration = new BreakerConfiguration
                {
                    ForceFixed = expectedConfigValue
                }
            };
            var config = new FailurePercentageCircuitBreakerConfig(mockConfig);

            // Act

            var value = config.GetForceFixed(groupKey);

            // Assert

            Assert.Equal(expectedConfigValue, value);
        }