diff --git a/test/Polly.Specs/Caching/AbsoluteTtlSpecs.cs b/test/Polly.Specs/Caching/AbsoluteTtlSpecs.cs index 4b5c36cb310..86679a7cb06 100644 --- a/test/Polly.Specs/Caching/AbsoluteTtlSpecs.cs +++ b/test/Polly.Specs/Caching/AbsoluteTtlSpecs.cs @@ -6,7 +6,7 @@ public class AbsoluteTtlSpecs : IDisposable [Fact] public void Should_be_able_to_configure_for_near_future_time() { - Action configure = () => new AbsoluteTtl(DateTimeOffset.UtcNow.Date.AddDays(1)); + Action configure = () => _ = new AbsoluteTtl(DateTimeOffset.UtcNow.Date.AddDays(1)); configure.Should().NotThrow(); } @@ -14,7 +14,7 @@ public void Should_be_able_to_configure_for_near_future_time() [Fact] public void Should_be_able_to_configure_for_far_future() { - Action configure = () => new AbsoluteTtl(DateTimeOffset.MaxValue); + Action configure = () => _ = new AbsoluteTtl(DateTimeOffset.MaxValue); configure.Should().NotThrow(); } @@ -22,7 +22,7 @@ public void Should_be_able_to_configure_for_far_future() [Fact] public void Should_be_able_to_configure_for_past() { - Action configure = () => new AbsoluteTtl(DateTimeOffset.MinValue); + Action configure = () => _ = new AbsoluteTtl(DateTimeOffset.MinValue); configure.Should().NotThrow(); } diff --git a/test/Polly.Specs/Caching/RelativeTtlSpecs.cs b/test/Polly.Specs/Caching/RelativeTtlSpecs.cs index 0f607debc1f..3f992f7b432 100644 --- a/test/Polly.Specs/Caching/RelativeTtlSpecs.cs +++ b/test/Polly.Specs/Caching/RelativeTtlSpecs.cs @@ -5,7 +5,7 @@ public class RelativeTtlSpecs [Fact] public void Should_throw_when_timespan_is_less_than_zero() { - Action configure = () => new RelativeTtl(TimeSpan.FromMilliseconds(-1)); + Action configure = () => _ = new RelativeTtl(TimeSpan.FromMilliseconds(-1)); configure.Should().Throw().And.ParamName.Should().Be("ttl"); } @@ -13,7 +13,7 @@ public void Should_throw_when_timespan_is_less_than_zero() [Fact] public void Should_not_throw_when_timespan_is_zero() { - Action configure = () => new RelativeTtl(TimeSpan.Zero); + Action configure = () => _ = new RelativeTtl(TimeSpan.Zero); configure.Should().NotThrow(); } @@ -21,7 +21,7 @@ public void Should_not_throw_when_timespan_is_zero() [Fact] public void Should_allow_timespan_max_value() { - Action configure = () => new RelativeTtl(TimeSpan.MaxValue); + Action configure = () => _ = new RelativeTtl(TimeSpan.MaxValue); configure.Should().NotThrow(); } diff --git a/test/Polly.Specs/Caching/ResultTtlSpecs.cs b/test/Polly.Specs/Caching/ResultTtlSpecs.cs index 5dd0f5909fb..ef1a0757e9c 100644 --- a/test/Polly.Specs/Caching/ResultTtlSpecs.cs +++ b/test/Polly.Specs/Caching/ResultTtlSpecs.cs @@ -5,7 +5,7 @@ public class ResultTtlSpecs [Fact] public void Should_throw_when_func_is_null() { - Action configure = () => new ResultTtl((Func)null!); + Action configure = () => _ = new ResultTtl((Func)null!); configure.Should().Throw().And.ParamName.Should().Be("ttlFunc"); } @@ -13,7 +13,7 @@ public void Should_throw_when_func_is_null() [Fact] public void Should_throw_when_func_is_null_using_context() { - Action configure = () => new ResultTtl((Func)null!); + Action configure = () => _ = new ResultTtl((Func)null!); configure.Should().Throw().And.ParamName.Should().Be("ttlFunc"); } @@ -21,7 +21,7 @@ public void Should_throw_when_func_is_null_using_context() [Fact] public void Should_not_throw_when_func_is_set() { - Action configure = () => new ResultTtl(_ => new Ttl()); + Action configure = () => _ = new ResultTtl(_ => new Ttl()); configure.Should().NotThrow(); } @@ -29,7 +29,7 @@ public void Should_not_throw_when_func_is_set() [Fact] public void Should_not_throw_when_func_is_set_using_context() { - Action configure = () => new ResultTtl((_, _) => new Ttl()); + Action configure = () => _ = new ResultTtl((_, _) => new Ttl()); configure.Should().NotThrow(); } diff --git a/test/Polly.Specs/Caching/SerializingCacheProviderAsyncSpecs.cs b/test/Polly.Specs/Caching/SerializingCacheProviderAsyncSpecs.cs index b234475bbb4..e6c26cbe571 100644 --- a/test/Polly.Specs/Caching/SerializingCacheProviderAsyncSpecs.cs +++ b/test/Polly.Specs/Caching/SerializingCacheProviderAsyncSpecs.cs @@ -11,7 +11,7 @@ public void Single_generic_constructor_should_throw_on_no_wrapped_cache_provider serialize: o => new StubSerialized(o), deserialize: s => s?.Original ?? default); - Action configure = () => new AsyncSerializingCacheProvider(null!, stubObjectSerializer); + Action configure = () => _ = new AsyncSerializingCacheProvider(null!, stubObjectSerializer); configure.Should().Throw() .And.ParamName.Should().Be("wrappedCacheProvider"); @@ -20,7 +20,7 @@ public void Single_generic_constructor_should_throw_on_no_wrapped_cache_provider [Fact] public void Single_generic_constructor_should_throw_on_no_serializer() { - Action configure = () => new AsyncSerializingCacheProvider(new StubCacheProvider().AsyncFor(), null!); + Action configure = () => _ = new AsyncSerializingCacheProvider(new StubCacheProvider().AsyncFor(), null!); configure.Should().Throw() .And.ParamName.Should().Be("serializer"); @@ -221,7 +221,7 @@ public void Double_generic_constructor_should_throw_on_no_wrapped_cache_provider serialize: o => new StubSerialized(o), deserialize: s => s?.Original ?? default); - Action configure = () => new AsyncSerializingCacheProvider>(null!, stubTResultSerializer); + Action configure = () => _ = new AsyncSerializingCacheProvider>(null!, stubTResultSerializer); configure.Should().Throw() .And.ParamName.Should().Be("wrappedCacheProvider"); @@ -230,7 +230,7 @@ public void Double_generic_constructor_should_throw_on_no_wrapped_cache_provider [Fact] public void Double_generic_constructor_should_throw_on_no_serializer() { - Action configure = () => new AsyncSerializingCacheProvider(new StubCacheProvider().AsyncFor(), null!); + Action configure = () => _ = new AsyncSerializingCacheProvider(new StubCacheProvider().AsyncFor(), null!); configure.Should().Throw() .And.ParamName.Should().Be("serializer"); diff --git a/test/Polly.Specs/Caching/SerializingCacheProviderSpecs.cs b/test/Polly.Specs/Caching/SerializingCacheProviderSpecs.cs index e69292965b2..847acf9795b 100644 --- a/test/Polly.Specs/Caching/SerializingCacheProviderSpecs.cs +++ b/test/Polly.Specs/Caching/SerializingCacheProviderSpecs.cs @@ -11,7 +11,7 @@ public void Single_generic_constructor_should_throw_on_no_wrapped_cache_provider serialize: o => new StubSerialized(o), deserialize: s => s?.Original ?? default); - Action configure = () => new SerializingCacheProvider(null!, stubObjectSerializer); + Action configure = () => _ = new SerializingCacheProvider(null!, stubObjectSerializer); configure.Should().Throw() .And.ParamName.Should().Be("wrappedCacheProvider"); @@ -20,7 +20,7 @@ public void Single_generic_constructor_should_throw_on_no_wrapped_cache_provider [Fact] public void Single_generic_constructor_should_throw_on_no_serializer() { - Action configure = () => new SerializingCacheProvider(new StubCacheProvider().For(), null!); + Action configure = () => _ = new SerializingCacheProvider(new StubCacheProvider().For(), null!); configure.Should().Throw() .And.ParamName.Should().Be("serializer"); @@ -221,7 +221,7 @@ public void Double_generic_constructor_should_throw_on_no_wrapped_cache_provider serialize: o => new StubSerialized(o), deserialize: s => s?.Original ?? default); - Action configure = () => new SerializingCacheProvider>(null!, stubTResultSerializer); + Action configure = () => _ = new SerializingCacheProvider>(null!, stubTResultSerializer); configure.Should().Throw() .And.ParamName.Should().Be("wrappedCacheProvider"); @@ -230,7 +230,7 @@ public void Double_generic_constructor_should_throw_on_no_wrapped_cache_provider [Fact] public void Double_generic_constructor_should_throw_on_no_serializer() { - Action configure = () => new SerializingCacheProvider(new StubCacheProvider().For(), null!); + Action configure = () => _ = new SerializingCacheProvider(new StubCacheProvider().For(), null!); configure.Should().Throw() .And.ParamName.Should().Be("serializer"); diff --git a/test/Polly.Specs/Caching/SlidingTtlSpecs.cs b/test/Polly.Specs/Caching/SlidingTtlSpecs.cs index 5b86d5cccef..4ee172443ca 100644 --- a/test/Polly.Specs/Caching/SlidingTtlSpecs.cs +++ b/test/Polly.Specs/Caching/SlidingTtlSpecs.cs @@ -5,7 +5,7 @@ public class SlidingTtlSpecs [Fact] public void Should_throw_when_timespan_is_less_than_zero() { - Action configure = () => new SlidingTtl(TimeSpan.FromMilliseconds(-1)); + Action configure = () => _ = new SlidingTtl(TimeSpan.FromMilliseconds(-1)); configure.Should().Throw().And.ParamName.Should().Be("slidingTtl"); } @@ -13,7 +13,7 @@ public void Should_throw_when_timespan_is_less_than_zero() [Fact] public void Should_not_throw_when_timespan_is_zero() { - Action configure = () => new SlidingTtl(TimeSpan.Zero); + Action configure = () => _ = new SlidingTtl(TimeSpan.Zero); configure.Should().NotThrow(); } @@ -21,7 +21,7 @@ public void Should_not_throw_when_timespan_is_zero() [Fact] public void Should_allow_timespan_max_value() { - Action configure = () => new SlidingTtl(TimeSpan.MaxValue); + Action configure = () => _ = new SlidingTtl(TimeSpan.MaxValue); configure.Should().NotThrow(); } diff --git a/test/Polly.Specs/Polly.Specs.csproj b/test/Polly.Specs/Polly.Specs.csproj index a511407c4f2..e627c0bdb58 100644 --- a/test/Polly.Specs/Polly.Specs.csproj +++ b/test/Polly.Specs/Polly.Specs.csproj @@ -8,7 +8,7 @@ 75,60,70 [Polly]* true - $(NoWarn);S103;S104;IDE0011;SA1600;SA1204;CA2008;CA1806;CA2201; + $(NoWarn);S103;S104;IDE0011;SA1600;SA1204;CA2008;CA2201; $(NoWarn);S3878;CA1030;S3717;SA1129;S1402;SA1649;SA1402;CA1031 $(NoWarn);S2184;