public void GetSnapshotTtlMillis_UsesDefaultValueIfNoSpecificValueOrDefaultValueConfigured_DefaultIs1000() { // Arrange const long expectedDefaultSnapshotTtlMillis = 1000; var groupKey = AnyGroupKey; var mockConfig = new MjolnirConfiguration { DefaultBreakerConfiguration = new BreakerConfiguration { SnapshotTtlMillis = expectedDefaultSnapshotTtlMillis } }; var config = new FailurePercentageCircuitBreakerConfig(mockConfig); // Act var value = config.GetSnapshotTtlMillis(groupKey); // Assert Assert.Equal(expectedDefaultSnapshotTtlMillis, value); }
public void GetSnapshotTtlMillis_UsesSpecificValueIfConfigured() { // Arrange var groupKey = AnyGroupKey; var expectedConfigValue = AnyPositiveInt; var mockConfig = new MjolnirConfiguration { BreakerConfigurations = new Dictionary <string, BreakerConfiguration> { { groupKey.Name, new BreakerConfiguration { SnapshotTtlMillis = expectedConfigValue } } } }; var config = new FailurePercentageCircuitBreakerConfig(mockConfig); // Act var value = config.GetSnapshotTtlMillis(groupKey); // Assert Assert.Equal(expectedConfigValue, value); }
public void GetSnapshotTtlMillis_UsesDefaultValueIfNoSpecificValueConfigured() { // Arrange var groupKey = AnyGroupKey; var expectedConfigValue = AnyPositiveInt; var mockConfig = new MjolnirConfiguration { DefaultBreakerConfiguration = new BreakerConfiguration { SnapshotTtlMillis = expectedConfigValue } }; var config = new FailurePercentageCircuitBreakerConfig(mockConfig); // Act var value = config.GetSnapshotTtlMillis(groupKey); // Assert Assert.Equal(expectedConfigValue, value); }