示例#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 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();
        }