public void SqlRetryTest_008() { var catchExceptionBeforeRetryCalled = false; var catchExceptionAfterFinalRetryAttemptCalled = false; var tries = 0; Transient.SqlRetry(5, () => { tries++; throw SqlExceptionHelper.Generate(SqlExceptionNumber.TimeoutExpired); }, (ex, i) => { Assert.IsNotNull(ex); Assert.IsInstanceOfType(ex, typeof(SqlException)); catchExceptionBeforeRetryCalled = true; return(true); }, (ex, i) => { Assert.IsNotNull(ex); Assert.IsInstanceOfType(ex, typeof(SqlException)); catchExceptionAfterFinalRetryAttemptCalled = true; }); Assert.AreEqual(6, tries); Assert.IsTrue(catchExceptionBeforeRetryCalled); Assert.IsTrue(catchExceptionAfterFinalRetryAttemptCalled); }
public void SqlRetryTest_001() { var tries = 0; Transient.SqlRetry(() => { tries++; }); Assert.AreEqual(1, tries); }
public void SqlRetryTest_005() { var tries = 0; Transient.SqlRetry(() => { tries++; Assert.AreEqual(1, tries); throw new RetryTestException(); }); }
public void SqlRetryTest_004() { var tries = 0; Transient.SqlRetry(() => { tries++; if (tries < 2) { throw SqlExceptionHelper.Generate(SqlExceptionNumber.TransportLevelSending); } }); Assert.AreEqual(2, tries); }
public void SqlRetryTest_002() { var tries = 0; Transient.SqlRetry(() => { tries++; if (tries < 2) { throw SqlExceptionHelper.Generate(SqlExceptionNumber.TimeoutExpired); } }); Assert.AreEqual(2, tries); }
public void SqlRetryTest_006() { var tries = 0; Transient.SqlRetry(() => { tries++; if (tries < 2) { throw SqlExceptionHelper.Generate(500000); } }); // only 1 is expected since it's not a Transient SqlException error number Assert.AreEqual(1, tries); }