예제 #1
0
        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);
        }
예제 #2
0
 public void RetryTest_005()
 {
     Transient.Retry(5, () =>
     {
         throw new RetryTestException();
     });
 }
예제 #3
0
 public void RetryTest_011()
 {
     Transient.Retry <RetryTestException>(() =>
     {
         throw new Exception();
     });
 }
예제 #4
0
        public void RetryTest_006()
        {
            var i = 0;

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

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

            Transient.Retry <RetryTestException>(() =>
            {
                Assert.AreEqual(0, retries);
                retries++;
                throw new Exception();
            });
        }
예제 #7
0
 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
     }
                                 );
 }
예제 #8
0
        public void RetryTest_007()
        {
            var i = 0;

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

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