From 317b2448c28139058ef535f58407ab762b5b9c15 Mon Sep 17 00:00:00 2001 From: gintsk <3540004+gintsk@users.noreply.github.com> Date: Sat, 27 Jan 2024 17:18:35 +0200 Subject: [PATCH] Fix S4144 (remove duplicate tests) --- .../Fallback/FallbackTResultAsyncSpecs.cs | 28 ------------------- test/Polly.Specs/PolicyTResultAsyncSpecs.cs | 12 -------- test/Polly.Specs/Polly.Specs.csproj | 2 +- 3 files changed, 1 insertion(+), 41 deletions(-) diff --git a/test/Polly.Specs/Fallback/FallbackTResultAsyncSpecs.cs b/test/Polly.Specs/Fallback/FallbackTResultAsyncSpecs.cs index 618d7cd336c..45350dde783 100644 --- a/test/Polly.Specs/Fallback/FallbackTResultAsyncSpecs.cs +++ b/test/Polly.Specs/Fallback/FallbackTResultAsyncSpecs.cs @@ -61,20 +61,6 @@ public void Should_throw_when_onFallback_delegate_is_null() .And.ParamName.Should().Be("onFallbackAsync"); } - [Fact] - public void Should_throw_when_onFallback_delegate_is_null_with_action_with_cancellation() - { - Func> fallbackAction = _ => Task.FromResult(ResultPrimitive.Substitute); - Func, Task> onFallbackAsync = null!; - - Action policy = () => Policy - .HandleResult(ResultPrimitive.Fault) - .FallbackAsync(fallbackAction, onFallbackAsync); - - policy.Should().Throw() - .And.ParamName.Should().Be("onFallbackAsync"); - } - [Fact] public void Should_throw_when_onFallback_delegate_is_null_with_context() { @@ -89,20 +75,6 @@ public void Should_throw_when_onFallback_delegate_is_null_with_context() .And.ParamName.Should().Be("onFallbackAsync"); } - [Fact] - public void Should_throw_when_onFallback_delegate_is_null_with_context_with_action_with_cancellation() - { - Func> fallbackAction = (_, _) => Task.FromResult(ResultPrimitive.Substitute); - Func, Context, Task> onFallbackAsync = null!; - - Action policy = () => Policy - .HandleResult(ResultPrimitive.Fault) - .FallbackAsync(fallbackAction, onFallbackAsync); - - policy.Should().Throw() - .And.ParamName.Should().Be("onFallbackAsync"); - } - #endregion #region Policy operation tests diff --git a/test/Polly.Specs/PolicyTResultAsyncSpecs.cs b/test/Polly.Specs/PolicyTResultAsyncSpecs.cs index 5b88db91271..18957deb20f 100644 --- a/test/Polly.Specs/PolicyTResultAsyncSpecs.cs +++ b/test/Polly.Specs/PolicyTResultAsyncSpecs.cs @@ -110,18 +110,6 @@ public async Task Executing_the_policy_function_should_throw_when_context_is_nul ex.And.ParamName.Should().Be("context"); } - [Fact] - public async Task Execute_and_capturing_the_policy_function_should_throw_when_context_data_is_null() - { - var policy = Policy - .HandleResult(ResultPrimitive.Fault) - .RetryAsync((_, _, _) => { }); - - var ex = await policy.Awaiting(p => p.ExecuteAndCaptureAsync(_ => Task.FromResult(ResultPrimitive.Good), null!)) - .Should().ThrowAsync(); - ex.And.ParamName.Should().Be("context"); - } - [Fact] public async Task Executing_the_policy_function_should_pass_context_to_executed_delegate() { diff --git a/test/Polly.Specs/Polly.Specs.csproj b/test/Polly.Specs/Polly.Specs.csproj index 25d94804a3c..737cab0336b 100644 --- a/test/Polly.Specs/Polly.Specs.csproj +++ b/test/Polly.Specs/Polly.Specs.csproj @@ -9,7 +9,7 @@ [Polly]* true $(NoWarn);S103;S104;CA2000;IDE0011;SA1600;SA1204;CA2008;CA1806;CA2201; - $(NoWarn);S3878;CA1030;S4144;S3717;SA1129;SA1407;S1402;SA1649;SA1402;S4056;CA1031 + $(NoWarn);S3878;CA1030;S3717;SA1129;SA1407;S1402;SA1649;SA1402;S4056;CA1031 $(NoWarn);S2184;