示例#1
0
        public void SuccessAfterRetryTest()
        {
#pragma warning disable 219
            this.iteration = 0;
            Aspect   retryAspect = new RetryCountAspect(3);
            DateTime dt          = (DateTime)this.GetProxy(AspectacularTest.MoreTestAspects(retryAspect)).Invoke(test => test.SimulateFailureNTimes(2, true));

            this.testStart = DateTime.UtcNow;
            retryAspect    = new RetryTimeAspect(300, 100);
            // ReSharper disable once RedundantAssignment
            dt = (DateTime)this.GetProxy(AspectacularTest.MoreTestAspects(retryAspect)).Invoke(test => test.SimulateFailureFor(200, true));

            this.iteration = 0;
            retryAspect    = new RetryCountAspect(3, 50, proxy => proxy.ReturnedValue == null);
            // ReSharper disable once RedundantAssignment
            dt = (DateTime)this.GetProxy(AspectacularTest.MoreTestAspects(retryAspect)).Invoke(test => test.SimulateFailureNTimes(2, false));

            this.testStart = DateTime.UtcNow;
            retryAspect    = new RetryTimeAspect(300, 100, proxy => proxy.ReturnedValue == null);
            // ReSharper disable once RedundantAssignment
            dt = (DateTime)this.GetProxy(AspectacularTest.MoreTestAspects(retryAspect)).Invoke(test => test.SimulateFailureFor(200, false));

            this.testStart = DateTime.UtcNow;
            retryAspect    = new RetryExponentialDelayAspect(300, 10, 2.5, proxy => proxy.ReturnedValue == null);
            // ReSharper disable once RedundantAssignment
            dt = (DateTime)this.GetProxy(AspectacularTest.MoreTestAspects(retryAspect)).Invoke(test => test.SimulateFailureFor(200, false));

#pragma warning restore 219
        }
示例#2
0
        public void SuccessAfterRetryTest()
        {
            #pragma warning disable 219
            this.iteration = 0;
            Aspect retryAspect = new RetryCountAspect(3);
            DateTime dt = (DateTime)this.GetProxy(AspectacularTest.MoreTestAspects(retryAspect)).Invoke(test => test.SimulateFailureNTimes(2, true));

            this.testStart = DateTime.UtcNow;
            retryAspect = new RetryTimeAspect(300, 100);
            // ReSharper disable once RedundantAssignment
            dt = (DateTime)this.GetProxy(AspectacularTest.MoreTestAspects(retryAspect)).Invoke(test => test.SimulateFailureFor(200, true));

            this.iteration = 0;
            retryAspect = new RetryCountAspect(3, 50, proxy => proxy.ReturnedValue == null);
            // ReSharper disable once RedundantAssignment
            dt = (DateTime)this.GetProxy(AspectacularTest.MoreTestAspects(retryAspect)).Invoke(test => test.SimulateFailureNTimes(2, false));

            this.testStart = DateTime.UtcNow;
            retryAspect = new RetryTimeAspect(300, 100, proxy => proxy.ReturnedValue == null);
            // ReSharper disable once RedundantAssignment
            dt = (DateTime)this.GetProxy(AspectacularTest.MoreTestAspects(retryAspect)).Invoke(test => test.SimulateFailureFor(200, false));

            this.testStart = DateTime.UtcNow;
            retryAspect = new RetryExponentialDelayAspect(300, 10, 2.5, proxy => proxy.ReturnedValue == null);
            // ReSharper disable once RedundantAssignment
            dt = (DateTime)this.GetProxy(AspectacularTest.MoreTestAspects(retryAspect)).Invoke(test => test.SimulateFailureFor(200, false));

            #pragma warning restore 219
        }