public void TestSetup() { currentTime = DateTime.UtcNow; getCurrentTime = () => currentTime; implementation = new AdaptiveHealthWithLinearDecay(getCurrentTime, 5.Minutes(), 2, 0.25, 0.002); }
public void SetUp() { timeProvider = Substitute.For <ITimeProvider>(); timeProvider.GetCurrentTime().Returns(currentTime = DateTime.UtcNow); implementation = new AdaptiveHealthWithLinearDecay(timeProvider, 5.Minutes(), 2, 0.25, 0.002); }
public void Ctor_should_throw_an_error_when_decay_duration_is_zero() { Action action = () => implementation = new AdaptiveHealthWithLinearDecay(getCurrentTime, TimeSpan.Zero, 2, 0.5, 0.002); action.Should().Throw <ArgumentOutOfRangeException>().Which.ShouldBePrinted(); }
public void Ctor_should_throw_an_error_when_minimum_health_value_is_incorrect(double value) { Action action = () => implementation = new AdaptiveHealthWithLinearDecay(getCurrentTime, 5.Minutes(), 2, 0.5, value); action.Should().Throw <ArgumentOutOfRangeException>().Which.ShouldBePrinted(); }
public void Ctor_should_throw_an_error_when_decay_duration_is_negative() { Action action = () => implementation = new AdaptiveHealthWithLinearDecay(timeProvider, -5.Minutes(), 2, 0.5, 0.002); action.ShouldThrow <ArgumentOutOfRangeException>().Which.ShouldBePrinted(); }
public void Ctor_should_throw_an_error_when_down_multiplier_is_incorrect(double value) { Action action = () => implementation = new AdaptiveHealthWithLinearDecay(timeProvider, 5.Minutes(), 2, value, 0.01); action.ShouldThrow <ArgumentOutOfRangeException>().Which.ShouldBePrinted(); }