From b063aad74eeafff699322cab5c2efa7364fd99ea Mon Sep 17 00:00:00 2001 From: ZLoo Date: Wed, 3 Jul 2024 19:21:51 +0300 Subject: [PATCH 1/2] fix warning sa1414 --- bench/Polly.Benchmarks/Polly.Benchmarks.csproj | 2 +- src/Polly/Bulkhead/BulkheadSemaphoreFactory.cs | 2 +- src/Polly/Caching/IAsyncCacheProvider.cs | 4 ++-- src/Polly/Caching/ISyncCacheProvider.cs | 4 ++-- src/Polly/Polly.csproj | 1 - src/Polly/PublicAPI.Shipped.txt | 8 ++++---- .../Caching/SerializingCacheProviderAsyncSpecs.cs | 8 ++++---- test/Polly.Specs/Caching/SerializingCacheProviderSpecs.cs | 8 ++++---- test/Polly.Specs/Helpers/Caching/StubCacheProvider.cs | 2 +- 9 files changed, 19 insertions(+), 20 deletions(-) diff --git a/bench/Polly.Benchmarks/Polly.Benchmarks.csproj b/bench/Polly.Benchmarks/Polly.Benchmarks.csproj index 5d9d5eb9bf5..c7034b11ac2 100644 --- a/bench/Polly.Benchmarks/Polly.Benchmarks.csproj +++ b/bench/Polly.Benchmarks/Polly.Benchmarks.csproj @@ -5,7 +5,7 @@ net6.0;net8.0 enable Benchmark - $(NoWarn);CA1822;SA1414;IDE0060 + $(NoWarn);CA1822;IDE0060 diff --git a/src/Polly/Bulkhead/BulkheadSemaphoreFactory.cs b/src/Polly/Bulkhead/BulkheadSemaphoreFactory.cs index 307877dce79..4427c2458cd 100644 --- a/src/Polly/Bulkhead/BulkheadSemaphoreFactory.cs +++ b/src/Polly/Bulkhead/BulkheadSemaphoreFactory.cs @@ -3,7 +3,7 @@ namespace Polly.Bulkhead; internal static class BulkheadSemaphoreFactory { - public static (SemaphoreSlim, SemaphoreSlim) CreateBulkheadSemaphores(int maxParallelization, int maxQueueingActions) + public static (SemaphoreSlim MaxParallelizationSemaphore, SemaphoreSlim MaxQueuedActionsSemaphore) CreateBulkheadSemaphores(int maxParallelization, int maxQueueingActions) { var maxParallelizationSemaphore = new SemaphoreSlim(maxParallelization, maxParallelization); diff --git a/src/Polly/Caching/IAsyncCacheProvider.cs b/src/Polly/Caching/IAsyncCacheProvider.cs index d1fddb20a6c..1cb39d00f0d 100644 --- a/src/Polly/Caching/IAsyncCacheProvider.cs +++ b/src/Polly/Caching/IAsyncCacheProvider.cs @@ -16,7 +16,7 @@ public interface IAsyncCacheProvider /// A promising as Result a tuple whose first element is a value indicating whether /// the key was found in the cache, and whose second element is the value from the cache (null if not found). /// - Task<(bool, object?)> TryGetAsync(string key, CancellationToken cancellationToken, bool continueOnCapturedContext); + Task<(bool CacheHit, object? Result)> TryGetAsync(string key, CancellationToken cancellationToken, bool continueOnCapturedContext); /// /// Puts the specified value in the cache asynchronously. @@ -46,7 +46,7 @@ public interface IAsyncCacheProvider /// A promising as Result a tuple whose first element is a value indicating whether /// the key was found in the cache, and whose second element is the value from the cache (default(TResult) if not found). /// - Task<(bool, TResult?)> TryGetAsync(string key, CancellationToken cancellationToken, bool continueOnCapturedContext); + Task<(bool CacheHit, TResult? Result)> TryGetAsync(string key, CancellationToken cancellationToken, bool continueOnCapturedContext); /// /// Puts the specified value in the cache asynchronously. diff --git a/src/Polly/Caching/ISyncCacheProvider.cs b/src/Polly/Caching/ISyncCacheProvider.cs index 7c4b87917f2..e05f583b1b5 100644 --- a/src/Polly/Caching/ISyncCacheProvider.cs +++ b/src/Polly/Caching/ISyncCacheProvider.cs @@ -14,7 +14,7 @@ public interface ISyncCacheProvider /// A tuple whose first element is a value indicating whether the key was found in the cache, /// and whose second element is the value from the cache (null if not found). /// - (bool, object?) TryGet(string key); + (bool CacheHit, object? Result) TryGet(string key); /// /// Puts the specified value in the cache. @@ -39,7 +39,7 @@ public interface ISyncCacheProvider /// A tuple whose first element is a value indicating whether the key was found in the cache, /// and whose second element is the value from the cache (default(TResult) if not found). /// - (bool, TResult?) TryGet(string key); + (bool CacheHit, TResult? Result) TryGet(string key); /// /// Puts the specified value in the cache. diff --git a/src/Polly/Polly.csproj b/src/Polly/Polly.csproj index 6db80544f89..3f228b6c829 100644 --- a/src/Polly/Polly.csproj +++ b/src/Polly/Polly.csproj @@ -9,7 +9,6 @@ true $(NoWarn);CA1010;CA1031;CA1032;CA1033;CA1051;CA1062;CA1063;CA1064;CA1068;CA1710;CA1716;CA1724;CA1805;CA1815;CA1816;CA2211 $(NoWarn);S2223;S3215;S3246;S3971;S4039;S4049;S4457 - $(NoWarn);SA1414 $(NoWarn);RS0037; diff --git a/src/Polly/PublicAPI.Shipped.txt b/src/Polly/PublicAPI.Shipped.txt index 1313c669b9b..cebb5a3113f 100644 --- a/src/Polly/PublicAPI.Shipped.txt +++ b/src/Polly/PublicAPI.Shipped.txt @@ -129,10 +129,10 @@ Polly.Caching.DefaultCacheKeyStrategy.DefaultCacheKeyStrategy() -> void Polly.Caching.DefaultCacheKeyStrategy.GetCacheKey(Polly.Context context) -> string Polly.Caching.IAsyncCacheProvider Polly.Caching.IAsyncCacheProvider.PutAsync(string key, object value, Polly.Caching.Ttl ttl, System.Threading.CancellationToken cancellationToken, bool continueOnCapturedContext) -> System.Threading.Tasks.Task -Polly.Caching.IAsyncCacheProvider.TryGetAsync(string key, System.Threading.CancellationToken cancellationToken, bool continueOnCapturedContext) -> System.Threading.Tasks.Task<(bool, object)> +Polly.Caching.IAsyncCacheProvider.TryGetAsync(string key, System.Threading.CancellationToken cancellationToken, bool continueOnCapturedContext) -> System.Threading.Tasks.Task<(bool CacheHit, object Result)> Polly.Caching.IAsyncCacheProvider Polly.Caching.IAsyncCacheProvider.PutAsync(string key, TResult value, Polly.Caching.Ttl ttl, System.Threading.CancellationToken cancellationToken, bool continueOnCapturedContext) -> System.Threading.Tasks.Task -Polly.Caching.IAsyncCacheProvider.TryGetAsync(string key, System.Threading.CancellationToken cancellationToken, bool continueOnCapturedContext) -> System.Threading.Tasks.Task<(bool, TResult)> +Polly.Caching.IAsyncCacheProvider.TryGetAsync(string key, System.Threading.CancellationToken cancellationToken, bool continueOnCapturedContext) -> System.Threading.Tasks.Task<(bool CacheHit, TResult Result)> Polly.Caching.ICacheItemSerializer Polly.Caching.ICacheItemSerializer.Deserialize(TSerialized objectToDeserialize) -> TResult Polly.Caching.ICacheItemSerializer.Serialize(TResult objectToSerialize) -> TSerialized @@ -142,10 +142,10 @@ Polly.Caching.ICachePolicy Polly.Caching.ICachePolicy Polly.Caching.ISyncCacheProvider Polly.Caching.ISyncCacheProvider.Put(string key, object value, Polly.Caching.Ttl ttl) -> void -Polly.Caching.ISyncCacheProvider.TryGet(string key) -> (bool, object) +Polly.Caching.ISyncCacheProvider.TryGet(string key) -> (bool CacheHit, object Result) Polly.Caching.ISyncCacheProvider Polly.Caching.ISyncCacheProvider.Put(string key, TResult value, Polly.Caching.Ttl ttl) -> void -Polly.Caching.ISyncCacheProvider.TryGet(string key) -> (bool, TResult) +Polly.Caching.ISyncCacheProvider.TryGet(string key) -> (bool CacheHit, TResult Result) Polly.Caching.ITtlStrategy Polly.Caching.ITtlStrategy Polly.Caching.ITtlStrategy.GetTtl(Polly.Context context, TResult result) -> Polly.Caching.Ttl diff --git a/test/Polly.Specs/Caching/SerializingCacheProviderAsyncSpecs.cs b/test/Polly.Specs/Caching/SerializingCacheProviderAsyncSpecs.cs index e6c26cbe571..a69539aee97 100644 --- a/test/Polly.Specs/Caching/SerializingCacheProviderAsyncSpecs.cs +++ b/test/Polly.Specs/Caching/SerializingCacheProviderAsyncSpecs.cs @@ -113,7 +113,7 @@ public async Task Single_generic_SerializingCacheProvider_should_not_deserialize var stubCacheProvider = new StubCacheProvider(); string key = "some key"; - stubCacheProvider.TryGet(key).Item1.Should().BeFalse(); + stubCacheProvider.TryGet(key).CacheHit.Should().BeFalse(); AsyncSerializingCacheProvider serializingCacheProvider = new AsyncSerializingCacheProvider(stubCacheProvider.AsyncFor(), stubSerializer); (bool cacheHit, object? fromCache) = await serializingCacheProvider.TryGetAsync(key, CancellationToken.None, false); @@ -200,7 +200,7 @@ public async Task Single_generic_SerializingCacheProvider_from_extension_syntax_ var stubCacheProvider = new StubCacheProvider(); string key = "some key"; - stubCacheProvider.TryGet(key).Item1.Should().BeFalse(); + stubCacheProvider.TryGet(key).CacheHit.Should().BeFalse(); AsyncSerializingCacheProvider serializingCacheProvider = stubCacheProvider.AsyncFor().WithSerializer(stubSerializer); (bool cacheHit, object? fromCache) = await serializingCacheProvider.TryGetAsync(key, CancellationToken.None, false); @@ -322,7 +322,7 @@ public async Task Double_generic_SerializingCacheProvider_should_not_deserialize var stubCacheProvider = new StubCacheProvider(); string key = "some key"; - stubCacheProvider.TryGet(key).Item1.Should().BeFalse(); + stubCacheProvider.TryGet(key).CacheHit.Should().BeFalse(); AsyncSerializingCacheProvider> serializingCacheProvider = new AsyncSerializingCacheProvider>(stubCacheProvider.AsyncFor>(), stubTResultSerializer); (bool cacheHit, ResultPrimitive? fromCache) = await serializingCacheProvider.TryGetAsync(key, CancellationToken.None, false); @@ -411,7 +411,7 @@ public async Task Double_generic_SerializingCacheProvider_from_extension_syntax_ var stubCacheProvider = new StubCacheProvider(); string key = "some key"; - stubCacheProvider.TryGet(key).Item1.Should().BeFalse(); + stubCacheProvider.TryGet(key).CacheHit.Should().BeFalse(); AsyncSerializingCacheProvider> serializingCacheProvider = stubCacheProvider.AsyncFor>().WithSerializer(stubTResultSerializer); diff --git a/test/Polly.Specs/Caching/SerializingCacheProviderSpecs.cs b/test/Polly.Specs/Caching/SerializingCacheProviderSpecs.cs index 847acf9795b..9bb699507bd 100644 --- a/test/Polly.Specs/Caching/SerializingCacheProviderSpecs.cs +++ b/test/Polly.Specs/Caching/SerializingCacheProviderSpecs.cs @@ -113,7 +113,7 @@ public void Single_generic_SerializingCacheProvider_should_not_deserialize_on_ge var stubCacheProvider = new StubCacheProvider(); string key = "some key"; - stubCacheProvider.TryGet(key).Item1.Should().BeFalse(); + stubCacheProvider.TryGet(key).CacheHit.Should().BeFalse(); SerializingCacheProvider serializingCacheProvider = new SerializingCacheProvider(stubCacheProvider.For(), stubSerializer); (bool cacheHit, object? fromCache) = serializingCacheProvider.TryGet(key); @@ -200,7 +200,7 @@ public void Single_generic_SerializingCacheProvider_from_extension_syntax_should var stubCacheProvider = new StubCacheProvider(); string key = "some key"; - stubCacheProvider.TryGet(key).Item1.Should().BeFalse(); + stubCacheProvider.TryGet(key).CacheHit.Should().BeFalse(); SerializingCacheProvider serializingCacheProvider = stubCacheProvider.For().WithSerializer(stubSerializer); (bool cacheHit, object? fromCache) = serializingCacheProvider.TryGet(key); @@ -322,7 +322,7 @@ public void Double_generic_SerializingCacheProvider_should_not_deserialize_on_ge var stubCacheProvider = new StubCacheProvider(); string key = "some key"; - stubCacheProvider.TryGet(key).Item1.Should().BeFalse(); + stubCacheProvider.TryGet(key).CacheHit.Should().BeFalse(); SerializingCacheProvider> serializingCacheProvider = new SerializingCacheProvider>(stubCacheProvider.For>(), stubTResultSerializer); (bool cacheHit, ResultPrimitive fromCache) = serializingCacheProvider.TryGet(key); @@ -413,7 +413,7 @@ public void Double_generic_SerializingCacheProvider_from_extension_syntax_should var stubCacheProvider = new StubCacheProvider(); string key = "some key"; - stubCacheProvider.TryGet(key).Item2.Should().BeNull(); + stubCacheProvider.TryGet(key).Result.Should().BeNull(); SerializingCacheProvider> serializingCacheProvider = stubCacheProvider.For>().WithSerializer(stubTResultSerializer); diff --git a/test/Polly.Specs/Helpers/Caching/StubCacheProvider.cs b/test/Polly.Specs/Helpers/Caching/StubCacheProvider.cs index 3b693028ebc..7e861aea7c4 100644 --- a/test/Polly.Specs/Helpers/Caching/StubCacheProvider.cs +++ b/test/Polly.Specs/Helpers/Caching/StubCacheProvider.cs @@ -19,7 +19,7 @@ public CacheItem(object? value, Ttl ttl) private readonly Dictionary _cachedValues = []; - public (bool, object?) TryGet(string key) + public (bool CacheHit, object? Result) TryGet(string key) { if (_cachedValues.ContainsKey(key)) { From a6830382d15ff4dc0bcaaaa90badb7ba2f4831ac Mon Sep 17 00:00:00 2001 From: ZLoo Date: Wed, 3 Jul 2024 19:52:35 +0300 Subject: [PATCH 2/2] Fix by feedback PR --- src/Polly/Caching/IAsyncCacheProvider.cs | 8 ++++++-- src/Polly/Caching/ISyncCacheProvider.cs | 8 ++++++-- src/Polly/PublicAPI.Shipped.txt | 8 ++++---- .../Caching/SerializingCacheProviderAsyncSpecs.cs | 8 ++++---- test/Polly.Specs/Caching/SerializingCacheProviderSpecs.cs | 8 ++++---- test/Polly.Specs/Helpers/Caching/StubCacheProvider.cs | 2 +- 6 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/Polly/Caching/IAsyncCacheProvider.cs b/src/Polly/Caching/IAsyncCacheProvider.cs index 1cb39d00f0d..e64d2bc09ad 100644 --- a/src/Polly/Caching/IAsyncCacheProvider.cs +++ b/src/Polly/Caching/IAsyncCacheProvider.cs @@ -6,6 +6,7 @@ namespace Polly.Caching; /// public interface IAsyncCacheProvider { +#pragma warning disable SA1414 /// /// Gets a value from the cache asynchronously. /// @@ -16,7 +17,8 @@ public interface IAsyncCacheProvider /// A promising as Result a tuple whose first element is a value indicating whether /// the key was found in the cache, and whose second element is the value from the cache (null if not found). /// - Task<(bool CacheHit, object? Result)> TryGetAsync(string key, CancellationToken cancellationToken, bool continueOnCapturedContext); + Task<(bool, object?)> TryGetAsync(string key, CancellationToken cancellationToken, bool continueOnCapturedContext); +#pragma warning restore SA1414 /// /// Puts the specified value in the cache asynchronously. @@ -36,6 +38,7 @@ public interface IAsyncCacheProvider /// The type of the result. public interface IAsyncCacheProvider { +#pragma warning disable SA1414 /// /// Gets a value from the cache asynchronously. /// @@ -46,7 +49,8 @@ public interface IAsyncCacheProvider /// A promising as Result a tuple whose first element is a value indicating whether /// the key was found in the cache, and whose second element is the value from the cache (default(TResult) if not found). /// - Task<(bool CacheHit, TResult? Result)> TryGetAsync(string key, CancellationToken cancellationToken, bool continueOnCapturedContext); + Task<(bool, TResult?)> TryGetAsync(string key, CancellationToken cancellationToken, bool continueOnCapturedContext); +#pragma warning restore SA1414 /// /// Puts the specified value in the cache asynchronously. diff --git a/src/Polly/Caching/ISyncCacheProvider.cs b/src/Polly/Caching/ISyncCacheProvider.cs index e05f583b1b5..6b6ec09432b 100644 --- a/src/Polly/Caching/ISyncCacheProvider.cs +++ b/src/Polly/Caching/ISyncCacheProvider.cs @@ -6,6 +6,7 @@ namespace Polly.Caching; /// public interface ISyncCacheProvider { +#pragma warning disable SA1414 /// /// Gets a value from cache. /// @@ -14,7 +15,8 @@ public interface ISyncCacheProvider /// A tuple whose first element is a value indicating whether the key was found in the cache, /// and whose second element is the value from the cache (null if not found). /// - (bool CacheHit, object? Result) TryGet(string key); + (bool, object?) TryGet(string key); +#pragma warning restore SA1414 /// /// Puts the specified value in the cache. @@ -31,6 +33,7 @@ public interface ISyncCacheProvider /// The type of the result. public interface ISyncCacheProvider { +#pragma warning disable SA1414 /// /// Gets a value from cache. /// @@ -39,7 +42,8 @@ public interface ISyncCacheProvider /// A tuple whose first element is a value indicating whether the key was found in the cache, /// and whose second element is the value from the cache (default(TResult) if not found). /// - (bool CacheHit, TResult? Result) TryGet(string key); + (bool, TResult?) TryGet(string key); +#pragma warning restore SA1414 /// /// Puts the specified value in the cache. diff --git a/src/Polly/PublicAPI.Shipped.txt b/src/Polly/PublicAPI.Shipped.txt index cebb5a3113f..1313c669b9b 100644 --- a/src/Polly/PublicAPI.Shipped.txt +++ b/src/Polly/PublicAPI.Shipped.txt @@ -129,10 +129,10 @@ Polly.Caching.DefaultCacheKeyStrategy.DefaultCacheKeyStrategy() -> void Polly.Caching.DefaultCacheKeyStrategy.GetCacheKey(Polly.Context context) -> string Polly.Caching.IAsyncCacheProvider Polly.Caching.IAsyncCacheProvider.PutAsync(string key, object value, Polly.Caching.Ttl ttl, System.Threading.CancellationToken cancellationToken, bool continueOnCapturedContext) -> System.Threading.Tasks.Task -Polly.Caching.IAsyncCacheProvider.TryGetAsync(string key, System.Threading.CancellationToken cancellationToken, bool continueOnCapturedContext) -> System.Threading.Tasks.Task<(bool CacheHit, object Result)> +Polly.Caching.IAsyncCacheProvider.TryGetAsync(string key, System.Threading.CancellationToken cancellationToken, bool continueOnCapturedContext) -> System.Threading.Tasks.Task<(bool, object)> Polly.Caching.IAsyncCacheProvider Polly.Caching.IAsyncCacheProvider.PutAsync(string key, TResult value, Polly.Caching.Ttl ttl, System.Threading.CancellationToken cancellationToken, bool continueOnCapturedContext) -> System.Threading.Tasks.Task -Polly.Caching.IAsyncCacheProvider.TryGetAsync(string key, System.Threading.CancellationToken cancellationToken, bool continueOnCapturedContext) -> System.Threading.Tasks.Task<(bool CacheHit, TResult Result)> +Polly.Caching.IAsyncCacheProvider.TryGetAsync(string key, System.Threading.CancellationToken cancellationToken, bool continueOnCapturedContext) -> System.Threading.Tasks.Task<(bool, TResult)> Polly.Caching.ICacheItemSerializer Polly.Caching.ICacheItemSerializer.Deserialize(TSerialized objectToDeserialize) -> TResult Polly.Caching.ICacheItemSerializer.Serialize(TResult objectToSerialize) -> TSerialized @@ -142,10 +142,10 @@ Polly.Caching.ICachePolicy Polly.Caching.ICachePolicy Polly.Caching.ISyncCacheProvider Polly.Caching.ISyncCacheProvider.Put(string key, object value, Polly.Caching.Ttl ttl) -> void -Polly.Caching.ISyncCacheProvider.TryGet(string key) -> (bool CacheHit, object Result) +Polly.Caching.ISyncCacheProvider.TryGet(string key) -> (bool, object) Polly.Caching.ISyncCacheProvider Polly.Caching.ISyncCacheProvider.Put(string key, TResult value, Polly.Caching.Ttl ttl) -> void -Polly.Caching.ISyncCacheProvider.TryGet(string key) -> (bool CacheHit, TResult Result) +Polly.Caching.ISyncCacheProvider.TryGet(string key) -> (bool, TResult) Polly.Caching.ITtlStrategy Polly.Caching.ITtlStrategy Polly.Caching.ITtlStrategy.GetTtl(Polly.Context context, TResult result) -> Polly.Caching.Ttl diff --git a/test/Polly.Specs/Caching/SerializingCacheProviderAsyncSpecs.cs b/test/Polly.Specs/Caching/SerializingCacheProviderAsyncSpecs.cs index a69539aee97..e6c26cbe571 100644 --- a/test/Polly.Specs/Caching/SerializingCacheProviderAsyncSpecs.cs +++ b/test/Polly.Specs/Caching/SerializingCacheProviderAsyncSpecs.cs @@ -113,7 +113,7 @@ public async Task Single_generic_SerializingCacheProvider_should_not_deserialize var stubCacheProvider = new StubCacheProvider(); string key = "some key"; - stubCacheProvider.TryGet(key).CacheHit.Should().BeFalse(); + stubCacheProvider.TryGet(key).Item1.Should().BeFalse(); AsyncSerializingCacheProvider serializingCacheProvider = new AsyncSerializingCacheProvider(stubCacheProvider.AsyncFor(), stubSerializer); (bool cacheHit, object? fromCache) = await serializingCacheProvider.TryGetAsync(key, CancellationToken.None, false); @@ -200,7 +200,7 @@ public async Task Single_generic_SerializingCacheProvider_from_extension_syntax_ var stubCacheProvider = new StubCacheProvider(); string key = "some key"; - stubCacheProvider.TryGet(key).CacheHit.Should().BeFalse(); + stubCacheProvider.TryGet(key).Item1.Should().BeFalse(); AsyncSerializingCacheProvider serializingCacheProvider = stubCacheProvider.AsyncFor().WithSerializer(stubSerializer); (bool cacheHit, object? fromCache) = await serializingCacheProvider.TryGetAsync(key, CancellationToken.None, false); @@ -322,7 +322,7 @@ public async Task Double_generic_SerializingCacheProvider_should_not_deserialize var stubCacheProvider = new StubCacheProvider(); string key = "some key"; - stubCacheProvider.TryGet(key).CacheHit.Should().BeFalse(); + stubCacheProvider.TryGet(key).Item1.Should().BeFalse(); AsyncSerializingCacheProvider> serializingCacheProvider = new AsyncSerializingCacheProvider>(stubCacheProvider.AsyncFor>(), stubTResultSerializer); (bool cacheHit, ResultPrimitive? fromCache) = await serializingCacheProvider.TryGetAsync(key, CancellationToken.None, false); @@ -411,7 +411,7 @@ public async Task Double_generic_SerializingCacheProvider_from_extension_syntax_ var stubCacheProvider = new StubCacheProvider(); string key = "some key"; - stubCacheProvider.TryGet(key).CacheHit.Should().BeFalse(); + stubCacheProvider.TryGet(key).Item1.Should().BeFalse(); AsyncSerializingCacheProvider> serializingCacheProvider = stubCacheProvider.AsyncFor>().WithSerializer(stubTResultSerializer); diff --git a/test/Polly.Specs/Caching/SerializingCacheProviderSpecs.cs b/test/Polly.Specs/Caching/SerializingCacheProviderSpecs.cs index 9bb699507bd..847acf9795b 100644 --- a/test/Polly.Specs/Caching/SerializingCacheProviderSpecs.cs +++ b/test/Polly.Specs/Caching/SerializingCacheProviderSpecs.cs @@ -113,7 +113,7 @@ public void Single_generic_SerializingCacheProvider_should_not_deserialize_on_ge var stubCacheProvider = new StubCacheProvider(); string key = "some key"; - stubCacheProvider.TryGet(key).CacheHit.Should().BeFalse(); + stubCacheProvider.TryGet(key).Item1.Should().BeFalse(); SerializingCacheProvider serializingCacheProvider = new SerializingCacheProvider(stubCacheProvider.For(), stubSerializer); (bool cacheHit, object? fromCache) = serializingCacheProvider.TryGet(key); @@ -200,7 +200,7 @@ public void Single_generic_SerializingCacheProvider_from_extension_syntax_should var stubCacheProvider = new StubCacheProvider(); string key = "some key"; - stubCacheProvider.TryGet(key).CacheHit.Should().BeFalse(); + stubCacheProvider.TryGet(key).Item1.Should().BeFalse(); SerializingCacheProvider serializingCacheProvider = stubCacheProvider.For().WithSerializer(stubSerializer); (bool cacheHit, object? fromCache) = serializingCacheProvider.TryGet(key); @@ -322,7 +322,7 @@ public void Double_generic_SerializingCacheProvider_should_not_deserialize_on_ge var stubCacheProvider = new StubCacheProvider(); string key = "some key"; - stubCacheProvider.TryGet(key).CacheHit.Should().BeFalse(); + stubCacheProvider.TryGet(key).Item1.Should().BeFalse(); SerializingCacheProvider> serializingCacheProvider = new SerializingCacheProvider>(stubCacheProvider.For>(), stubTResultSerializer); (bool cacheHit, ResultPrimitive fromCache) = serializingCacheProvider.TryGet(key); @@ -413,7 +413,7 @@ public void Double_generic_SerializingCacheProvider_from_extension_syntax_should var stubCacheProvider = new StubCacheProvider(); string key = "some key"; - stubCacheProvider.TryGet(key).Result.Should().BeNull(); + stubCacheProvider.TryGet(key).Item2.Should().BeNull(); SerializingCacheProvider> serializingCacheProvider = stubCacheProvider.For>().WithSerializer(stubTResultSerializer); diff --git a/test/Polly.Specs/Helpers/Caching/StubCacheProvider.cs b/test/Polly.Specs/Helpers/Caching/StubCacheProvider.cs index 7e861aea7c4..3b693028ebc 100644 --- a/test/Polly.Specs/Helpers/Caching/StubCacheProvider.cs +++ b/test/Polly.Specs/Helpers/Caching/StubCacheProvider.cs @@ -19,7 +19,7 @@ public CacheItem(object? value, Ttl ttl) private readonly Dictionary _cachedValues = []; - public (bool CacheHit, object? Result) TryGet(string key) + public (bool, object?) TryGet(string key) { if (_cachedValues.ContainsKey(key)) {