Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SA1129 #1964

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions test/Polly.Specs/Caching/ResultTtlSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ public void Should_throw_when_func_is_null_using_context()
[Fact]
public void Should_not_throw_when_func_is_set()
{
Action configure = () => _ = new ResultTtl<object>(_ => new Ttl());
Action configure = () => _ = new ResultTtl<object>(_ => default);

configure.Should().NotThrow();
}

[Fact]
public void Should_not_throw_when_func_is_set_using_context()
{
Action configure = () => _ = new ResultTtl<object>((_, _) => new Ttl());
Action configure = () => _ = new ResultTtl<object>((_, _) => default);

configure.Should().NotThrow();
}
Expand Down
2 changes: 1 addition & 1 deletion test/Polly.Specs/Polly.Specs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Include>[Polly]*</Include>
<IncludePollyUsings>true</IncludePollyUsings>
<NoWarn>$(NoWarn);S103;S104;IDE0011;SA1600;SA1204;CA2008;CA2201;</NoWarn>
<NoWarn>$(NoWarn);S3878;CA1030;S3717;SA1129;S1402;SA1649;SA1402;CA1031</NoWarn>
<NoWarn>$(NoWarn);S3878;CA1030;S3717;S1402;SA1649;SA1402;CA1031</NoWarn>
<NoWarn>$(NoWarn);S2184;</NoWarn>
</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions test/Polly.Specs/Retry/WaitAndRetryForeverSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void Should_not_throw_regardless_of_how_many_times_the_specified_exceptio
{
var policy = Policy
.Handle<DivideByZeroException>()
.WaitAndRetryForever(_ => new TimeSpan());
.WaitAndRetryForever(_ => default);

policy.Invoking(x => x.RaiseException<DivideByZeroException>(3))
.Should().NotThrow();
Expand All @@ -78,7 +78,7 @@ public void Should_not_throw_regardless_of_how_many_times_one_of_the_specified_e
var policy = Policy
.Handle<DivideByZeroException>()
.Or<ArgumentException>()
.WaitAndRetryForever(_ => new TimeSpan());
.WaitAndRetryForever(_ => default);

policy.Invoking(x => x.RaiseException<ArgumentException>(3))
.Should().NotThrow();
Expand Down
12 changes: 6 additions & 6 deletions test/Polly.Specs/Retry/WaitAndRetrySpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ public void Should_throw_when_retry_count_is_less_than_zero_without_context()

Action policy = () => Policy
.Handle<DivideByZeroException>()
.WaitAndRetry(-1, _ => new TimeSpan(), onRetry);
.WaitAndRetry(-1, _ => default, onRetry);

policy.Should().Throw<ArgumentOutOfRangeException>().And
.ParamName.Should().Be("retryCount");
Expand All @@ -564,7 +564,7 @@ public void Should_throw_when_retry_count_is_less_than_zero_with_context()

Action policy = () => Policy
.Handle<DivideByZeroException>()
.WaitAndRetry(-1, _ => new TimeSpan(), onRetry);
.WaitAndRetry(-1, _ => default, onRetry);

policy.Should().Throw<ArgumentOutOfRangeException>().And
.ParamName.Should().Be("retryCount");
Expand All @@ -577,7 +577,7 @@ public void Should_throw_when_retry_count_is_less_than_zero_with_attempts_with_c

Action policy = () => Policy
.Handle<DivideByZeroException>()
.WaitAndRetry(-1, _ => new TimeSpan(), onRetry);
.WaitAndRetry(-1, _ => default, onRetry);

policy.Should().Throw<ArgumentOutOfRangeException>().And
.ParamName.Should().Be("retryCount");
Expand Down Expand Up @@ -629,7 +629,7 @@ public void Should_throw_when_onretry_action_is_null_without_context_when_using_

Action policy = () => Policy
.Handle<DivideByZeroException>()
.WaitAndRetry(1, _ => new TimeSpan(), nullOnRetry);
.WaitAndRetry(1, _ => default, nullOnRetry);

policy.Should().Throw<ArgumentNullException>().And
.ParamName.Should().Be("onRetry");
Expand All @@ -642,7 +642,7 @@ public void Should_throw_when_onretry_action_is_null_with_context_when_using_pro

Action policy = () => Policy
.Handle<DivideByZeroException>()
.WaitAndRetry(1, _ => new TimeSpan(), nullOnRetry);
.WaitAndRetry(1, _ => default, nullOnRetry);

policy.Should().Throw<ArgumentNullException>().And
.ParamName.Should().Be("onRetry");
Expand All @@ -655,7 +655,7 @@ public void Should_throw_when_onretry_action_is_null_with_attempts_with_context_

Action policy = () => Policy
.Handle<DivideByZeroException>()
.WaitAndRetry(1, _ => new TimeSpan(), nullOnRetry);
.WaitAndRetry(1, _ => default, nullOnRetry);

policy.Should().Throw<ArgumentNullException>().And
.ParamName.Should().Be("onRetry");
Expand Down