示例#1
0
        public virtual void TestRetryForever()
        {
            UnreliableInterface unreliable = (UnreliableInterface)RetryProxy.Create <UnreliableInterface
                                                                                     >(unreliableImpl, RetryPolicies.RetryForever);

            unreliable.AlwaysSucceeds();
            unreliable.FailsOnceThenSucceeds();
            unreliable.FailsTenTimesThenSucceeds();
        }
示例#2
0
        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)
            {
            }
        }
示例#3
0
        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)
            {
            }
        }