public void Test_default_property_values_set()
		{
			var d = new DeadlockRetryManager();
			Assert.AreEqual(3, d.MaxAttempts);
			Assert.AreEqual(100, d.MinWaitTime);
			Assert.AreEqual(500, d.MaxWaitTime);
		}
		public void Test_no_failure()
		{
			var count = 0;
			using(var d = new DeadlockRetryManager())
			{
				d.Execute(delegate
				          {
				          	count++;
				          });
			}

			// exactly 1 execution
			Assert.AreEqual(1, count);
		}
Beispiel #3
0
 public void Test_fail_with_other_exception_does_not_retry()
 {
     using (var d = new DeadlockRetryManager()
     {
         MaxAttempts = 3
     })
     {
         d.Execute(delegate
         {
             // only a DeadlockException will cause a retry
             throw new Exception();
         });
     }
 }
Beispiel #4
0
        public void Test_no_failure()
        {
            var count = 0;

            using (var d = new DeadlockRetryManager())
            {
                d.Execute(delegate
                {
                    count++;
                });
            }

            // exactly 1 execution
            Assert.AreEqual(1, count);
        }
		public void Test_fail_2x_with_DeadlockException()
		{
			var count = 0;
			using (var d = new DeadlockRetryManager())
			{
				d.Execute(delegate
				{
					count++;
					if (count <= 2)
						throw new DeadlockException();
				});
			}

			// exactly 3 execution
			Assert.AreEqual(3, count);
		}
Beispiel #6
0
        public void Test_fail_2x_with_DeadlockException()
        {
            var count = 0;

            using (var d = new DeadlockRetryManager())
            {
                d.Execute(delegate
                {
                    count++;
                    if (count <= 2)
                    {
                        throw new DeadlockException();
                    }
                });
            }

            // exactly 3 execution
            Assert.AreEqual(3, count);
        }
Beispiel #7
0
        public void Test_fail_3x_with_DeadlockException()
        {
            var count = 0;

            using (var d = new DeadlockRetryManager()
            {
                MaxAttempts = 3
            })
            {
                d.Execute(delegate
                {
                    count++;
                    if (count <= 3)
                    {
                        throw new DeadlockException();
                    }
                });
            }
        }
		public void Test_fail_3x_with_DeadlockException()
		{
			var count = 0;
			using (var d = new DeadlockRetryManager() {MaxAttempts = 3})
			{
				d.Execute(delegate
				{
					count++;
					if (count <= 3)
						throw new DeadlockException();
				});
			}
		}
		public void Test_fail_with_other_exception_does_not_retry()
		{
			using (var d = new DeadlockRetryManager() { MaxAttempts = 3 })
			{
				d.Execute(delegate
				{
					// only a DeadlockException will cause a retry
					throw new Exception();
				});
			}
		}