コード例 #1
0
        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>();
        }
コード例 #2
0
 public void Should_always_return_the_same_state()
 {
     for (var i = 0; i < 100; i++)
     {
         provider.ObtainState().Should().BeSameAs(state);
     }
 }
コード例 #3
0
        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();
        }