Exemplo n.º 1
0
        public void Retry_Fails(int maxRetryCount, int presetFailureCount)
        {
            var testSubject = new RetryTestSubject(presetFailureCount);

            var result = RetryHelper.Retry(
                () => testSubject.IncrementTryCountAndThrow(),
                maxRetryCount,
                e => testSubject.OnFailure(e));

            result.AsT1.Should().NotBeNull();
            testSubject.TryCount.Should().Be(maxRetryCount + 1);
            testSubject.FailureCount.Should().Be(maxRetryCount);
        }
Exemplo n.º 2
0
        public void Retry_Succeeds(int maxRetryCount, int presetFailureCount, int expectedTryCount)
        {
            var testSubject = new RetryTestSubject(presetFailureCount);

            var result = RetryHelper.Retry(
                () => testSubject.IncrementTryCountAndThrow(),
                maxRetryCount,
                e => testSubject.OnFailure(e));

            result.AsT0.Should().Be(expectedTryCount);
            testSubject.TryCount.Should().Be(expectedTryCount);
            testSubject.FailureCount.Should().Be(presetFailureCount);
        }