public virtual void TestRetryForever() { UnreliableInterface unreliable = (UnreliableInterface)RetryProxy.Create <UnreliableInterface >(unreliableImpl, RetryPolicies.RetryForever); unreliable.AlwaysSucceeds(); unreliable.FailsOnceThenSucceeds(); unreliable.FailsTenTimesThenSucceeds(); }
public virtual void TestExponentialRetry() { UnreliableInterface unreliable = (UnreliableInterface)RetryProxy.Create <UnreliableInterface >(unreliableImpl, RetryPolicies.ExponentialBackoffRetry(5, 1L, TimeUnit.Nanoseconds )); unreliable.AlwaysSucceeds(); unreliable.FailsOnceThenSucceeds(); try { unreliable.FailsTenTimesThenSucceeds(); NUnit.Framework.Assert.Fail("Should fail"); } catch (UnreliableInterface.UnreliableException) { } }
public virtual void TestRetryUpToMaximumCountWithProportionalSleep() { UnreliableInterface unreliable = (UnreliableInterface)RetryProxy.Create <UnreliableInterface >(unreliableImpl, RetryPolicies.RetryUpToMaximumCountWithProportionalSleep(8, 1, TimeUnit.Nanoseconds)); unreliable.AlwaysSucceeds(); unreliable.FailsOnceThenSucceeds(); try { unreliable.FailsTenTimesThenSucceeds(); NUnit.Framework.Assert.Fail("Should fail"); } catch (UnreliableInterface.UnreliableException) { } }