diff --git a/Source/TransientFaultHandling.Configuration.Core/RetryStrategyOptions.cs b/Source/TransientFaultHandling.Configuration.Core/RetryStrategyOptions.cs
index 98133c3..bab16fa 100644
--- a/Source/TransientFaultHandling.Configuration.Core/RetryStrategyOptions.cs
+++ b/Source/TransientFaultHandling.Configuration.Core/RetryStrategyOptions.cs
@@ -10,9 +10,9 @@ public abstract record RetryStrategyOptions(bool FastFirstRetry);
///
public record FixedIntervalOptions(bool FastFirstRetry, int RetryCount, TimeSpan RetryInterval) : RetryStrategyOptions(FastFirstRetry)
{
- private readonly int retryCount;
+ private readonly int retryCount = RetryCount.ThrowIfNegative();
- private readonly TimeSpan retryInterval;
+ private readonly TimeSpan retryInterval = RetryInterval.ThrowIfNegative();
///
/// Initializes a new instance of the record.
@@ -45,11 +45,11 @@ public TimeSpan RetryInterval
///
public record IncrementalOptions(bool FastFirstRetry, int RetryCount, TimeSpan InitialInterval, TimeSpan Increment) : RetryStrategyOptions(FastFirstRetry)
{
- private readonly int retryCount;
+ private readonly int retryCount = RetryCount.ThrowIfNegative();
- private readonly TimeSpan initialInterval;
+ private readonly TimeSpan initialInterval = InitialInterval.ThrowIfNegative();
- private readonly TimeSpan increment;
+ private readonly TimeSpan increment = Increment.ThrowIfNegative();
///
/// Initializes a new instance of the record.
@@ -91,13 +91,13 @@ public TimeSpan Increment
///
public record ExponentialBackoffOptions(bool FastFirstRetry, int RetryCount, TimeSpan MinBackOff, TimeSpan MaxBackOff, TimeSpan DeltaBackOff) : RetryStrategyOptions(FastFirstRetry)
{
- private readonly int retryCount;
+ private readonly int retryCount = RetryCount.ThrowIfNegative();
- private readonly TimeSpan minBackOff;
+ private readonly TimeSpan minBackOff = MinBackOff.ThrowIfOutOfRange(TimeSpan.Zero, MaxBackOff);
- private readonly TimeSpan maxBackOff;
+ private readonly TimeSpan maxBackOff = MaxBackOff.ThrowIfNegative();
- private readonly TimeSpan deltaBackOff;
+ private readonly TimeSpan deltaBackOff = DeltaBackOff.ThrowIfNegative();
///
/// Initializes a new instance of the record.
@@ -120,7 +120,7 @@ public int RetryCount
///
public TimeSpan MinBackOff
{
- get => this.minBackOff;
+ get => this.minBackOff.ThrowIfOutOfRange(TimeSpan.Zero, this.maxBackOff);
init => this.minBackOff = value.ThrowIfNegative();
}