コード例 #1
0
        public void Should_incur_a_cooldown_after_recreating_current_value_provider()
        {
            SetupProvidersFactory();

            retryingCurrentValueProvider = new RetryingCurrentValueProvider <object>(currentValueProviderFactory, 250.Milliseconds());

            var result = new object();

            providers[0].Get().ThrowsForAnyArgs <Exception>();
            providers[1].Get().ThrowsForAnyArgs <Exception>();
            providers[2].Get().Returns(result);

            var getAction = new Action(() => retryingCurrentValueProvider.Get());

            getAction.Should().Throw <Exception>();

            new Action(() => getAction.Should().NotThrow()).ShouldPassIn(10.Seconds());

            retryingCurrentValueProvider.Get().Should().BeSameAs(result);

            providers[0].Received(1).Dispose();
            providers[1].Received(1).Dispose();
            providers[2].DidNotReceive().Dispose();
        }
コード例 #2
0
        public void SetUp()
        {
            SetupProvidersFactory();

            retryingCurrentValueProvider = new RetryingCurrentValueProvider <object>(currentValueProviderFactory, TimeSpan.Zero);
        }