public void RetryTest_016()
        {
            var retries          = 0;
            var beforeRetryCount = 0;

            Transient.Retry <Exception>(4,
                                        () => // Code Block to Try
            {
                retries++;
                if (retries <= 4)
                {
                    throw new Exception();
                }
            },
                                        catchExceptionBeforeRetry: (ex, i) => // Catch Exception Before Retry
            {
                beforeRetryCount++;
                Assert.AreEqual(i, beforeRetryCount);
                return(true);                                                            // Yes Retry
            },
                                        catchExceptionAfterFinalRetryAttempt: (ex, i) => // Catch Exception After Final Retry
            {
                Assert.AreEqual(5, i);
            }
                                        );

            Assert.AreEqual(5, retries);
        }
 public void RetryTest_005()
 {
     Transient.Retry(5, () =>
     {
         throw new RetryTestException();
     });
 }
 public void RetryTest_011()
 {
     Transient.Retry <RetryTestException>(() =>
     {
         throw new Exception();
     });
 }
        public void RetryTest_006()
        {
            var i = 0;

            Transient.Retry <Exception>(() =>
            {
                i++;
            });
            Assert.AreEqual(1, i);
        }
        public void RetryTest_001()
        {
            var i = 0;

            Transient.Retry(() =>
            {
                i++;
            });
            Assert.AreEqual(1, i);
        }
        public void RetryTest_012()
        {
            var retries = 0;

            Transient.Retry <RetryTestException>(() =>
            {
                Assert.AreEqual(0, retries);
                retries++;
                throw new Exception();
            });
        }
 public void RetryTest_017()
 {
     Transient.Retry <Exception>(4, () => // Code Block to Try
     {
         throw new Exception();
     },
                                 (ex, i) => // Catch Exception Before Retry
     {
         return(false);                     // No, Do Not Retry
     }
                                 );
 }
        public void RetryTest_007()
        {
            var i = 0;

            Transient.Retry <Exception>(() =>
            {
                i++;
                if (i < 3)
                {
                    throw new Exception();
                }
            });
            Assert.AreEqual(3, i);
        }
        public void RetryTest_003()
        {
            var i = 0;

            Transient.Retry(4, () =>
            {
                i++;
                if (i < 5)
                {
                    throw new Exception();
                }
            });
            Assert.AreEqual(5, i);
        }