Skip to content

Commit

Permalink
Use static global using for DictionaryHelpers
Browse files Browse the repository at this point in the history
  • Loading branch information
sukreshmanda committed Jul 30, 2024
1 parent 4107cdb commit 7ecc4fc
Show file tree
Hide file tree
Showing 17 changed files with 18 additions and 47 deletions.
4 changes: 1 addition & 3 deletions test/Polly.Specs/Caching/CacheAsyncSpecs.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using static Polly.Specs.DictionaryHelpers;

namespace Polly.Specs.Caching;
namespace Polly.Specs.Caching;

[Collection(Constants.SystemClockDependentTestCollection)]
public class CacheAsyncSpecs : IDisposable
Expand Down
4 changes: 1 addition & 3 deletions test/Polly.Specs/Caching/CacheSpecs.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using static Polly.Specs.DictionaryHelpers;

namespace Polly.Specs.Caching;
namespace Polly.Specs.Caching;

[Collection(Constants.SystemClockDependentTestCollection)]
public class CacheSpecs : IDisposable
Expand Down
4 changes: 1 addition & 3 deletions test/Polly.Specs/Caching/CacheTResultAsyncSpecs.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using static Polly.Specs.DictionaryHelpers;

namespace Polly.Specs.Caching;
namespace Polly.Specs.Caching;

[Collection(Constants.SystemClockDependentTestCollection)]
public class CacheTResultAsyncSpecs : IDisposable
Expand Down
4 changes: 1 addition & 3 deletions test/Polly.Specs/Caching/CacheTResultSpecs.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using static Polly.Specs.DictionaryHelpers;

namespace Polly.Specs.Caching;
namespace Polly.Specs.Caching;

[Collection(Constants.SystemClockDependentTestCollection)]
public class CacheTResultSpecs : IDisposable
Expand Down
4 changes: 1 addition & 3 deletions test/Polly.Specs/CircuitBreaker/CircuitBreakerSpecs.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using static Polly.Specs.DictionaryHelpers;

namespace Polly.Specs.CircuitBreaker;
namespace Polly.Specs.CircuitBreaker;

[Collection(Constants.SystemClockDependentTestCollection)]
public class CircuitBreakerSpecs : IDisposable
Expand Down
4 changes: 1 addition & 3 deletions test/Polly.Specs/ContextSpecs.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using static Polly.Specs.DictionaryHelpers;

namespace Polly.Specs;
namespace Polly.Specs;

public class ContextSpecs
{
Expand Down
4 changes: 2 additions & 2 deletions test/Polly.Specs/DictionaryHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ namespace Polly.Specs;
public static class DictionaryHelpers
{
public static Dictionary<TKey, object> CreateDictionary<TKey>(TKey key, object value)
where TKey : notnull => new() { { key, value } };
where TKey : notnull => new() { [key] = value };

public static Dictionary<TKey, object> CreateDictionary<TKey>(TKey key1, object value1, TKey key2, object value2)
where TKey : notnull => new() { { key1, value1 }, { key2, value2 } };
where TKey : notnull => new() { [key1] = value1, [key2] = value2 };
}
1 change: 1 addition & 0 deletions test/Polly.Specs/Polly.Specs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<Using Include="Xunit" />
<Using Include="Xunit.Abstractions" />
<Using Include="Xunit.Sdk" />
<Using Include="Polly.Specs.DictionaryHelpers" Static="true" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 1 addition & 3 deletions test/Polly.Specs/Registry/ReadOnlyPolicyRegistrySpecs.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using static Polly.Specs.DictionaryHelpers;

namespace Polly.Specs.Registry;
namespace Polly.Specs.Registry;

public class ReadOnlyPolicyRegistrySpecs
{
Expand Down
4 changes: 1 addition & 3 deletions test/Polly.Specs/Retry/RetryForeverSpecs.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using static Polly.Specs.DictionaryHelpers;

namespace Polly.Specs.Retry;
namespace Polly.Specs.Retry;

public class RetryForeverSpecs
{
Expand Down
4 changes: 1 addition & 3 deletions test/Polly.Specs/Retry/RetrySpecs.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using static Polly.Specs.DictionaryHelpers;

namespace Polly.Specs.Retry;
namespace Polly.Specs.Retry;

public class RetrySpecs
{
Expand Down
4 changes: 1 addition & 3 deletions test/Polly.Specs/Retry/WaitAndRetryForeverSpecs.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using static Polly.Specs.DictionaryHelpers;

namespace Polly.Specs.Retry;
namespace Polly.Specs.Retry;

[Collection(Constants.SystemClockDependentTestCollection)]
public class WaitAndRetryForeverSpecs : IDisposable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using static Polly.Specs.DictionaryHelpers;

namespace Polly.Specs.Retry;
namespace Polly.Specs.Retry;

[Collection(Constants.SystemClockDependentTestCollection)]
public class WaitAndRetryForeverTResultAsyncSpecs : IDisposable
Expand Down
4 changes: 1 addition & 3 deletions test/Polly.Specs/Retry/WaitAndRetryForeverTResultSpecs.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using static Polly.Specs.DictionaryHelpers;

namespace Polly.Specs.Retry;
namespace Polly.Specs.Retry;

[Collection(Constants.SystemClockDependentTestCollection)]
public class WaitAndRetryForeverTResultSpecs : IDisposable
Expand Down
4 changes: 1 addition & 3 deletions test/Polly.Specs/Retry/WaitAndRetrySpecs.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using static Polly.Specs.DictionaryHelpers;

namespace Polly.Specs.Retry;
namespace Polly.Specs.Retry;

[Collection(Constants.SystemClockDependentTestCollection)]
public class WaitAndRetrySpecs : IDisposable
Expand Down
4 changes: 1 addition & 3 deletions test/Polly.Specs/Retry/WaitAndRetryTResultAsyncSpecs.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using static Polly.Specs.DictionaryHelpers;

namespace Polly.Specs.Retry;
namespace Polly.Specs.Retry;

[Collection(Constants.SystemClockDependentTestCollection)]
public class WaitAndRetryTResultAsyncSpecs : IDisposable
Expand Down
4 changes: 1 addition & 3 deletions test/Polly.Specs/Retry/WaitAndRetryTResultSpecs.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using static Polly.Specs.DictionaryHelpers;

namespace Polly.Specs.Retry;
namespace Polly.Specs.Retry;

[Collection(Constants.SystemClockDependentTestCollection)]
public class WaitAndRetryTResultSpecs : IDisposable
Expand Down

0 comments on commit 7ecc4fc

Please sign in to comment.