public OperationWithExponentialBackoffTests()
        {
            var sp = ConfigureServices();

            log         = sp.GetService <ILog>();
            threadSleep = Substitute.For <IThreadSleep>();
        }
        public OperationWithExponentialBackoff(IThreadSleep threadSleep, Action operation, int maxRetries = 5)
        {
            if (maxRetries < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(maxRetries));
            }

            ThreadSleep = threadSleep ?? throw new ArgumentNullException(nameof(threadSleep));
            Operation   = operation;
            MaxRetries  = maxRetries;
        }
        public OperationWithExponentialBackoff(IThreadSleep threadSleep, Action operation, int maxRetries = 5)
        {
            if (threadSleep == null)
            {
                throw new ArgumentNullException("threadSleep");
            }
            if (maxRetries < 0)
            {
                throw new ArgumentOutOfRangeException("maxRetries");
            }

            this.ThreadSleep = threadSleep;
            this.Operation   = operation;
            this.MaxRetries  = maxRetries;
        }
 public OperationWithExponentialBackoff(IThreadSleep threadSleep, ILog log, Action operation, int maxRetries = 5)
     : base(threadSleep, log, () => { operation(); return(false); }, maxRetries)
 {
 }
Beispiel #5
0
 public Class1(IThreadSleep threadSleep)
 {
     _threadSleep = threadSleep;
 }