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(); }); } }
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_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); }
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); }
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(); }); } }