public void GetMinimumOperations_UsesDefaultValueIfNoSpecificValueConfigured() { // Arrange var groupKey = AnyGroupKey; var expectedConfigValue = AnyPositiveInt; var mockConfig = new MjolnirConfiguration { DefaultBreakerConfiguration = new BreakerConfiguration { MinimumOperations = expectedConfigValue } }; var config = new FailurePercentageCircuitBreakerConfig(mockConfig); // Act var value = config.GetMinimumOperations(groupKey); // Assert Assert.Equal(expectedConfigValue, value); }
public void GetMinimumOperations_UsesDefaultValueIfNoSpecificValueOrDefaultValueConfigured_DefaultIs10() { // Arrange const long expectedDefaultMinimumOperations = 10; var groupKey = AnyGroupKey; const int expectedConfigValue = 10; var mockConfig = new MjolnirConfiguration { DefaultBreakerConfiguration = new BreakerConfiguration { MinimumOperations = expectedConfigValue } }; var config = new FailurePercentageCircuitBreakerConfig(mockConfig); // Act var value = config.GetMinimumOperations(groupKey); // Assert Assert.Equal(expectedDefaultMinimumOperations, value); }
public void GetMinimumOperations_UsesSpecificValueIfConfigured() { // Arrange var groupKey = AnyGroupKey; var expectedConfigValue = AnyPositiveInt; var mockConfig = new MjolnirConfiguration { BreakerConfigurations = new Dictionary <string, BreakerConfiguration> { { groupKey.Name, new BreakerConfiguration { MinimumOperations = expectedConfigValue } } } }; var config = new FailurePercentageCircuitBreakerConfig(mockConfig); // Act var value = config.GetMinimumOperations(groupKey); // Assert Assert.Equal(expectedConfigValue, value); }