Skip to content

Commit

Permalink
Fix unit test failure.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dixin committed Jan 27, 2024
1 parent 0b96fb6 commit b3831bd
Showing 1 changed file with 63 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ public abstract record RetryStrategyOptions(bool FastFirstRetry);
/// </summary>
public record FixedIntervalOptions(bool FastFirstRetry, int RetryCount, TimeSpan RetryInterval) : RetryStrategyOptions(FastFirstRetry)
{
private readonly int retryCount;

private readonly TimeSpan retryInterval;

/// <summary>
/// Initializes a new instance of the <see cref="FixedIntervalOptions" /> record.
/// </summary>
Expand All @@ -20,19 +24,33 @@ public FixedIntervalOptions() : this(RetryStrategy.DefaultFirstFastRetry, defaul
/// <summary>
/// Gets or sets the retry count.
/// </summary>
public int RetryCount { get; init; } = RetryCount.ThrowIfNegative();
public int RetryCount
{
get => this.retryCount;
init => this.retryCount = value.ThrowIfNegative();
}

/// <summary>
/// Gets the time interval between retries.
/// </summary>
public TimeSpan RetryInterval { get; init; } = RetryInterval.ThrowIfNegative();
public TimeSpan RetryInterval
{
get => this.retryInterval;
init => this.retryInterval = value.ThrowIfNegative();
}
}

/// <summary>
/// Represents the options for <see cref="Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.Incremental" /> retry strategy.
/// </summary>
public record IncrementalOptions(bool FastFirstRetry, int RetryCount, TimeSpan InitialInterval, TimeSpan Increment) : RetryStrategyOptions(FastFirstRetry)

Check warning on line 46 in Source/TransientFaultHandling.Configuration.Core/RetryStrategyOptions.cs

View workflow job for this annotation

GitHub Actions / build

Parameter 'RetryCount' is unread. Did you forget to use it to initialize the property with that name?
{
private readonly int retryCount;

private readonly TimeSpan initialInterval;

private readonly TimeSpan increment;

/// <summary>
/// Initializes a new instance of the <see cref="IncrementalOptions" /> record.
/// </summary>
Expand All @@ -43,24 +61,44 @@ public IncrementalOptions() : this(RetryStrategy.DefaultFirstFastRetry, default,
/// <summary>
/// Gets the maximum number of retry attempts.
/// </summary>
public int RetryCount { get; init; } = RetryCount.ThrowIfNegative();
public int RetryCount
{
get => this.retryCount;
init => this.retryCount = value.ThrowIfNegative();
}

/// <summary>
/// Gets the initial interval that will apply for the first retry.
/// </summary>
public TimeSpan InitialInterval { get; init; } = InitialInterval.ThrowIfNegative();
public TimeSpan InitialInterval
{
get => this.initialInterval;
init => this.initialInterval = value.ThrowIfNegative();
}

/// <summary>
/// Gets the incremental time value that will be used to calculate the progressive delay between retries..
/// </summary>
public TimeSpan Increment { get; init; } = Increment.ThrowIfNegative();
public TimeSpan Increment
{
get => this.increment;
init => this.increment = value.ThrowIfNegative();
}
}

/// <summary>
/// Represents the options for <see cref="Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.ExponentialBackoff" /> retry strategy.
/// </summary>
public record ExponentialBackoffOptions(bool FastFirstRetry, int RetryCount, TimeSpan MinBackOff, TimeSpan MaxBackOff, TimeSpan DeltaBackOff) : RetryStrategyOptions(FastFirstRetry)

Check warning on line 92 in Source/TransientFaultHandling.Configuration.Core/RetryStrategyOptions.cs

View workflow job for this annotation

GitHub Actions / build

Parameter 'RetryCount' is unread. Did you forget to use it to initialize the property with that name?

Check warning on line 92 in Source/TransientFaultHandling.Configuration.Core/RetryStrategyOptions.cs

View workflow job for this annotation

GitHub Actions / build

Parameter 'MinBackOff' is unread. Did you forget to use it to initialize the property with that name?

Check warning on line 92 in Source/TransientFaultHandling.Configuration.Core/RetryStrategyOptions.cs

View workflow job for this annotation

GitHub Actions / build

Parameter 'MaxBackOff' is unread. Did you forget to use it to initialize the property with that name?

Check warning on line 92 in Source/TransientFaultHandling.Configuration.Core/RetryStrategyOptions.cs

View workflow job for this annotation

GitHub Actions / build

Parameter 'DeltaBackOff' is unread. Did you forget to use it to initialize the property with that name?
{
private readonly int retryCount;

private readonly TimeSpan minBackOff;

private readonly TimeSpan maxBackOff;

private readonly TimeSpan deltaBackOff;

/// <summary>
/// Initializes a new instance of the <see cref="ExponentialBackoffOptions" /> record.
/// </summary>
Expand All @@ -71,20 +109,36 @@ public ExponentialBackoffOptions() : this(RetryStrategy.DefaultFirstFastRetry, d
/// <summary>
/// Gets the maximum number of retry attempts.
/// </summary>
public int RetryCount { get; init; } = RetryCount.ThrowIfNegative();
public int RetryCount
{
get => this.retryCount;
init => this.retryCount = value.ThrowIfNegative();
}

/// <summary>
/// Gets the minimum backoff time.
/// </summary>
public TimeSpan MinBackOff { get; init; } = MinBackOff.ThrowIfNegative();
public TimeSpan MinBackOff
{
get => this.minBackOff;
init => this.minBackOff = value.ThrowIfNegative();
}

/// <summary>
/// Gets the maximum backoff time.
/// </summary>
public TimeSpan MaxBackOff { get; init; } = MaxBackOff.ThrowIfNegative();
public TimeSpan MaxBackOff
{
get => this.maxBackOff;
init => this.maxBackOff = value.ThrowIfNegative();
}

/// <summary>
/// Gets the value that will be used to calculate a random delta in the exponential delay between retries.
/// </summary>
public TimeSpan DeltaBackOff { get; init; } = DeltaBackOff.ThrowIfNegative();
public TimeSpan DeltaBackOff
{
get => this.deltaBackOff;
init => this.deltaBackOff = value.ThrowIfNegative();
}
}

0 comments on commit b3831bd

Please sign in to comment.