public void Should_rethrow_exceptions_on_first_actualization() { configuration.ErrorCallback = _ => {}; provider = new ThrottlingStateProvider(configuration, actualizer); actualizer.When(a => a.Actualize(Arg.Any <ThrottlingState>())).Throw(new Exception("lalala")); Action action = () => provider.ObtainState(); action.Should().Throw <Exception>(); }
public void Should_always_return_the_same_state() { for (var i = 0; i < 100; i++) { provider.ObtainState().Should().BeSameAs(state); } }
public void TestSetup() { essentials = new ThrottlingEssentials { RefreshPeriod = TimeSpan.Zero }; configuration = new ThrottlingConfigurationBuilder() .SetEssentials(() => essentials) .Build(); actualizer = Substitute.For <IThrottlingStateActualizer>(); provider = new ThrottlingStateProvider(configuration, actualizer); state = provider.ObtainState(); actualizer.ClearReceivedCalls(); }