@@ -10,9 +10,9 @@ public abstract record RetryStrategyOptions(bool FastFirstRetry);
1010/// </summary>
1111public record FixedIntervalOptions ( bool FastFirstRetry , int RetryCount , TimeSpan RetryInterval ) : RetryStrategyOptions ( FastFirstRetry )
1212{
13- private readonly int retryCount ;
13+ private readonly int retryCount = RetryCount . ThrowIfNegative ( ) ;
1414
15- private readonly TimeSpan retryInterval ;
15+ private readonly TimeSpan retryInterval = RetryInterval . ThrowIfNegative ( ) ;
1616
1717 /// <summary>
1818 /// Initializes a new instance of the <see cref="FixedIntervalOptions" /> record.
@@ -45,11 +45,11 @@ public TimeSpan RetryInterval
4545/// </summary>
4646public record IncrementalOptions ( bool FastFirstRetry , int RetryCount , TimeSpan InitialInterval , TimeSpan Increment ) : RetryStrategyOptions ( FastFirstRetry )
4747{
48- private readonly int retryCount ;
48+ private readonly int retryCount = RetryCount . ThrowIfNegative ( ) ;
4949
50- private readonly TimeSpan initialInterval ;
50+ private readonly TimeSpan initialInterval = InitialInterval . ThrowIfNegative ( ) ;
5151
52- private readonly TimeSpan increment ;
52+ private readonly TimeSpan increment = Increment . ThrowIfNegative ( ) ;
5353
5454 /// <summary>
5555 /// Initializes a new instance of the <see cref="IncrementalOptions" /> record.
@@ -91,13 +91,13 @@ public TimeSpan Increment
9191/// </summary>
9292public record ExponentialBackoffOptions ( bool FastFirstRetry , int RetryCount , TimeSpan MinBackOff , TimeSpan MaxBackOff , TimeSpan DeltaBackOff ) : RetryStrategyOptions ( FastFirstRetry )
9393{
94- private readonly int retryCount ;
94+ private readonly int retryCount = RetryCount . ThrowIfNegative ( ) ;
9595
96- private readonly TimeSpan minBackOff ;
96+ private readonly TimeSpan minBackOff = MinBackOff . ThrowIfOutOfRange ( TimeSpan . Zero , MaxBackOff ) ;
9797
98- private readonly TimeSpan maxBackOff ;
98+ private readonly TimeSpan maxBackOff = MaxBackOff . ThrowIfNegative ( ) ;
9999
100- private readonly TimeSpan deltaBackOff ;
100+ private readonly TimeSpan deltaBackOff = DeltaBackOff . ThrowIfNegative ( ) ;
101101
102102 /// <summary>
103103 /// Initializes a new instance of the <see cref="ExponentialBackoffOptions" /> record.
@@ -120,7 +120,7 @@ public int RetryCount
120120 /// </summary>
121121 public TimeSpan MinBackOff
122122 {
123- get => this . minBackOff ;
123+ get => this . minBackOff . ThrowIfOutOfRange ( TimeSpan . Zero , this . maxBackOff ) ;
124124 init => this . minBackOff = value . ThrowIfNegative ( ) ;
125125 }
126126
0 commit comments