5
5
using Shouldly ;
6
6
7
7
[ TestFixture ]
8
- public class RetryOperationExponentialBackoffTests
8
+ public class OperationWithExponentialBackoffTests
9
9
{
10
10
[ Test ]
11
11
public void RetryOperationThrowsWhenNegativeMaxRetries ( )
12
12
{
13
- Action action = ( ) => new RetryOperationExponentialBackoff < IOException > ( new MockThreadSleep ( ) , ( ) => { } , - 1 ) ;
13
+ Action action = ( ) => new OperationWithExponentialBackoff < IOException > ( new MockThreadSleep ( ) , ( ) => { } , - 1 ) ;
14
14
action . ShouldThrow < ArgumentOutOfRangeException > ( ) ;
15
15
}
16
16
17
17
[ Test ]
18
18
public void RetryOperationThrowsWhenThreadSleepIsNull ( )
19
19
{
20
- Action action = ( ) => new RetryOperationExponentialBackoff < IOException > ( null , ( ) => { } ) ;
20
+ Action action = ( ) => new OperationWithExponentialBackoff < IOException > ( null , ( ) => { } ) ;
21
21
action . ShouldThrow < ArgumentNullException > ( ) ;
22
22
}
23
23
@@ -29,7 +29,7 @@ public void OperationIsNotRetriedOnInvalidException()
29
29
throw new Exception ( ) ;
30
30
} ;
31
31
32
- var retryOperation = new RetryOperationExponentialBackoff < IOException > ( new MockThreadSleep ( ) , operation ) ;
32
+ var retryOperation = new OperationWithExponentialBackoff < IOException > ( new MockThreadSleep ( ) , operation ) ;
33
33
Action action = ( ) => retryOperation . Execute ( ) ;
34
34
action . ShouldThrow < Exception > ( ) ;
35
35
}
@@ -48,7 +48,7 @@ public void OperationIsRetriedOnIOException()
48
48
}
49
49
} ;
50
50
51
- var retryOperation = new RetryOperationExponentialBackoff < IOException > ( new MockThreadSleep ( ) , operation ) ;
51
+ var retryOperation = new OperationWithExponentialBackoff < IOException > ( new MockThreadSleep ( ) , operation ) ;
52
52
retryOperation . Execute ( ) ;
53
53
54
54
operationCount . ShouldBe ( 2 ) ;
@@ -66,7 +66,7 @@ public void OperationIsRetriedAMaximumNumberOfTimes()
66
66
throw new IOException ( ) ;
67
67
} ;
68
68
69
- var retryOperation = new RetryOperationExponentialBackoff < IOException > ( new MockThreadSleep ( ) , operation , numberOfRetries ) ;
69
+ var retryOperation = new OperationWithExponentialBackoff < IOException > ( new MockThreadSleep ( ) , operation , numberOfRetries ) ;
70
70
Action action = ( ) => retryOperation . Execute ( ) ;
71
71
action . ShouldThrow < AggregateException > ( ) ;
72
72
@@ -92,7 +92,7 @@ public void OperationDelayDoublesBetweenRetries()
92
92
expectedSleepMSec *= 2 ;
93
93
} ;
94
94
95
- var retryOperation = new RetryOperationExponentialBackoff < IOException > ( new MockThreadSleep ( validator ) , operation , numberOfRetries ) ;
95
+ var retryOperation = new OperationWithExponentialBackoff < IOException > ( new MockThreadSleep ( validator ) , operation , numberOfRetries ) ;
96
96
Action action = ( ) => retryOperation . Execute ( ) ;
97
97
action . ShouldThrow < AggregateException > ( ) ;
98
98
@@ -115,7 +115,7 @@ public void TotalSleepTimeForSixRetriesIsAboutThirtySeconds()
115
115
totalSleep += u ;
116
116
} ;
117
117
118
- var retryOperation = new RetryOperationExponentialBackoff < IOException > ( new MockThreadSleep ( validator ) , operation , numberOfRetries ) ;
118
+ var retryOperation = new OperationWithExponentialBackoff < IOException > ( new MockThreadSleep ( validator ) , operation , numberOfRetries ) ;
119
119
Action action = ( ) => retryOperation . Execute ( ) ;
120
120
action . ShouldThrow < AggregateException > ( ) ;
121
121
0 commit comments