Skip to content

Commit

Permalink
Use var
Browse files Browse the repository at this point in the history
Some more var usage missed from #1950.
  • Loading branch information
martincostello committed Feb 5, 2024
1 parent e937886 commit 35ba8a3
Show file tree
Hide file tree
Showing 18 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions test/Polly.Specs/Caching/CacheAsyncSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ public async Task Should_honour_cancellation_even_if_prior_execution_has_cached(

int delegateInvocations = 0;

using (CancellationTokenSource tokenSource = new CancellationTokenSource())
using (var tokenSource = new CancellationTokenSource())
{
Func<Context, CancellationToken, Task<string>> func = async (_, _) =>
{
Expand Down Expand Up @@ -483,7 +483,7 @@ public async Task Should_honour_cancellation_during_delegate_execution_and_not_p
IAsyncCacheProvider stubCacheProvider = new StubCacheProvider();
var cache = Policy.CacheAsync(stubCacheProvider, TimeSpan.MaxValue);

using (CancellationTokenSource tokenSource = new CancellationTokenSource())
using (var tokenSource = new CancellationTokenSource())
{
Func<Context, CancellationToken, Task<string>> func = async (_, ct) =>
{
Expand Down
4 changes: 2 additions & 2 deletions test/Polly.Specs/Caching/CacheSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ public void Should_honour_cancellation_even_if_prior_execution_has_cached()

int delegateInvocations = 0;

using (CancellationTokenSource tokenSource = new CancellationTokenSource())
using (var tokenSource = new CancellationTokenSource())
{
Func<Context, CancellationToken, string> func = (_, _) =>
{
Expand Down Expand Up @@ -474,7 +474,7 @@ public void Should_honour_cancellation_during_delegate_execution_and_not_put_to_
ISyncCacheProvider stubCacheProvider = new StubCacheProvider();
CachePolicy cache = Policy.Cache(stubCacheProvider, TimeSpan.MaxValue);

using (CancellationTokenSource tokenSource = new CancellationTokenSource())
using (var tokenSource = new CancellationTokenSource())
{
Func<Context, CancellationToken, string> func = (_, ct) =>
{
Expand Down
4 changes: 2 additions & 2 deletions test/Polly.Specs/Caching/CacheTResultAsyncSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ public async Task Should_honour_cancellation_even_if_prior_execution_has_cached(

int delegateInvocations = 0;

using (CancellationTokenSource tokenSource = new CancellationTokenSource())
using (var tokenSource = new CancellationTokenSource())
{
Func<Context, CancellationToken, Task<string>> func = async (_, _) =>
{
Expand Down Expand Up @@ -467,7 +467,7 @@ public async Task Should_honour_cancellation_during_delegate_execution_and_not_p
IAsyncCacheProvider stubCacheProvider = new StubCacheProvider();
var cache = Policy.CacheAsync<string>(stubCacheProvider, TimeSpan.MaxValue);

using (CancellationTokenSource tokenSource = new CancellationTokenSource())
using (var tokenSource = new CancellationTokenSource())
{
Func<Context, CancellationToken, Task<string>> func = async (_, ct) =>
{
Expand Down
4 changes: 2 additions & 2 deletions test/Polly.Specs/Caching/CacheTResultSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ public void Should_honour_cancellation_even_if_prior_execution_has_cached()

int delegateInvocations = 0;

using (CancellationTokenSource tokenSource = new CancellationTokenSource())
using (var tokenSource = new CancellationTokenSource())
{
Func<Context, CancellationToken, string> func = (_, _) =>
{
Expand Down Expand Up @@ -457,7 +457,7 @@ public void Should_honour_cancellation_during_delegate_execution_and_not_put_to_
ISyncCacheProvider stubCacheProvider = new StubCacheProvider();
CachePolicy<string> cache = Policy.Cache<string>(stubCacheProvider, TimeSpan.MaxValue);

using (CancellationTokenSource tokenSource = new CancellationTokenSource())
using (var tokenSource = new CancellationTokenSource())
{
Func<Context, CancellationToken, string> func = (_, ct) =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2972,8 +2972,8 @@ public async Task Should_honour_different_cancellationToken_captured_implicitly_

int attemptsInvoked = 0;

using (CancellationTokenSource policyCancellationTokenSource = new CancellationTokenSource())
using (CancellationTokenSource implicitlyCapturedActionCancellationTokenSource = new CancellationTokenSource())
using (var policyCancellationTokenSource = new CancellationTokenSource())
using (var implicitlyCapturedActionCancellationTokenSource = new CancellationTokenSource())
{
CancellationToken policyCancellationToken = policyCancellationTokenSource.Token;
CancellationToken implicitlyCapturedActionCancellationToken = implicitlyCapturedActionCancellationTokenSource.Token;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2967,8 +2967,8 @@ public void Should_honour_different_cancellationToken_captured_implicitly_by_act

int attemptsInvoked = 0;

using (CancellationTokenSource policyCancellationTokenSource = new CancellationTokenSource())
using (CancellationTokenSource implicitlyCapturedActionCancellationTokenSource = new CancellationTokenSource())
using (var policyCancellationTokenSource = new CancellationTokenSource())
using (var implicitlyCapturedActionCancellationTokenSource = new CancellationTokenSource())
{
CancellationToken policyCancellationToken = policyCancellationTokenSource.Token;
CancellationToken implicitlyCapturedActionCancellationToken = implicitlyCapturedActionCancellationTokenSource.Token;
Expand Down
4 changes: 2 additions & 2 deletions test/Polly.Specs/CircuitBreaker/CircuitBreakerAsyncSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1609,8 +1609,8 @@ public async Task Should_honour_different_cancellationToken_captured_implicitly_

int attemptsInvoked = 0;

using (CancellationTokenSource policyCancellationTokenSource = new CancellationTokenSource())
using (CancellationTokenSource implicitlyCapturedActionCancellationTokenSource = new CancellationTokenSource())
using (var policyCancellationTokenSource = new CancellationTokenSource())
using (var implicitlyCapturedActionCancellationTokenSource = new CancellationTokenSource())
{
CancellationToken policyCancellationToken = policyCancellationTokenSource.Token;
CancellationToken implicitlyCapturedActionCancellationToken = implicitlyCapturedActionCancellationTokenSource.Token;
Expand Down
4 changes: 2 additions & 2 deletions test/Polly.Specs/CircuitBreaker/CircuitBreakerSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1622,8 +1622,8 @@ public void Should_honour_different_cancellationToken_captured_implicitly_by_act

int attemptsInvoked = 0;

using (CancellationTokenSource policyCancellationTokenSource = new CancellationTokenSource())
using (CancellationTokenSource implicitlyCapturedActionCancellationTokenSource = new CancellationTokenSource())
using (var policyCancellationTokenSource = new CancellationTokenSource())
using (var implicitlyCapturedActionCancellationTokenSource = new CancellationTokenSource())
{
CancellationToken policyCancellationToken = policyCancellationTokenSource.Token;
CancellationToken implicitlyCapturedActionCancellationToken = implicitlyCapturedActionCancellationTokenSource.Token;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1578,8 +1578,8 @@ public async Task Should_honour_different_cancellationToken_captured_implicitly_

int attemptsInvoked = 0;

using (CancellationTokenSource policyCancellationTokenSource = new CancellationTokenSource())
using (CancellationTokenSource implicitlyCapturedActionCancellationTokenSource = new CancellationTokenSource())
using (var policyCancellationTokenSource = new CancellationTokenSource())
using (var implicitlyCapturedActionCancellationTokenSource = new CancellationTokenSource())
{
CancellationToken policyCancellationToken = policyCancellationTokenSource.Token;
CancellationToken implicitlyCapturedActionCancellationToken = implicitlyCapturedActionCancellationTokenSource.Token;
Expand Down
4 changes: 2 additions & 2 deletions test/Polly.Specs/CircuitBreaker/CircuitBreakerTResultSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1562,8 +1562,8 @@ public void Should_honour_different_cancellationToken_captured_implicitly_by_act

int attemptsInvoked = 0;

using (CancellationTokenSource policyCancellationTokenSource = new CancellationTokenSource())
using (CancellationTokenSource implicitlyCapturedActionCancellationTokenSource = new CancellationTokenSource())
using (var policyCancellationTokenSource = new CancellationTokenSource())
using (var implicitlyCapturedActionCancellationTokenSource = new CancellationTokenSource())
{
CancellationToken policyCancellationToken = policyCancellationTokenSource.Token;
CancellationToken implicitlyCapturedActionCancellationToken = implicitlyCapturedActionCancellationTokenSource.Token;
Expand Down
2 changes: 1 addition & 1 deletion test/Polly.Specs/NoOp/NoOpAsyncSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public async Task Should_execute_user_delegate_without_adding_extra_cancellation

bool executed = false;

using (CancellationTokenSource cts = new CancellationTokenSource())
using (var cts = new CancellationTokenSource())
{
cts.Cancel();

Expand Down
2 changes: 1 addition & 1 deletion test/Polly.Specs/NoOp/NoOpSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void Should_execute_user_delegate_without_adding_extra_cancellation_behav
NoOpPolicy policy = Policy.NoOp();
bool executed = false;

using (CancellationTokenSource cts = new CancellationTokenSource())
using (var cts = new CancellationTokenSource())
{
cts.Cancel();

Expand Down
2 changes: 1 addition & 1 deletion test/Polly.Specs/NoOp/NoOpTResultAsyncSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public async Task Should_execute_user_delegate_without_adding_extra_cancellation
var policy = Policy.NoOpAsync<int?>();
int? result = null;

using (CancellationTokenSource cts = new CancellationTokenSource())
using (var cts = new CancellationTokenSource())
{
cts.Cancel();

Expand Down
2 changes: 1 addition & 1 deletion test/Polly.Specs/NoOp/NoOpTResultSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void Should_execute_user_delegate_without_adding_extra_cancellation_behav
NoOpPolicy<int> policy = Policy.NoOp<int>();
int? result = null;

using (CancellationTokenSource cts = new CancellationTokenSource())
using (var cts = new CancellationTokenSource())
{
cts.Cancel();

Expand Down
4 changes: 2 additions & 2 deletions test/Polly.Specs/Timeout/TimeoutAsyncSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ public async Task Should_not_execute_user_delegate_if_user_cancellationToken_can

bool executed = false;

using (CancellationTokenSource cts = new CancellationTokenSource())
using (var cts = new CancellationTokenSource())
{
cts.Cancel();

Expand Down Expand Up @@ -413,7 +413,7 @@ public async Task Should_not_execute_user_delegate_if_user_cancellationToken_can

bool executed = false;

using (CancellationTokenSource cts = new CancellationTokenSource())
using (var cts = new CancellationTokenSource())
{
cts.Cancel();

Expand Down
4 changes: 2 additions & 2 deletions test/Polly.Specs/Timeout/TimeoutSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ public void Should_not_execute_user_delegate_if_user_cancellationToken_cancelled

bool executed = false;

using (CancellationTokenSource cts = new CancellationTokenSource())
using (var cts = new CancellationTokenSource())
{
cts.Cancel();

Expand Down Expand Up @@ -468,7 +468,7 @@ public void Should_not_execute_user_delegate_if_user_cancellationToken_cancelled

bool executed = false;

using (CancellationTokenSource cts = new CancellationTokenSource())
using (var cts = new CancellationTokenSource())
{
cts.Cancel();

Expand Down
4 changes: 2 additions & 2 deletions test/Polly.Specs/Timeout/TimeoutTResultAsyncSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ public async Task Should_not_execute_user_delegate_if_user_cancellationToken_can

bool executed = false;

using (CancellationTokenSource cts = new CancellationTokenSource())
using (var cts = new CancellationTokenSource())
{
cts.Cancel();

Expand Down Expand Up @@ -378,7 +378,7 @@ public async Task Should_not_execute_user_delegate_if_user_cancellationToken_can

bool executed = false;

using (CancellationTokenSource cts = new CancellationTokenSource())
using (var cts = new CancellationTokenSource())
{
cts.Cancel();

Expand Down
4 changes: 2 additions & 2 deletions test/Polly.Specs/Timeout/TimeoutTResultSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ public void Should_not_execute_user_delegate_if_user_cancellationToken_cancelled

bool executed = false;

using (CancellationTokenSource cts = new CancellationTokenSource())
using (var cts = new CancellationTokenSource())
{
cts.Cancel();

Expand Down Expand Up @@ -475,7 +475,7 @@ public void Should_not_execute_user_delegate_if_user_cancellationToken_cancelled

bool executed = false;

using (CancellationTokenSource cts = new CancellationTokenSource())
using (var cts = new CancellationTokenSource())
{
cts.Cancel();

Expand Down

0 comments on commit 35ba8a3

Please sign in to comment.