From 4a2a81e011c2db334c531d46e80654cab2ff5485 Mon Sep 17 00:00:00 2001 From: bothzoli Date: Wed, 24 Jul 2024 07:52:00 +1000 Subject: [PATCH] Remove EOL .NET frameworks and obsolete methods EOL .NET Frameworks (4.0, 4.5, 4.6.1, 5.0) removed. Build target for .NET 8 added. Obsolete methods and corresponding tests removed. --- ...harpFunctionalExtensions.StrongName.csproj | 16 +- .../CSharpFunctionalExtensions.Tests.csproj | 30 --- .../Extensions/OnFailureTests.Base.cs | 56 ----- .../Extensions/OnFailureTests.Task.Left.cs | 113 --------- .../Extensions/OnFailureTests.Task.Right.cs | 113 --------- .../Extensions/OnFailureTests.Task.cs | 113 --------- .../OnFailureTests.ValueTask.Left.cs | 114 --------- .../OnFailureTests.ValueTask.Right.cs | 114 --------- .../Extensions/OnFailureTests.ValueTask.cs | 114 --------- .../ResultTests/Extensions/OnFailureTests.cs | 112 --------- .../Extensions/OnSuccessTryTests.Task.Left.cs | 208 ---------------- .../OnSuccessTryTests.Task.Right.cs | 213 ----------------- .../Extensions/OnSuccessTryTests.Task.cs | 222 ------------------ .../Extensions/OnSuccessTryTests.cs | 215 ----------------- .../Extensions/TapIfTests.Task.Left.cs | 90 ------- .../CSharpFunctionalExtensions.csproj | 25 +- .../Maybe/Extensions/Select.cs | 9 +- .../Maybe/Obsolete/Unwrap.cs | 22 -- .../Methods/Extensions/OnFailure.Task.Left.cs | 49 ---- .../Extensions/OnFailure.Task.Right.cs | 49 ---- .../Methods/Extensions/OnFailure.Task.cs | 49 ---- .../Extensions/OnFailure.ValueTask.Left.cs | 51 ---- .../Extensions/OnFailure.ValueTask.Right.cs | 51 ---- .../Methods/Extensions/OnFailure.ValueTask.cs | 51 ---- .../Result/Methods/Extensions/OnFailure.cs | 48 ---- .../Result/Obsolete/Create.cs | 55 ----- .../Result/Obsolete/CreateFailure.cs | 54 ----- .../Result/Obsolete/Fail.cs | 23 -- .../Result/Obsolete/Ok.cs | 23 -- .../Result/Obsolete/OnBoth.cs | 23 -- .../Result/Obsolete/OnBothAsyncBoth.cs | 24 -- .../Result/Obsolete/OnBothAsyncLeft.cs | 24 -- .../Result/Obsolete/OnBothAsyncRight.cs | 24 -- .../Result/Obsolete/OnSuccess.cs | 63 ----- .../Result/Obsolete/OnSuccessAsyncBoth.cs | 64 ----- .../Result/Obsolete/OnSuccessAsyncLeft.cs | 59 ----- .../Result/Obsolete/OnSuccessAsyncRight.cs | 64 ----- .../Result/Obsolete/OnSuccessTry.Task.Left.cs | 42 ---- .../Obsolete/OnSuccessTry.Task.Right.cs | 42 ---- .../Result/Obsolete/OnSuccessTry.Task.cs | 43 ---- .../Result/Obsolete/OnSuccessTry.cs | 37 --- .../Obsolete/OnSuccessWithTransactionScope.cs | 138 ----------- .../Result/Obsolete/Tap.cs | 23 -- .../Result/Obsolete/TapAsyncBoth.cs | 24 -- .../Result/Obsolete/TapAsyncLeft.cs | 24 -- .../Result/Obsolete/TapAsyncRight.cs | 23 -- .../Result/Obsolete/TapIf.cs | 38 --- .../Result/Obsolete/TapIfAsyncBoth.cs | 39 --- .../Result/Obsolete/TapIfAsyncLeft.cs | 39 --- .../Result/Obsolete/TapIfAsyncRight.cs | 39 --- Common.Build.props | 2 +- Dockerfile | 2 +- 52 files changed, 9 insertions(+), 3293 deletions(-) delete mode 100644 CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.Base.cs delete mode 100644 CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.Task.Left.cs delete mode 100644 CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.Task.Right.cs delete mode 100644 CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.Task.cs delete mode 100644 CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.ValueTask.Left.cs delete mode 100644 CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.ValueTask.Right.cs delete mode 100644 CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.ValueTask.cs delete mode 100644 CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.cs delete mode 100644 CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnSuccessTryTests.Task.Left.cs delete mode 100644 CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnSuccessTryTests.Task.Right.cs delete mode 100644 CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnSuccessTryTests.Task.cs delete mode 100644 CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnSuccessTryTests.cs delete mode 100644 CSharpFunctionalExtensions/Maybe/Obsolete/Unwrap.cs delete mode 100644 CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.Task.Left.cs delete mode 100644 CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.Task.Right.cs delete mode 100644 CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.Task.cs delete mode 100644 CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.ValueTask.Left.cs delete mode 100644 CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.ValueTask.Right.cs delete mode 100644 CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.ValueTask.cs delete mode 100644 CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/Create.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/CreateFailure.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/Fail.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/Ok.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/OnBoth.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/OnBothAsyncBoth.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/OnBothAsyncLeft.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/OnBothAsyncRight.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/OnSuccess.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/OnSuccessAsyncBoth.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/OnSuccessAsyncLeft.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/OnSuccessAsyncRight.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/OnSuccessTry.Task.Left.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/OnSuccessTry.Task.Right.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/OnSuccessTry.Task.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/OnSuccessTry.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/OnSuccessWithTransactionScope.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/Tap.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/TapAsyncBoth.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/TapAsyncLeft.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/TapAsyncRight.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/TapIf.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/TapIfAsyncBoth.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/TapIfAsyncLeft.cs delete mode 100644 CSharpFunctionalExtensions/Result/Obsolete/TapIfAsyncRight.cs diff --git a/CSharpFunctionalExtensions.StrongName/CSharpFunctionalExtensions.StrongName.csproj b/CSharpFunctionalExtensions.StrongName/CSharpFunctionalExtensions.StrongName.csproj index 89d6ced9..787e2ab5 100644 --- a/CSharpFunctionalExtensions.StrongName/CSharpFunctionalExtensions.StrongName.csproj +++ b/CSharpFunctionalExtensions.StrongName/CSharpFunctionalExtensions.StrongName.csproj @@ -7,25 +7,15 @@ true - - CSharpFunctionalExtensions (with a strong name) .NET 4.5 - - - CSharpFunctionalExtensions (with a strong name) .NET 4.6.1 - CSharpFunctionalExtensions (with a strong name) .NET Standard 2.0 - - CSharpFunctionalExtensions (with a strong name) .NET 5.0 - CSharpFunctionalExtensions (with a strong name) .NET 6.0 - - - - + + CSharpFunctionalExtensions (with a strong name) .NET 8.0 + diff --git a/CSharpFunctionalExtensions.Tests/CSharpFunctionalExtensions.Tests.csproj b/CSharpFunctionalExtensions.Tests/CSharpFunctionalExtensions.Tests.csproj index 516deb65..450c3ee4 100644 --- a/CSharpFunctionalExtensions.Tests/CSharpFunctionalExtensions.Tests.csproj +++ b/CSharpFunctionalExtensions.Tests/CSharpFunctionalExtensions.Tests.csproj @@ -133,36 +133,6 @@ FinallyTests.cs - - OnFailureTests.ValueTask.cs - - - OnFailureTests.ValueTask.cs - - - OnFailureTests.cs - - - OnFailureTests.Task.cs - - - OnFailureTests.Task.cs - - - OnFailureTests.cs - - - OnFailureTests.cs - - - OnSuccessTryTests.Task.cs - - - OnSuccessTryTests.Task.cs - - - OnSuccessTryTests.cs - TapErrorIfTests.cs diff --git a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.Base.cs b/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.Base.cs deleted file mode 100644 index 5c0a6708..00000000 --- a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.Base.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions.Tests.ResultTests.Extensions -{ - public abstract class OnFailureTestsBase : TestBase - { - protected bool actionExecuted; - - protected OnFailureTestsBase() - { - actionExecuted = false; - } - - protected void Action() => actionExecuted = true; - - protected void ActionString(string _) => actionExecuted = true; - - protected void ActionError(E _) => actionExecuted = true; - - protected Task TaskAction() - { - actionExecuted = true; - return Task.CompletedTask; - } - - protected Task TaskActionString(string _) - { - actionExecuted = true; - return Task.CompletedTask; - } - - protected Task TaskActionError(E _) - { - actionExecuted = true; - return Task.CompletedTask; - } - - protected ValueTask ValueTaskAction() - { - actionExecuted = true; - return ValueTask.CompletedTask; - } - - protected ValueTask ValueTaskActionString(string _) - { - actionExecuted = true; - return ValueTask.CompletedTask; - } - - protected ValueTask ValueTaskActionError(E _) - { - actionExecuted = true; - return ValueTask.CompletedTask; - } - } -} \ No newline at end of file diff --git a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.Task.Left.cs b/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.Task.Left.cs deleted file mode 100644 index 640d34de..00000000 --- a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.Task.Left.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System.Threading.Tasks; -using FluentAssertions; -using Xunit; - -namespace CSharpFunctionalExtensions.Tests.ResultTests.Extensions -{ - public class OnFailureTests_Task_Left : OnFailureTestsBase - { - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_Task_Left_executes_action_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, ErrorMessage); - - Result returned = await result.AsTask().OnFailure(Action); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_Task_Left_executes_action_string_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, ErrorMessage); - - Result returned = await result.AsTask().OnFailure(ActionString); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_Task_Left_T_executes_action_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, ErrorMessage); - - Result returned = await result.AsTask().OnFailure(Action); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_Task_Left_T_executes_action_string_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, ErrorMessage); - - Result returned = await result.AsTask().OnFailure(ActionString); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_Task_Left_UnitResult_E_executes_action_on_failure_and_returns_self(bool isSuccess) - { - UnitResult result = UnitResult.SuccessIf(isSuccess, E.Value); - - UnitResult returned = await result.AsTask().OnFailure(Action); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_Task_Left_UnitResult_E_executes_E_action_on_failure_and_returns_self(bool isSuccess) - { - UnitResult result = UnitResult.SuccessIf(isSuccess, E.Value); - - UnitResult returned = await result.AsTask().OnFailure(ActionError); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_Task_Left_T_E_executes_action_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, E.Value); - - Result returned = await result.AsTask().OnFailure(Action); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_Task_Left_T_E_executes_action_T_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, E.Value); - - Result returned = await result.AsTask().OnFailure(ActionError); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - } -} \ No newline at end of file diff --git a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.Task.Right.cs b/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.Task.Right.cs deleted file mode 100644 index ab77bf06..00000000 --- a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.Task.Right.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System.Threading.Tasks; -using FluentAssertions; -using Xunit; - -namespace CSharpFunctionalExtensions.Tests.ResultTests.Extensions -{ - public class OnFailureTests_Task_Right : OnFailureTestsBase - { - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_Task_Right_executes_action_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, ErrorMessage); - - Result returned = await result.OnFailure(TaskAction); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_Task_Right_executes_action_string_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, ErrorMessage); - - Result returned = await result.OnFailure(TaskActionString); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_Task_Right_T_executes_action_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, ErrorMessage); - - Result returned = await result.OnFailure(TaskAction); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_Task_Right_T_executes_action_string_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, ErrorMessage); - - Result returned = await result.OnFailure(TaskActionString); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_Task_Right_UnitResult_E_executes_action_on_failure_and_returns_self(bool isSuccess) - { - UnitResult result = UnitResult.SuccessIf(isSuccess, E.Value); - - UnitResult returned = await result.OnFailure(TaskAction); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_Task_Right_UnitResult_E_executes_E_action_on_failure_and_returns_self(bool isSuccess) - { - UnitResult result = UnitResult.SuccessIf(isSuccess, E.Value); - - UnitResult returned = await result.OnFailure(TaskActionError); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_Task_Right_T_E_executes_action_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, E.Value); - - Result returned = await result.OnFailure(TaskAction); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_Task_Right_T_E_executes_action_T_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, E.Value); - - Result returned = await result.OnFailure(TaskActionError); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - } -} \ No newline at end of file diff --git a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.Task.cs b/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.Task.cs deleted file mode 100644 index 36b24408..00000000 --- a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.Task.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System.Threading.Tasks; -using FluentAssertions; -using Xunit; - -namespace CSharpFunctionalExtensions.Tests.ResultTests.Extensions -{ - public class OnFailure_Task_Tests : OnFailureTestsBase - { - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_Task_executes_action_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, ErrorMessage); - - Result returned = await result.AsTask().OnFailure(TaskAction); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_Task_executes_action_string_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, ErrorMessage); - - Result returned = await result.AsTask().OnFailure(TaskActionString); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_Task_T_executes_action_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, ErrorMessage); - - Result returned = await result.AsTask().OnFailure(TaskAction); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_Task_T_executes_action_string_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, ErrorMessage); - - Result returned = await result.AsTask().OnFailure(TaskActionString); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_Task_UnitResult_E_executes_action_on_failure_and_returns_self(bool isSuccess) - { - UnitResult result = UnitResult.SuccessIf(isSuccess, E.Value); - - UnitResult returned = await result.AsTask().OnFailure(TaskAction); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_Task_UnitResult_E_executes_E_action_on_failure_and_returns_self(bool isSuccess) - { - UnitResult result = UnitResult.SuccessIf(isSuccess, E.Value); - - UnitResult returned = await result.AsTask().OnFailure(TaskActionError); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_Task_T_E_executes_action_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, E.Value); - - Result returned = await result.AsTask().OnFailure(TaskAction); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_Task_T_E_executes_action_T_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, E.Value); - - Result returned = await result.AsTask().OnFailure(TaskActionError); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - } -} \ No newline at end of file diff --git a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.ValueTask.Left.cs b/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.ValueTask.Left.cs deleted file mode 100644 index c96cd3ca..00000000 --- a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.ValueTask.Left.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System.Threading.Tasks; -using CSharpFunctionalExtensions.ValueTasks; -using FluentAssertions; -using Xunit; - -namespace CSharpFunctionalExtensions.Tests.ResultTests.Extensions -{ - public class OnFailureTests_ValueTask_Left : OnFailureTestsBase - { - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_ValueTask_Left_executes_action_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, ErrorMessage); - - Result returned = await result.AsValueTask().OnFailure(Action); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_ValueTask_Left_executes_action_string_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, ErrorMessage); - - Result returned = await result.AsValueTask().OnFailure(ActionString); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_ValueTask_Left_T_executes_action_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, ErrorMessage); - - Result returned = await result.AsValueTask().OnFailure(Action); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_ValueTask_Left_T_executes_action_string_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, ErrorMessage); - - Result returned = await result.AsValueTask().OnFailure(ActionString); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_ValueTask_Left_UnitResult_E_executes_action_on_failure_and_returns_self(bool isSuccess) - { - UnitResult result = UnitResult.SuccessIf(isSuccess, E.Value); - - UnitResult returned = await result.AsValueTask().OnFailure(Action); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_ValueTask_Left_UnitResult_E_executes_E_action_on_failure_and_returns_self(bool isSuccess) - { - UnitResult result = UnitResult.SuccessIf(isSuccess, E.Value); - - UnitResult returned = await result.AsValueTask().OnFailure(ActionError); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_ValueTask_Left_T_E_executes_action_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, E.Value); - - Result returned = await result.AsValueTask().OnFailure(Action); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_ValueTask_Left_T_E_executes_action_T_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, E.Value); - - Result returned = await result.AsValueTask().OnFailure(ActionError); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - } -} \ No newline at end of file diff --git a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.ValueTask.Right.cs b/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.ValueTask.Right.cs deleted file mode 100644 index 87ed378b..00000000 --- a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.ValueTask.Right.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System.Threading.Tasks; -using CSharpFunctionalExtensions.ValueTasks; -using FluentAssertions; -using Xunit; - -namespace CSharpFunctionalExtensions.Tests.ResultTests.Extensions -{ - public class OnFailureTests_ValueTask_Right : OnFailureTestsBase - { - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_ValueTask_Right_executes_action_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, ErrorMessage); - - Result returned = await result.OnFailure(ValueTaskAction); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_ValueTask_Right_executes_action_string_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, ErrorMessage); - - Result returned = await result.OnFailure(ValueTaskActionString); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_ValueTask_Right_T_executes_action_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, ErrorMessage); - - Result returned = await result.OnFailure(ValueTaskAction); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_ValueTask_Right_T_executes_action_string_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, ErrorMessage); - - Result returned = await result.OnFailure(ValueTaskActionString); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_ValueTask_Right_UnitResult_E_executes_action_on_failure_and_returns_self(bool isSuccess) - { - UnitResult result = UnitResult.SuccessIf(isSuccess, E.Value); - - UnitResult returned = await result.OnFailure(ValueTaskAction); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_ValueTask_Right_UnitResult_E_executes_E_action_on_failure_and_returns_self(bool isSuccess) - { - UnitResult result = UnitResult.SuccessIf(isSuccess, E.Value); - - UnitResult returned = await result.OnFailure(ValueTaskActionError); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_ValueTask_Right_T_E_executes_action_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, E.Value); - - Result returned = await result.OnFailure(ValueTaskAction); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_ValueTask_Right_T_E_executes_action_T_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, E.Value); - - Result returned = await result.OnFailure(ValueTaskActionError); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - } -} \ No newline at end of file diff --git a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.ValueTask.cs b/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.ValueTask.cs deleted file mode 100644 index d0c05254..00000000 --- a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.ValueTask.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System.Threading.Tasks; -using CSharpFunctionalExtensions.ValueTasks; -using FluentAssertions; -using Xunit; - -namespace CSharpFunctionalExtensions.Tests.ResultTests.Extensions -{ - public class OnFailure_ValueTask_Tests : OnFailureTestsBase - { - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_ValueTask_executes_action_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, ErrorMessage); - - Result returned = await result.AsValueTask().OnFailure(ValueTaskAction); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_ValueTask_executes_action_string_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, ErrorMessage); - - Result returned = await result.AsValueTask().OnFailure(ValueTaskActionString); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_ValueTask_T_executes_action_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, ErrorMessage); - - Result returned = await result.AsValueTask().OnFailure(ValueTaskAction); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_ValueTask_T_executes_action_string_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, ErrorMessage); - - Result returned = await result.AsValueTask().OnFailure(ValueTaskActionString); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_ValueTask_UnitResult_E_executes_action_on_failure_and_returns_self(bool isSuccess) - { - UnitResult result = UnitResult.SuccessIf(isSuccess, E.Value); - - UnitResult returned = await result.AsValueTask().OnFailure(ValueTaskAction); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_ValueTask_UnitResult_E_executes_E_action_on_failure_and_returns_self(bool isSuccess) - { - UnitResult result = UnitResult.SuccessIf(isSuccess, E.Value); - - UnitResult returned = await result.AsValueTask().OnFailure(ValueTaskActionError); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_ValueTask_T_E_executes_action_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, E.Value); - - Result returned = await result.AsValueTask().OnFailure(ValueTaskAction); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public async Task OnFailure_ValueTask_T_E_executes_action_T_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, E.Value); - - Result returned = await result.AsValueTask().OnFailure(ValueTaskActionError); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - } -} \ No newline at end of file diff --git a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.cs b/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.cs deleted file mode 100644 index 5844ba68..00000000 --- a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnFailureTests.cs +++ /dev/null @@ -1,112 +0,0 @@ -using FluentAssertions; -using Xunit; - -namespace CSharpFunctionalExtensions.Tests.ResultTests.Extensions -{ - public class OnFailureTests : OnFailureTestsBase - { - [Theory] - [InlineData(true)] - [InlineData(false)] - public void OnFailure_executes_action_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, ErrorMessage); - - Result returned = result.OnFailure(Action); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public void OnFailure_executes_action_string_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, ErrorMessage); - - Result returned = result.OnFailure(ActionString); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public void OnFailure_T_executes_action_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, ErrorMessage); - - Result returned = result.OnFailure(Action); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public void OnFailure_T_executes_action_string_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, ErrorMessage); - - Result returned = result.OnFailure(ActionString); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public void OnFailure_UnitResult_E_executes_action_on_failure_and_returns_self(bool isSuccess) - { - UnitResult result = UnitResult.SuccessIf(isSuccess, E.Value); - - UnitResult returned = result.OnFailure(Action); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public void OnFailure_UnitResult_E_executes_E_action_on_failure_and_returns_self(bool isSuccess) - { - UnitResult result = UnitResult.SuccessIf(isSuccess, E.Value); - - UnitResult returned = result.OnFailure(ActionError); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public void OnFailure_T_E_executes_action_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, E.Value); - - Result returned = result.OnFailure(Action); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public void OnFailure_T_E_executes_action_T_on_result_failure_and_returns_self(bool isSuccess) - { - Result result = Result.SuccessIf(isSuccess, T.Value, E.Value); - - Result returned = result.OnFailure(ActionError); - - actionExecuted.Should().Be(!isSuccess); - result.Should().Be(returned); - } - } -} \ No newline at end of file diff --git a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnSuccessTryTests.Task.Left.cs b/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnSuccessTryTests.Task.Left.cs deleted file mode 100644 index e56d8018..00000000 --- a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnSuccessTryTests.Task.Left.cs +++ /dev/null @@ -1,208 +0,0 @@ -using System.Threading.Tasks; -using CSharpFunctionalExtensions.Tests.ResultTests.Methods.Try; -using FluentAssertions; -using Xunit; - -namespace CSharpFunctionalExtensions.Tests.ResultTests.Extensions -{ - public class OnSuccessTryTestBaseTests_Task_Left : TryTestBaseTask - { - [Fact] - public async Task OnSuccessTry_Task_Left_execute_action_success_without_error_handler_function_result_expected() - { - var success = Result.Success().AsTask(); - var result = await success.OnSuccessTry(Action); - - result.IsSuccess.Should().BeTrue(); - } - - [Fact] - public async Task OnSuccessTry_Task_Left_execute_action_failed_without_error_handler_failed_result_expected() - { - var success = Result.Success().AsTask(); - var result = await success.OnSuccessTry(Throwing_Action); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorMessage); - } - - [Fact] - public async Task OnSuccessTry_Task_Left_execute_action_failed_with_error_handler_failed_result_expected() - { - var success = Result.Success().AsTask(); - var result = await success.OnSuccessTry(Throwing_Action, ErrorHandler); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorHandlerMessage); - } - [Fact] - public async Task OnSuccessTry_Task_Left_execute_throwing_action_on_faiulre_failed_with_error_from_failure() - { - var failure = Result.Failure(ErrorMessage).AsTask(); - var result = await failure.OnSuccessTry(Throwing_Action, ErrorHandler); - - result.IsFailure.Should().BeTrue(); - FuncExecuted.Should().BeFalse(); - result.Error.Should().Be(ErrorMessage); - } - [Fact] - public async Task OnSuccessTry_Task_Left_T_execute_function_success_without_error_handler_function_result_expected() - { - var success = Result.Success().AsTask(); - var result = await success.OnSuccessTry(Func_T); - - result.IsSuccess.Should().BeTrue(); - result.Value.Should().Be(T.Value); - } - - [Fact] - public async Task OnSuccessTry_Task_Left_T_execute_function_failed_without_error_handler_failed_result_expected() - { - var success = Result.Success().AsTask(); - var result = await success.OnSuccessTry(Throwing_Func_T); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorMessage); - } - - [Fact] - public async Task OnSuccessTry_Task_Left_T_execute_function_failed_with_error_handler_failed_result_expected() - { - var success = Result.Success().AsTask(); - var result = await success.OnSuccessTry(Throwing_Func_T, ErrorHandler); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorHandlerMessage); - } - - [Fact] - public async Task OnSuccessTry_Task_Left_T_execute_action_success_without_error_handler_function_result_expected() - { - var success = Result.Success(T.Value).AsTask(); - var result = await success.OnSuccessTry(Action_T); - - result.IsSuccess.Should().BeTrue(); - } - - [Fact] - public async Task OnSuccessTry_Task_Left_T_execute_action_failed_without_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value).AsTask(); - var result = await success.OnSuccessTry(Throwing_Action_T); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorMessage); - } - - [Fact] - public async Task OnSuccessTry_Task_Left_T_execute_action_failed_with_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value).AsTask(); - var result = await success.OnSuccessTry(Throwing_Action_T, ErrorHandler); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorHandlerMessage); - } - - [Fact] - public async Task OnSuccessTry_Task_Left_T_execute_throwing_action_on_faiulre_failed_with_error_from_failure() - { - var failure = Result.Failure(ErrorMessage).AsTask(); - var result = await failure.OnSuccessTry(Throwing_Action_T, ErrorHandler); - - result.IsFailure.Should().BeTrue(); - FuncExecuted.Should().BeFalse(); - result.Error.Should().Be(ErrorMessage); - } - - [Fact] - public async Task OnSuccessTry_Task_Left_T_K_execute_function_success_without_error_handler_function_result_expected() - { - var success = Result.Success(T.Value).AsTask(); - var result = await success.OnSuccessTry(Func_T_K); - - result.IsSuccess.Should().BeTrue(); - result.Value.Should().Be(K.Value); - } - - [Fact] - public async Task OnSuccessTry_Task_Left_T_K_execute_function_failed_without_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value).AsTask(); - var result = await success.OnSuccessTry(Throwing_Func_T_K); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorMessage); - } - - [Fact] - public async Task OnSuccessTry_Task_Left_T_K_execute_function_failed_with_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value).AsTask(); - var result = await success.OnSuccessTry(Throwing_Func_T_K, ErrorHandler); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorHandlerMessage); - } - - [Fact] - public async Task OnSuccessTry_Task_Left_T_E_execute_function_success_without_error_handler_function_result_expected() - { - var success = Result.Success(T.Value).AsTask(); - var result = await success.OnSuccessTry(Func_T, ErrorHandler_E); - - result.IsSuccess.Should().BeTrue(); - result.Value.Should().Be(T.Value); - } - - [Fact] - public async Task OnSuccessTry_Task_Left_T_E_execute_function_failed_without_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value).AsTask(); - var result = await success.OnSuccessTry(Throwing_Func_T, ErrorHandler_E); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(E.Value); - } - - [Fact] - public async Task OnSuccessTry_Task_Left_T_E_execute_function_failed_with_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value).AsTask(); - var result = await success.OnSuccessTry(Throwing_Func_T, ErrorHandler_E); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(E.Value); - } - - [Fact] - public async Task OnSuccessTry_Task_Left_T_K_E_execute_function_success_without_error_handler_function_result_expected() - { - var success = Result.Success(T.Value).AsTask(); - var result = await success.OnSuccessTry(Func_T_K, ErrorHandler_E); - - result.IsSuccess.Should().BeTrue(); - result.Value.Should().Be(K.Value); - } - - [Fact] - public async Task OnSuccessTry_Task_Left_T_K_E_execute_function_failed_without_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value).AsTask(); - var result = await success.OnSuccessTry(Throwing_Func_T_K, ErrorHandler_E); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(E.Value); - } - - [Fact] - public async Task OnSuccessTry_Task_Left_T_K_E_execute_function_failed_with_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value).AsTask(); - var result = await success.OnSuccessTry(Throwing_Func_T_K, ErrorHandler_E); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(E.Value); - } - } -} \ No newline at end of file diff --git a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnSuccessTryTests.Task.Right.cs b/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnSuccessTryTests.Task.Right.cs deleted file mode 100644 index 90fb12bc..00000000 --- a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnSuccessTryTests.Task.Right.cs +++ /dev/null @@ -1,213 +0,0 @@ -using System.Threading.Tasks; -using CSharpFunctionalExtensions.Tests.ResultTests.Methods.Try; -using FluentAssertions; -using FluentAssertions.CSharpFunctionalExtensions; -using Xunit; - -namespace CSharpFunctionalExtensions.Tests.ResultTests.Extensions -{ - public class OnSuccessTryTestBaseTests_Task_Right : TryTestBaseTask - { - [Fact] - public async Task OnSuccess_Task_Right_execute_action_success_without_error_handler_function_result_expected() - { - var success = Result.Success(); - var result = await success.OnSuccessTry(Func_Task); - - result.IsSuccess.Should().BeTrue(); - } - - [Fact] - public async Task OnSuccess_Task_Right_execute_action_failed_without_error_handler_failed_result_expected() - { - var success = Result.Success(); - var result = await success.OnSuccessTry(Throwing_Func_Task); - - result.Should() - .BeFailure() - .And.Subject.Error.Should() - .Be(ErrorMessage); - } - - [Fact] - public async Task OnSuccess_Task_Right_execute_action_failed_with_error_handler_failed_result_expected() - { - var success = Result.Success(); - var result = await success.OnSuccessTry(Throwing_Func_Task, ErrorHandler); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorHandlerMessage); - } - - [Fact] - public async Task OnSuccessTry_Task_Right_execute_action_on_faiulre_failed_with_error_from_failure() - { - var failure = Result.Failure(ErrorMessage); - var result = await failure.OnSuccessTry(Throwing_Func_Task, ErrorHandler); - - result.IsFailure.Should().BeTrue(); - FuncExecuted.Should().BeFalse(); - result.Error.Should().Be(ErrorMessage); - } - - [Fact] - public async Task OnSuccess_Task_Right_T_execute_function_success_without_error_handler_function_result_expected() - { - var success = Result.Success(); - var result = await success.OnSuccessTry(Func_Task_T); - - result.IsSuccess.Should().BeTrue(); - result.Value.Should().Be(T.Value); - } - - [Fact] - public async Task OnSuccess_Task_Right_T_execute_function_failed_without_error_handler_failed_result_expected() - { - var success = Result.Success(); - var result = await success.OnSuccessTry(Throwing_Func_Task_T); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorMessage); - } - - [Fact] - public async Task OnSuccess_Task_Right_T_execute_function_failed_with_error_handler_failed_result_expected() - { - var success = Result.Success(); - var result = await success.OnSuccessTry(Throwing_Func_Task_T, ErrorHandler); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorHandlerMessage); - } - - [Fact] - public async Task OnSuccess_Task_Right_T_execute_action_success_without_error_handler_function_result_expected() - { - var success = Result.Success(T.Value); - var result = await success.OnSuccessTry(Func_T_Task); - - result.IsSuccess.Should().BeTrue(); - } - - [Fact] - public async Task OnSuccess_Task_Right_T_execute_action_failed_without_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value); - var result = await success.OnSuccessTry(Throwing_Func_T_Task); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorMessage); - } - - [Fact] - public async Task OnSuccess_Task_Right_T_execute_action_failed_with_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value); - var result = await success.OnSuccessTry(Throwing_Func_T_Task, ErrorHandler); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorHandlerMessage); - } - - [Fact] - public async Task OnSuccessTry_Task_Right_T_execute_action_on_faiulre_failed_with_error_from_failure() - { - var failure = Result.Failure(ErrorMessage); - var result = await failure.OnSuccessTry(Throwing_Func_T_Task, ErrorHandler); - - result.IsFailure.Should().BeTrue(); - FuncExecuted.Should().BeFalse(); - result.Error.Should().Be(ErrorMessage); - } - - [Fact] - public async Task OnSuccess_Task_Right_T_K_execute_function_success_without_error_handler_function_result_expected() - { - var success = Result.Success(T.Value); - var result = await success.OnSuccessTry(Func_T_Task_K); - - result.IsSuccess.Should().BeTrue(); - result.Value.Should().Be(K.Value); - } - - [Fact] - public async Task OnSuccess_Task_Right_T_K_execute_function_failed_without_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value); - var result = await success.OnSuccessTry(Throwing_Func_T_Task_K); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorMessage); - } - - [Fact] - public async Task OnSuccess_Task_Right_T_K_execute_function_failed_with_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value); - var result = await success.OnSuccessTry(Throwing_Func_T_Task_K, ErrorHandler); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorHandlerMessage); - } - - [Fact] - public async Task OnSuccess_Task_Right_T_E_execute_function_success_without_error_handler_function_result_expected() - { - var success = Result.Success(T.Value); - var result = await success.OnSuccessTry(Func_Task_T, ErrorHandler_E); - - result.IsSuccess.Should().BeTrue(); - result.Value.Should().Be(T.Value); - } - - [Fact] - public async Task OnSuccess_Task_Right_T_E_execute_function_failed_without_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value); - var result = await success.OnSuccessTry(Throwing_Func_Task_T, ErrorHandler_E); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(E.Value); - } - - [Fact] - public async Task OnSuccess_Task_Right_T_E_execute_function_failed_with_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value); - var result = await success.OnSuccessTry(Throwing_Func_Task_T, ErrorHandler_E); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(E.Value); - } - - [Fact] - public async Task OnSuccess_Task_Right_T_K_E_execute_function_success_without_error_handler_function_result_expected() - { - var success = Result.Success(T.Value); - var result = await success.OnSuccessTry(Func_T_Task_K, ErrorHandler_E); - - result.IsSuccess.Should().BeTrue(); - result.Value.Should().Be(K.Value); - } - - [Fact] - public async Task OnSuccess_Task_Right_T_K_E_execute_function_failed_without_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value); - var result = await success.OnSuccessTry(Throwing_Func_T_Task_K, ErrorHandler_E); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(E.Value); - } - - [Fact] - public async Task OnSuccess_Task_Right_T_K_E_execute_function_failed_with_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value); - var result = await success.OnSuccessTry(Throwing_Func_T_Task_K, ErrorHandler_E); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(E.Value); - } - } -} \ No newline at end of file diff --git a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnSuccessTryTests.Task.cs b/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnSuccessTryTests.Task.cs deleted file mode 100644 index e9dc75df..00000000 --- a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnSuccessTryTests.Task.cs +++ /dev/null @@ -1,222 +0,0 @@ -using System.Threading.Tasks; -using CSharpFunctionalExtensions.Tests.ResultTests.Methods.Try; -using FluentAssertions; -using Xunit; - -namespace CSharpFunctionalExtensions.Tests.ResultTests.Extensions -{ - public class OnSuccessTryTests_Task : TryTestBaseTask - { - [Fact] - public async Task OnSuccessTry_Task_execute_action_success_without_error_handler_function_result_expected() - { - var success = Result.Success().AsTask(); - var result = await success.OnSuccessTry(Func_Task); - - result.IsSuccess.Should().BeTrue(); - } - - [Fact] - public async Task OnSuccessTry_Task_execute_action_failed_without_error_handler_failed_result_expected() - { - var success = Result.Success().AsTask(); - var result = await success.OnSuccessTry(Throwing_Func_Task); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorMessage); - } - - [Fact] - public async Task OnSuccessTry_Task_execute_action_failed_with_configured_default_error_handler_failed_result_expected() - { - var defaultTryErrorHandler = Result.Configuration.DefaultTryErrorHandler; - Result.Configuration.DefaultTryErrorHandler = ErrorHandler; - var success = Result.Success().AsTask(); - var result = await success.OnSuccessTry(Throwing_Func_Task); - Result.Configuration.DefaultTryErrorHandler = defaultTryErrorHandler; - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorHandlerMessage); - } - - [Fact] - public async Task OnSuccessTry_Task_execute_action_failed_with_error_handler_failed_result_expected() - { - var success = Result.Success().AsTask(); - var result = await success.OnSuccessTry(Throwing_Func_Task, ErrorHandler); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorHandlerMessage); - } - [Fact] - public async Task OnSuccessTry_Task_execute_throwing_action_on_faiulre_failed_with_error_from_failure() - { - var failure = Result.Failure(ErrorMessage).AsTask(); - var result = await failure.OnSuccessTry(Throwing_Func_Task, ErrorHandler); - - result.IsFailure.Should().BeTrue(); - FuncExecuted.Should().BeFalse(); - result.Error.Should().Be(ErrorMessage); - } - - [Fact] - public async Task OnSuccessTry_Task_T_execute_function_success_without_error_handler_function_result_expected() - { - var success = Result.Success().AsTask(); - var result = await success.OnSuccessTry(Func_Task_T); - - result.IsSuccess.Should().BeTrue(); - result.Value.Should().Be(T.Value); - } - - [Fact] - public async Task OnSuccessTry_Task_T_execute_function_failed_without_error_handler_failed_result_expected() - { - var success = Result.Success().AsTask(); - var result = await success.OnSuccessTry(Throwing_Func_Task_T); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorMessage); - } - - [Fact] - public async Task OnSuccessTry_Task_T_execute_function_failed_with_error_handler_failed_result_expected() - { - var success = Result.Success().AsTask(); - var result = await success.OnSuccessTry(Throwing_Func_Task_T, ErrorHandler); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorHandlerMessage); - } - - [Fact] - public async Task OnSuccessTry_Task_T_execute_action_success_without_error_handler_function_result_expected() - { - var success = Result.Success(T.Value).AsTask(); - var result = await success.OnSuccessTry(Func_T_Task); - - result.IsSuccess.Should().BeTrue(); - } - - [Fact] - public async Task OnSuccessTry_Task_T_execute_action_failed_without_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value).AsTask(); - var result = await success.OnSuccessTry(Throwing_Func_T_Task); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorMessage); - } - - [Fact] - public async Task OnSuccessTry_Task_T_execute_action_failed_with_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value).AsTask(); - var result = await success.OnSuccessTry(Throwing_Func_T_Task, ErrorHandler); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorHandlerMessage); - } - - [Fact] - public async Task OnSuccessTry_Task_T_execute_throwing_action_on_faiulre_failed_with_error_from_failure() - { - var failure = Result.Failure(ErrorMessage).AsTask(); - var result = await failure.OnSuccessTry(Throwing_Func_T_Task, ErrorHandler); - - result.IsFailure.Should().BeTrue(); - FuncExecuted.Should().BeFalse(); - result.Error.Should().Be(ErrorMessage); - } - - [Fact] - public async Task OnSuccessTry_Task_T_K_execute_function_success_without_error_handler_function_result_expected() - { - var success = Result.Success(T.Value).AsTask(); - var result = await success.OnSuccessTry(Func_T_Task_K); - - result.IsSuccess.Should().BeTrue(); - result.Value.Should().Be(K.Value); - } - - [Fact] - public async Task OnSuccessTry_Task_T_K_execute_function_failed_without_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value).AsTask(); - var result = await success.OnSuccessTry(Throwing_Func_T_Task_K); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorMessage); - } - - [Fact] - public async Task OnSuccessTry_Task_T_K_execute_function_failed_with_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value).AsTask(); - var result = await success.OnSuccessTry(Throwing_Func_T_Task_K, ErrorHandler); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorHandlerMessage); - } - - [Fact] - public async Task OnSuccessTry_Task_T_E_execute_function_success_without_error_handler_function_result_expected() - { - var success = Result.Success(T.Value).AsTask(); - var result = await success.OnSuccessTry(Func_Task_T, ErrorHandler_E); - - result.IsSuccess.Should().BeTrue(); - result.Value.Should().Be(T.Value); - } - - [Fact] - public async Task OnSuccessTry_Task_T_E_execute_function_failed_without_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value).AsTask(); - var result = await success.OnSuccessTry(Throwing_Func_Task_T, ErrorHandler_E); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(E.Value); - } - - [Fact] - public async Task OnSuccessTry_Task_T_E_execute_function_failed_with_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value).AsTask(); - var result = await success.OnSuccessTry(Throwing_Func_Task_T, ErrorHandler_E); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(E.Value); - } - - [Fact] - public async Task OnSuccessTry_Task_T_K_E_execute_function_success_without_error_handler_function_result_expected() - { - var success = Result.Success(T.Value).AsTask(); - var result = await success.OnSuccessTry(Func_T_Task_K, ErrorHandler_E); - - result.IsSuccess.Should().BeTrue(); - result.Value.Should().Be(K.Value); - } - - [Fact] - public async Task OnSuccessTry_Task_T_K_E_execute_function_failed_without_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value).AsTask(); - var result = await success.OnSuccessTry(Throwing_Func_T_Task_K, ErrorHandler_E); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(E.Value); - } - - [Fact] - public async Task OnSuccessTry_Task_T_K_E_execute_function_failed_with_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value).AsTask(); - var result = await success.OnSuccessTry(Throwing_Func_T_Task_K, ErrorHandler_E); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(E.Value); - } - } -} \ No newline at end of file diff --git a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnSuccessTryTests.cs b/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnSuccessTryTests.cs deleted file mode 100644 index 21948415..00000000 --- a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/OnSuccessTryTests.cs +++ /dev/null @@ -1,215 +0,0 @@ -using CSharpFunctionalExtensions.Tests.ResultTests.Methods.Try; -using FluentAssertions; -using Xunit; - -namespace CSharpFunctionalExtensions.Tests.ResultTests.Extensions -{ - public class OnSuccessTryTests : TryTestBase - { - [Fact] - public void OnSuccessTry_execute_action_success_without_error_handler_function_result_expected() - { - var success = Result.Success(); - var result = success.OnSuccessTry(Action); - - result.IsSuccess.Should().BeTrue(); - FuncExecuted.Should().BeTrue(); - } - - [Fact] - public void OnSuccessTry_execute_action_failed_without_error_handler_failed_result_expected() - { - var success = Result.Success(); - var result = success.OnSuccessTry(Throwing_Action); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorMessage); - } - - [Fact] - public void OnSuccessTry_execute_action_failed_with_error_handler_failed_result_expected() - { - var success = Result.Success(); - var result = success.OnSuccessTry(Throwing_Action, ErrorHandler); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorHandlerMessage); - } - - [Fact] - public void OnSuccessTry_execute_throwing_action_on_faiulre_failed_with_error_from_failure() - { - var failure = Result.Failure(ErrorMessage); - var result = failure.OnSuccessTry(Throwing_Action, ErrorHandler); - - result.IsFailure.Should().BeTrue(); - FuncExecuted.Should().BeFalse(); - result.Error.Should().Be(ErrorMessage); - } - - [Fact] - public void OnSuccessTry_T_execute_function_success_without_error_handler_function_result_expected() - { - var success = Result.Success(); - var result = success.OnSuccessTry(Func_T); - - result.IsSuccess.Should().BeTrue(); - result.Value.Should().Be(T.Value); - FuncExecuted.Should().BeTrue(); - } - - [Fact] - public void OnSuccessTry_T_execute_function_failed_without_error_handler_failed_result_expected() - { - var success = Result.Success(); - var result = success.OnSuccessTry(Throwing_Func_T); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorMessage); - } - - [Fact] - public void OnSuccessTry_T_execute_function_failed_with_error_handler_failed_result_expected() - { - var success = Result.Success(); - var result = success.OnSuccessTry(Throwing_Func_T, ErrorHandler); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorHandlerMessage); - } - - [Fact] - public void OnSuccessTry_T_execute_action_success_without_error_handler_function_result_expected() - { - var success = Result.Success(T.Value); - var result = success.OnSuccessTry(Action_T); - - result.IsSuccess.Should().BeTrue(); - FuncExecuted.Should().BeTrue(); - } - - [Fact] - public void OnSuccessTry_T_execute_action_failed_without_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value); - var result = success.OnSuccessTry(Throwing_Action_T); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorMessage); - } - - [Fact] - public void OnSuccessTry_T_execute_action_failed_with_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value); - var result = success.OnSuccessTry(Throwing_Action_T, ErrorHandler); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorHandlerMessage); - } - - [Fact] - public void OnSuccessTry_T_execute_throwing_action_on_faiulre_failed_with_error_from_failure() - { - var failure = Result.Failure(ErrorMessage); - var result = failure.OnSuccessTry(Throwing_Action_T, ErrorHandler); - - result.IsFailure.Should().BeTrue(); - FuncExecuted.Should().BeFalse(); - result.Error.Should().Be(ErrorMessage); - } - - [Fact] - public void OnSuccessTry_T_K_execute_function_success_without_error_handler_function_result_expected() - { - var success = Result.Success(T.Value); - var result = success.OnSuccessTry(Func_T_K); - - result.IsSuccess.Should().BeTrue(); - result.Value.Should().Be(K.Value); - FuncExecuted.Should().BeTrue(); - } - - [Fact] - public void OnSuccessTry_T_K_execute_function_failed_without_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value); - var result = success.OnSuccessTry(Throwing_Func_T_K); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorMessage); - } - - [Fact] - public void OnSuccessTry_T_K_execute_function_failed_with_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value); - var result = success.OnSuccessTry(Throwing_Func_T_K, ErrorHandler); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(ErrorHandlerMessage); - } - - [Fact] - public void OnSuccessTry_T_E_execute_function_success_without_error_handler_function_result_expected() - { - var success = Result.Success(T.Value); - var result = success.OnSuccessTry(Func_T, ErrorHandler_E); - - result.IsSuccess.Should().BeTrue(); - result.Value.Should().Be(T.Value); - FuncExecuted.Should().BeTrue(); - } - - [Fact] - public void OnSuccessTry_T_E_execute_function_failed_without_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value); - var result = success.OnSuccessTry(Throwing_Func_T, ErrorHandler_E); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(E.Value); - } - - [Fact] - public void OnSuccessTry_T_E_execute_function_failed_with_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value); - var result = success.OnSuccessTry(Throwing_Func_T, ErrorHandler_E); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(E.Value); - } - - [Fact] - public void OnSuccessTry_T_K_E_execute_function_success_without_error_handler_function_result_expected() - { - var success = Result.Success(T.Value); - var result = success.OnSuccessTry(Func_T_K, ErrorHandler_E); - - result.IsSuccess.Should().BeTrue(); - result.Value.Should().Be(K.Value); - FuncExecuted.Should().BeTrue(); - } - - [Fact] - public void OnSuccessTry_T_K_E_execute_function_failed_without_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value); - var result = success.OnSuccessTry(Throwing_Func_T_K, ErrorHandler_E); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(E.Value); - } - - [Fact] - public void OnSuccessTry_T_K_E_execute_function_failed_with_error_handler_failed_result_expected() - { - var success = Result.Success(T.Value); - var result = success.OnSuccessTry(Throwing_Func_T_K, ErrorHandler_E); - - result.IsFailure.Should().BeTrue(); - result.Error.Should().Be(E.Value); - } - } -} \ No newline at end of file diff --git a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/TapIfTests.Task.Left.cs b/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/TapIfTests.Task.Left.cs index 54f8987b..8c7638ad 100644 --- a/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/TapIfTests.Task.Left.cs +++ b/CSharpFunctionalExtensions.Tests/ResultTests/Extensions/TapIfTests.Task.Left.cs @@ -80,51 +80,6 @@ public void TapIf_Task_Left_T_E_executes_action_T_conditionally_and_returns_self result.Should().Be(returned); } - [Theory] - [InlineData(true, true)] - [InlineData(true, false)] - [InlineData(false, true)] - [InlineData(false, false)] - public void TapIf_Task_Left_T_executes_func_result_T_conditionally_and_returns_self(bool isSuccess, bool condition) - { - Result result = Result.SuccessIf(isSuccess, condition, ErrorMessage); - - var returned = result.AsTask().TapIf(condition, Func_Result).Result; - - actionExecuted.Should().Be(isSuccess && condition); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true, true)] - [InlineData(true, false)] - [InlineData(false, true)] - [InlineData(false, false)] - public void TapIf_Task_Left_T_executes_func_result_K_conditionally_and_returns_self(bool isSuccess, bool condition) - { - Result result = Result.SuccessIf(isSuccess, condition, ErrorMessage); - - var returned = result.AsTask().TapIf(condition, Func_Result_K).Result; - - actionExecuted.Should().Be(isSuccess && condition); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true, true)] - [InlineData(true, false)] - [InlineData(false, true)] - [InlineData(false, false)] - public void TapIf_Task_Left_T_executes_func_result_K_E_conditionally_and_returns_self(bool isSuccess, bool condition) - { - Result result = Result.SuccessIf(isSuccess, condition, E.Value); - - var returned = result.AsTask().TapIf(condition, Func_Result_K_E).Result; - - actionExecuted.Should().Be(isSuccess && condition); - result.Should().Be(returned); - } - [Theory] [InlineData(true, true)] [InlineData(true, false)] @@ -203,50 +158,5 @@ public void TapIf_Task_Left_T_E_executes_action_T_per_predicate_and_returns_self actionExecuted.Should().Be(isSuccess && condition); result.Should().Be(returned); } - - [Theory] - [InlineData(true, true)] - [InlineData(true, false)] - [InlineData(false, true)] - [InlineData(false, false)] - public void TapIf_Task_Left_T_executes_func_result_T_per_predicate_and_returns_self(bool isSuccess, bool condition) - { - Result result = Result.SuccessIf(isSuccess, condition, ErrorMessage); - - var returned = result.AsTask().TapIf(Predicate, Func_Result).Result; - - actionExecuted.Should().Be(isSuccess && condition); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true, true)] - [InlineData(true, false)] - [InlineData(false, true)] - [InlineData(false, false)] - public void TapIf_Task_Left_T_executes_func_result_K_per_predicate_and_returns_self(bool isSuccess, bool condition) - { - Result result = Result.SuccessIf(isSuccess, condition, ErrorMessage); - - var returned = result.AsTask().TapIf(Predicate, Func_Result_K).Result; - - actionExecuted.Should().Be(isSuccess && condition); - result.Should().Be(returned); - } - - [Theory] - [InlineData(true, true)] - [InlineData(true, false)] - [InlineData(false, true)] - [InlineData(false, false)] - public void TapIf_Task_Left_T_executes_func_result_K_E_per_predicate_and_returns_self(bool isSuccess, bool condition) - { - Result result = Result.SuccessIf(isSuccess, condition, E.Value); - - var returned = result.AsTask().TapIf(Predicate, Func_Result_K_E).Result; - - actionExecuted.Should().Be(isSuccess && condition); - result.Should().Be(returned); - } } } diff --git a/CSharpFunctionalExtensions/CSharpFunctionalExtensions.csproj b/CSharpFunctionalExtensions/CSharpFunctionalExtensions.csproj index e9b04054..24729e26 100644 --- a/CSharpFunctionalExtensions/CSharpFunctionalExtensions.csproj +++ b/CSharpFunctionalExtensions/CSharpFunctionalExtensions.csproj @@ -5,21 +5,15 @@ CSharpFunctionalExtensions - - CSharpFunctionalExtensions .NET 4.5 - - - CSharpFunctionalExtensions .NET 4.6.1 - CSharpFunctionalExtensions .NET Standard 2.0 - - CSharpFunctionalExtensions .NET 5.0 - CSharpFunctionalExtensions .NET 6.0 + + CSharpFunctionalExtensions .NET 8.0 + @@ -27,10 +21,6 @@ - - - - all @@ -492,15 +482,6 @@ Match.cs - - OnFailure.Task.cs - - - OnFailure.Task.cs - - - OnFailure.ValueTask.cs - OnFailure.ValueTask.cs diff --git a/CSharpFunctionalExtensions/Maybe/Extensions/Select.cs b/CSharpFunctionalExtensions/Maybe/Extensions/Select.cs index 12421bd9..2f27a006 100644 --- a/CSharpFunctionalExtensions/Maybe/Extensions/Select.cs +++ b/CSharpFunctionalExtensions/Maybe/Extensions/Select.cs @@ -9,12 +9,5 @@ public static Maybe Select(in this Maybe maybe, Func selector) { return maybe.Map(selector); } - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Bind instead of this method")] - public static Maybe Select(in this Maybe maybe, Func> selector) - { - return maybe.Bind(selector); - } } -} \ No newline at end of file +} diff --git a/CSharpFunctionalExtensions/Maybe/Obsolete/Unwrap.cs b/CSharpFunctionalExtensions/Maybe/Obsolete/Unwrap.cs deleted file mode 100644 index e1b7aab4..00000000 --- a/CSharpFunctionalExtensions/Maybe/Obsolete/Unwrap.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.ComponentModel; - -namespace CSharpFunctionalExtensions.Obsolete -{ - public static partial class MaybeExtensions - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use GetValueOrDefault() instead.")] - public static T Unwrap(in this Maybe maybe, T defaultValue = default) - { - return maybe.GetValueOrDefault(defaultValue); - } - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use GetValueOrDefault() instead.")] - public static K Unwrap(in this Maybe maybe, Func selector, K defaultValue = default(K)) - { - return maybe.GetValueOrDefault(selector, defaultValue); - } - } -} \ No newline at end of file diff --git a/CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.Task.Left.cs b/CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.Task.Left.cs deleted file mode 100644 index bd02d13d..00000000 --- a/CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.Task.Left.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.ComponentModel; -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions -{ - public static partial class ResultExtensions - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Task> OnFailure(this Task> resultTask, Action action) - => resultTask.TapError(action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Task OnFailure(this Task resultTask, Action action) - => resultTask.TapError(action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Task> OnFailure(this Task> resultTask, Action action) - => resultTask.TapError(action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Task> OnFailure(this Task> resultTask, Action action) - => resultTask.TapError(action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Task> OnFailure(this Task> resultTask, Action action) - => resultTask.TapError(action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Task> OnFailure(this Task> resultTask, Action action) - => resultTask.TapError(action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Task> OnFailure(this Task> resultTask, Action action) - => resultTask.TapError(action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Task OnFailure(this Task resultTask, Action action) - => resultTask.TapError(action); - } -} diff --git a/CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.Task.Right.cs b/CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.Task.Right.cs deleted file mode 100644 index 03d25d89..00000000 --- a/CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.Task.Right.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.ComponentModel; -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions -{ - public static partial class ResultExtensions - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Task> OnFailure(this Result result, Func func) - => result.TapError(func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Task> OnFailure(this Result result, Func func) - => result.TapError(func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Task OnFailure(this Result result, Func func) - => result.TapError(func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Task OnFailure(this Result result, Func func) - => result.TapError(func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Task> OnFailure(this UnitResult result, Func func) - => result.TapError(func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Task> OnFailure(this UnitResult result, Func func) - => result.TapError(func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Task> OnFailure(this Result result, Func func) - => result.TapError(func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Task> OnFailure(this Result result, Func func) - => result.TapError(func); - } -} diff --git a/CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.Task.cs b/CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.Task.cs deleted file mode 100644 index a7e5f85e..00000000 --- a/CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.Task.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.ComponentModel; -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions -{ - public static partial class ResultExtensions - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Task> OnFailure(this Task> resultTask, Func func) - => resultTask.TapError(func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Task> OnFailure(this Task> resultTask, Func func) - => resultTask.TapError(func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Task OnFailure(this Task resultTask, Func func) - => resultTask.TapError(func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Task OnFailure(this Task resultTask, Func func) - => resultTask.TapError(func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Task> OnFailure(this Task> resultTask, Func func) - => resultTask.TapError(func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Task> OnFailure(this Task> resultTask, Func func) - => resultTask.TapError(func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Task> OnFailure(this Task> resultTask, Func func) - => resultTask.TapError(func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Task> OnFailure(this Task> resultTask, Func func) - => resultTask.TapError(func); - } -} diff --git a/CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.ValueTask.Left.cs b/CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.ValueTask.Left.cs deleted file mode 100644 index 8556f203..00000000 --- a/CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.ValueTask.Left.cs +++ /dev/null @@ -1,51 +0,0 @@ -#if NET5_0_OR_GREATER -using System; -using System.ComponentModel; -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions.ValueTasks -{ - public static partial class ResultExtensions - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static ValueTask> OnFailure(this ValueTask> resultTask, Action action) - => resultTask.TapError(action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static ValueTask OnFailure(this ValueTask resultTask, Action action) - => resultTask.TapError(action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static ValueTask> OnFailure(this ValueTask> resultTask, Action action) - => resultTask.TapError(action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static ValueTask> OnFailure(this ValueTask> resultTask, Action action) - => resultTask.TapError(action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static ValueTask> OnFailure(this ValueTask> resultTask, Action action) - => resultTask.TapError(action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static ValueTask> OnFailure(this ValueTask> resultTask, Action action) - => resultTask.TapError(action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static ValueTask> OnFailure(this ValueTask> resultTask, Action action) - => resultTask.TapError(action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static ValueTask OnFailure(this ValueTask resultTask, Action action) - => resultTask.TapError(action); - } -} -#endif \ No newline at end of file diff --git a/CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.ValueTask.Right.cs b/CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.ValueTask.Right.cs deleted file mode 100644 index d609338f..00000000 --- a/CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.ValueTask.Right.cs +++ /dev/null @@ -1,51 +0,0 @@ -#if NET5_0_OR_GREATER -using System; -using System.ComponentModel; -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions.ValueTasks -{ - public static partial class ResultExtensions - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static ValueTask> OnFailure(this Result result, Func valueTask) - => result.TapError(valueTask); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static ValueTask> OnFailure(this Result result, Func valueTask) - => result.TapError(valueTask); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static ValueTask OnFailure(this Result result, Func valueTask) - => result.TapError(valueTask); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static ValueTask OnFailure(this Result result, Func valueTask) - => result.TapError(valueTask); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static ValueTask> OnFailure(this UnitResult result, Func valueTask) - => result.TapError(valueTask); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static ValueTask> OnFailure(this UnitResult result, Func valueTask) - => result.TapError(valueTask); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static ValueTask> OnFailure(this Result result, Func valueTask) - => result.TapError(valueTask); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static ValueTask> OnFailure(this Result result, Func valueTask) - => result.TapError(valueTask); - } -} -#endif \ No newline at end of file diff --git a/CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.ValueTask.cs b/CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.ValueTask.cs deleted file mode 100644 index 2014f0ed..00000000 --- a/CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.ValueTask.cs +++ /dev/null @@ -1,51 +0,0 @@ -#if NET5_0_OR_GREATER -using System; -using System.ComponentModel; -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions.ValueTasks -{ - public static partial class ResultExtensions - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static ValueTask> OnFailure(this ValueTask> resultTask, Func valueTask) - => resultTask.TapError(valueTask); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static ValueTask> OnFailure(this ValueTask> resultTask, Func valueTask) - => resultTask.TapError(valueTask); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static ValueTask OnFailure(this ValueTask resultTask, Func valueTask) - => resultTask.TapError(valueTask); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static ValueTask OnFailure(this ValueTask resultTask, Func valueTask) - => resultTask.TapError(valueTask); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static ValueTask> OnFailure(this ValueTask> resultTask, Func valueTask) - => resultTask.TapError(valueTask); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static ValueTask> OnFailure(this ValueTask> resultTask, Func valueTask) - => resultTask.TapError(valueTask); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static ValueTask> OnFailure(this ValueTask> resultTask, Func valueTask) - => resultTask.TapError(valueTask); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static ValueTask> OnFailure(this ValueTask> resultTask, Func valueTask) - => resultTask.TapError(valueTask); - } -} -#endif \ No newline at end of file diff --git a/CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.cs b/CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.cs deleted file mode 100644 index 2546be22..00000000 --- a/CSharpFunctionalExtensions/Result/Methods/Extensions/OnFailure.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using System.ComponentModel; - -namespace CSharpFunctionalExtensions -{ - public static partial class ResultExtensions - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Result OnFailure(this Result result, Action action) - => result.TapError(action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Result OnFailure(this Result result, Action action) - => result.TapError(action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Result OnFailure(this Result result, Action action) - => result.TapError(action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static UnitResult OnFailure(this UnitResult result, Action action) - => result.TapError(action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static UnitResult OnFailure(this UnitResult result, Action action) - => result.TapError(action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Result OnFailure(this Result result, Action action) - => result.TapError(action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Result OnFailure(this Result result, Action action) - => result.TapError(action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use TapError() instead.")] - public static Result OnFailure(this Result result, Action action) - => result.TapError(action); - } -} diff --git a/CSharpFunctionalExtensions/Result/Obsolete/Create.cs b/CSharpFunctionalExtensions/Result/Obsolete/Create.cs deleted file mode 100644 index 43060eea..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/Create.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.ComponentModel; -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions -{ - public partial struct Result - { - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use SuccessIf() instead.")] - public static Result Create(bool isSuccess, string error) - => SuccessIf(isSuccess, error); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use SuccessIf() instead.")] - public static Result Create(Func predicate, string error) - => SuccessIf(predicate, error); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use SuccessIf() instead.")] - public static Task Create(Func> predicate, string error) - => SuccessIf(predicate, error); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use SuccessIf() instead.")] - public static Result Create(bool isSuccess, T value, string error) - => SuccessIf(isSuccess, value, error); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use SuccessIf() instead.")] - public static Result Create(Func predicate, T value, string error) - => SuccessIf(predicate, value, error); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use SuccessIf() instead.")] - public static Task> Create(Func> predicate, T value, string error) - => SuccessIf(predicate, value, error); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use SuccessIf() instead.")] - public static Result Create(bool isSuccess, T value, E error) - => SuccessIf(isSuccess, value, error); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use SuccessIf() instead.")] - public static Result Create(Func predicate, T value, E error) - => SuccessIf(predicate, value, error); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use SuccessIf() instead.")] - public static Task> Create(Func> predicate, T value, E error) - => SuccessIf(predicate, value, error); - } -} diff --git a/CSharpFunctionalExtensions/Result/Obsolete/CreateFailure.cs b/CSharpFunctionalExtensions/Result/Obsolete/CreateFailure.cs deleted file mode 100644 index 9134fb73..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/CreateFailure.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.ComponentModel; -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions -{ - public partial struct Result - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use FailureIf() instead.")] - public static Result CreateFailure(bool isFailure, string error) - => FailureIf(isFailure, error); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use FailureIf() instead.")] - public static Result CreateFailure(Func failurePredicate, string error) - => FailureIf(failurePredicate, error); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use FailureIf() instead.")] - public static Task CreateFailure(Func> failurePredicate, string error) - => FailureIf(failurePredicate, error); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use FailureIf() instead.")] - public static Result CreateFailure(bool isFailure, T value, string error) - => FailureIf(isFailure, value, error); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use FailureIf() instead.")] - public static Result CreateFailure(Func failurePredicate, T value, string error) - => FailureIf(failurePredicate, value, error); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use FailureIf() instead.")] - public static Task> CreateFailure(Func> failurePredicate, T value, string error) - => FailureIf(failurePredicate, value, error); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use FailureIf() instead.")] - public static Result CreateFailure(bool isFailure, T value, E error) - => FailureIf(isFailure, value, error); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use FailureIf() instead.")] - public static Result CreateFailure(Func failurePredicate, T value, E error) - => FailureIf(failurePredicate, value, error); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use FailureIf() instead.")] - public static Task> CreateFailure(Func> failurePredicate, T value, E error) - => FailureIf(failurePredicate, value, error); - } -} diff --git a/CSharpFunctionalExtensions/Result/Obsolete/Fail.cs b/CSharpFunctionalExtensions/Result/Obsolete/Fail.cs deleted file mode 100644 index 1d38b75b..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/Fail.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.ComponentModel; - -namespace CSharpFunctionalExtensions -{ - public partial struct Result - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Failure() instead.")] - public static Result Fail(string error) - => Failure(error); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Failure() instead.")] - public static Result Fail(string error) - => Failure(error); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Failure() instead.")] - public static Result Fail(E error) - => Failure(error); - } -} diff --git a/CSharpFunctionalExtensions/Result/Obsolete/Ok.cs b/CSharpFunctionalExtensions/Result/Obsolete/Ok.cs deleted file mode 100644 index 12bbc3c2..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/Ok.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.ComponentModel; - -namespace CSharpFunctionalExtensions -{ - public partial struct Result - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Success() instead.")] - public static Result Ok() - => Success(); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Success() instead.")] - public static Result Ok(T value) - => Success(value); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Success() instead.")] - public static Result Ok(T value) - => Success(value); - } -} diff --git a/CSharpFunctionalExtensions/Result/Obsolete/OnBoth.cs b/CSharpFunctionalExtensions/Result/Obsolete/OnBoth.cs deleted file mode 100644 index f1d8b507..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/OnBoth.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.ComponentModel; - -namespace CSharpFunctionalExtensions -{ - public static partial class ResultExtensions - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Finally() instead.")] - public static T OnBoth(this Result result, Func func) - => Finally(result, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Finally() instead.")] - public static K OnBoth(this Result result, Func, K> func) - => Finally(result, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Finally() instead.")] - public static K OnBoth(this Result result, Func, K> func) - => Finally(result, func); - } -} diff --git a/CSharpFunctionalExtensions/Result/Obsolete/OnBothAsyncBoth.cs b/CSharpFunctionalExtensions/Result/Obsolete/OnBothAsyncBoth.cs deleted file mode 100644 index 5f3f5bb3..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/OnBothAsyncBoth.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.ComponentModel; -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions -{ - public static partial class AsyncResultExtensionsBothOperands - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Finally() instead.")] - public static Task OnBoth(this Task resultTask, Func> func) - => Finally(resultTask, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Finally() instead.")] - public static Task OnBoth(this Task> resultTask, Func, Task> func) - => Finally(resultTask, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Finally() instead.")] - public static Task OnBoth(this Task> resultTask, Func, Task> func) - => Finally(resultTask, func); - } -} diff --git a/CSharpFunctionalExtensions/Result/Obsolete/OnBothAsyncLeft.cs b/CSharpFunctionalExtensions/Result/Obsolete/OnBothAsyncLeft.cs deleted file mode 100644 index d3968597..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/OnBothAsyncLeft.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.ComponentModel; -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions -{ - public static partial class AsyncResultExtensionsLeftOperand - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Finally() instead.")] - public static Task OnBoth(this Task resultTask, Func func) - => Finally(resultTask, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Finally() instead.")] - public static Task OnBoth(this Task> resultTask, Func, K> func) - => Finally(resultTask, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Finally() instead.")] - public static Task OnBoth(this Task> resultTask, Func, K> func) - => Finally(resultTask, func); - } -} diff --git a/CSharpFunctionalExtensions/Result/Obsolete/OnBothAsyncRight.cs b/CSharpFunctionalExtensions/Result/Obsolete/OnBothAsyncRight.cs deleted file mode 100644 index e37b7977..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/OnBothAsyncRight.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.ComponentModel; -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions -{ - public static partial class AsyncResultExtensionsRightOperand - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Finally() instead.")] - public static Task OnBoth(this Result result, Func> func) - => Finally(result, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Finally() instead.")] - public static Task OnBoth(this Result result, Func, Task> func) - => Finally(result, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Finally() instead.")] - public static Task OnBoth(this Result result, Func, Task> func) - => Finally(result, func); - } -} diff --git a/CSharpFunctionalExtensions/Result/Obsolete/OnSuccess.cs b/CSharpFunctionalExtensions/Result/Obsolete/OnSuccess.cs deleted file mode 100644 index 6a45378d..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/OnSuccess.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using System.ComponentModel; - -namespace CSharpFunctionalExtensions -{ - public static partial class ResultExtensions - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Map() instead.")] - public static Result OnSuccess(this Result result, Func func) - => Map(result, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Map() instead.")] - public static Result OnSuccess(this Result result, Func func) - => Map(result, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Map() instead.")] - public static Result OnSuccess(this Result result, Func func) - => Map(result, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Bind() instead.")] - public static Result OnSuccess(this Result result, Func> func) - => Bind(result, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Bind() instead.")] - public static Result OnSuccess(this Result result, Func> func) - => Bind(result, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Bind() instead.")] - public static Result OnSuccess(this Result result, Func> func) - => Bind(result, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Bind() instead.")] - public static Result OnSuccess(this Result result, Func func) - => Bind(result, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Bind() instead.")] - public static Result OnSuccess(this Result result, Func func) - => Bind(result, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Tap() instead.")] - public static Result OnSuccess(this Result result, Action action) - => Tap(result, action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Tap() instead.")] - public static Result OnSuccess(this Result result, Action action) - => Tap(result, action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Tap() instead.")] - public static Result OnSuccess(this Result result, Action action) - => Tap(result, action); - } -} diff --git a/CSharpFunctionalExtensions/Result/Obsolete/OnSuccessAsyncBoth.cs b/CSharpFunctionalExtensions/Result/Obsolete/OnSuccessAsyncBoth.cs deleted file mode 100644 index 14f11242..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/OnSuccessAsyncBoth.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using System.ComponentModel; -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions -{ - public static partial class AsyncResultExtensionsBothOperands - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Map() instead.")] - public static Task> OnSuccess(this Task> resultTask, Func> func) - => Map(resultTask, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Map() instead.")] - public static Task> OnSuccess(this Task> resultTask, Func> func) - => Map(resultTask, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Map() instead.")] - public static Task> OnSuccess(this Task resultTask, Func> func) - => Map(resultTask, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Bind() instead.")] - public static Task> OnSuccess(this Task> resultTask, Func>> func) - => Bind(resultTask, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Bind() instead.")] - public static Task> OnSuccess(this Task> resultTask, Func>> func) - => Bind(resultTask, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Bind() instead.")] - public static Task> OnSuccess(this Task resultTask, Func>> func) - => Bind(resultTask, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Bind() instead.")] - public static Task OnSuccess(this Task> resultTask, Func> func) - => Bind(resultTask, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Bind() instead.")] - public static Task OnSuccess(this Task resultTask, Func> func) - => Bind(resultTask, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Tap() instead.")] - public static Task> OnSuccess(this Task> resultTask, Func action) - => Tap(resultTask, action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Tap() instead.")] - public static Task> OnSuccess(this Task> resultTask, Func action) - => Tap(resultTask, action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Tap() instead.")] - public static Task OnSuccess(this Task resultTask, Func action) - => Tap(resultTask, action); - } -} diff --git a/CSharpFunctionalExtensions/Result/Obsolete/OnSuccessAsyncLeft.cs b/CSharpFunctionalExtensions/Result/Obsolete/OnSuccessAsyncLeft.cs deleted file mode 100644 index 26d4f557..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/OnSuccessAsyncLeft.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.ComponentModel; -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions -{ - public static partial class AsyncResultExtensionsLeftOperand - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Map() instead.")] - public static Task> OnSuccess(this Task> resultTask, Func func) - => Map(resultTask, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Map() instead.")] - public static Task> OnSuccess(this Task> resultTask, Func func) - => Map(resultTask, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Map() instead.")] - public static Task> OnSuccess(this Task resultTask, Func func) - => Map(resultTask, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Bind() instead.")] - public static Task> OnSuccess(this Task> resultTask, Func> func) - => Bind(resultTask, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Bind() instead.")] - public static Task> OnSuccess(this Task> resultTask, Func> func) - => Bind(resultTask, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Bind() instead.")] - public static Task> OnSuccess(this Task resultTask, Func> func) - => Bind(resultTask, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Bind() instead.")] - public static Task OnSuccess(this Task> resultTask, Func func) - => Bind(resultTask, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Bind() instead.")] - public static Task OnSuccess(this Task resultTask, Func func) - => Bind(resultTask, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Tap() instead.")] - public static Task> OnSuccess(this Task> resultTask, Action action) - => Tap(resultTask, action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Tap() instead.")] - public static Task OnSuccess(this Task resultTask, Action action) - => Tap(resultTask, action); - } -} diff --git a/CSharpFunctionalExtensions/Result/Obsolete/OnSuccessAsyncRight.cs b/CSharpFunctionalExtensions/Result/Obsolete/OnSuccessAsyncRight.cs deleted file mode 100644 index 76deee65..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/OnSuccessAsyncRight.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using System.ComponentModel; -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions -{ - public static partial class AsyncResultExtensionsRightOperand - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Map() instead.")] - public static Task> OnSuccess(this Result result, Func> func) - => Map(result, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Map() instead.")] - public static Task> OnSuccess(this Result result, Func> func) - => Map(result, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Map() instead.")] - public static Task> OnSuccess(this Result result, Func> func) - => Map(result, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Bind() instead.")] - public static Task> OnSuccess(this Result result, Func>> func) - => Bind(result, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Bind() instead.")] - public static Task> OnSuccess(this Result result, Func>> func) - => Bind(result, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Bind() instead.")] - public static Task> OnSuccess(this Result result, Func>> func) - => Bind(result, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Bind() instead.")] - public static Task OnSuccess(this Result result, Func> func) - => Bind(result, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Bind() instead.")] - public static Task OnSuccess(this Result result, Func> func) - => Bind(result, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Tap() instead.")] - public static Task> OnSuccess(this Result result, Func action) - => Tap(result, action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Tap() instead.")] - public static Task> OnSuccess(this Result result, Func action) - => Tap(result, action); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Tap() instead.")] - public static Task OnSuccess(this Result result, Func action) - => Tap(result, action); - } -} diff --git a/CSharpFunctionalExtensions/Result/Obsolete/OnSuccessTry.Task.Left.cs b/CSharpFunctionalExtensions/Result/Obsolete/OnSuccessTry.Task.Left.cs deleted file mode 100644 index eedb061d..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/OnSuccessTry.Task.Left.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.ComponentModel; -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions -{ - public static partial class ResultExtensions - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use MapTry() instead.")] - public static async Task> OnSuccessTry(this Task task, Func func, - Func errorHandler = null) - { - return await task.MapTry(func, errorHandler).DefaultAwait(); - } - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use MapTry() instead.")] - public static async Task> OnSuccessTry(this Task> task, Func action, - Func errorHandler = null) - { - return await task.MapTry(action, errorHandler).DefaultAwait(); - } - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use MapTry() instead.")] - public static async Task> OnSuccessTry(this Task> task, Func action, - Func errorHandler = null) - { - return await task.MapTry(action, errorHandler).DefaultAwait(); - } - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Explicitly cast to UnitResult and use MapTry() instead.")] - public static async Task> OnSuccessTry(this Task> task, Func func, - Func errorHandler = null) - { - UnitResult unitResult = await task.DefaultAwait(); - return unitResult.MapTry(func, errorHandler); - } - } -} diff --git a/CSharpFunctionalExtensions/Result/Obsolete/OnSuccessTry.Task.Right.cs b/CSharpFunctionalExtensions/Result/Obsolete/OnSuccessTry.Task.Right.cs deleted file mode 100644 index 80eb8b5d..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/OnSuccessTry.Task.Right.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.ComponentModel; -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions -{ - public static partial class ResultExtensions - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use MapTry() instead.")] - public static async Task> OnSuccessTry(this Result result, Func> func, - Func errorHandler = null) - { - return await result.MapTry(func, errorHandler).DefaultAwait(); - } - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use MapTry() instead.")] - public static async Task> OnSuccessTry(this Result result, Func> func, - Func errorHandler = null) - { - return await result.MapTry(func, errorHandler).DefaultAwait(); - } - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use MapTry() instead.")] - public static async Task> OnSuccessTry(this Result result, Func> func, - Func errorHandler = null) - { - return await result.MapTry(func, errorHandler).DefaultAwait(); - } - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Explicitly cast to UnitResult and use MapTry() instead.")] - public static async Task> OnSuccessTry(this Result result, Func> func, - Func errorHandler = null) - { - UnitResult unitResult = result; - return await unitResult.MapTry(func, errorHandler).DefaultAwait(); - } - } -} diff --git a/CSharpFunctionalExtensions/Result/Obsolete/OnSuccessTry.Task.cs b/CSharpFunctionalExtensions/Result/Obsolete/OnSuccessTry.Task.cs deleted file mode 100644 index 0bc21bc0..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/OnSuccessTry.Task.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.ComponentModel; -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions -{ - public static partial class ResultExtensions - { - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use MapTry() instead.")] - public static async Task> OnSuccessTry(this Task task, Func> func, - Func errorHandler = null) - { - return await task.MapTry(func, errorHandler).DefaultAwait(); - } - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use MapTry() instead.")] - public static async Task> OnSuccessTry(this Task> task, Func> func, - Func errorHandler = null) - { - return await task.MapTry(func, errorHandler).DefaultAwait(); - } - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use MapTry() instead.")] - public static async Task> OnSuccessTry(this Task> task, Func> func, - Func errorHandler = null) - { - return await task.MapTry(func, errorHandler).DefaultAwait(); - } - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Explicitly cast to UnitResult and use MapTry() instead.")] - public static async Task> OnSuccessTry(this Task> task, Func> func, - Func errorHandler = null) - { - UnitResult unitResult = await task.DefaultAwait(); - return await unitResult.MapTry(func, errorHandler).DefaultAwait(); - } - } -} diff --git a/CSharpFunctionalExtensions/Result/Obsolete/OnSuccessTry.cs b/CSharpFunctionalExtensions/Result/Obsolete/OnSuccessTry.cs deleted file mode 100644 index a5d6aac0..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/OnSuccessTry.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.ComponentModel; - -namespace CSharpFunctionalExtensions -{ - public static partial class ResultExtensions - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use MapTry() instead.")] - public static Result OnSuccessTry(this Result result, Func func, Func errorHandler = null) - { - return result.MapTry(func, errorHandler); - } - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use MapTry() instead.")] - public static Result OnSuccessTry(this Result result, Func func, Func errorHandler = null) - { - return result.MapTry(func, errorHandler); - } - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use MapTry() instead.")] - public static Result OnSuccessTry(this Result result, Func func, Func errorHandler) - { - return result.MapTry(func, errorHandler); - } - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Explicitly cast to UnitResult and use MapTry() instead.")] - public static Result OnSuccessTry(this Result result, Func func, Func errorHandler) - { - UnitResult unitResult = result; - return unitResult.MapTry(func, errorHandler); - } - } -} diff --git a/CSharpFunctionalExtensions/Result/Obsolete/OnSuccessWithTransactionScope.cs b/CSharpFunctionalExtensions/Result/Obsolete/OnSuccessWithTransactionScope.cs deleted file mode 100644 index 5f7ae972..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/OnSuccessWithTransactionScope.cs +++ /dev/null @@ -1,138 +0,0 @@ -#if NETSTANDARD2_0 || NET5_0_OR_GREATER -using System; -using System.ComponentModel; -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions -{ - public static partial class ResultExtensions - { - // Non-async extensions - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use MapWithTransactionScope() instead.")] - public static Result OnSuccessWithTransactionScope(this Result self, Func f) - => self.MapWithTransactionScope(f); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use MapWithTransactionScope() instead.")] - public static Result OnSuccessWithTransactionScope(this Result self, Func f) - => self.MapWithTransactionScope(f); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use BindWithTransactionScope() instead.")] - public static Result OnSuccessWithTransactionScope(this Result self, Func> f) - => self.BindWithTransactionScope(f); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use BindWithTransactionScope() instead.")] - public static Result OnSuccessWithTransactionScope(this Result self, Func> f) - => self.BindWithTransactionScope(f); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use BindWithTransactionScope() instead.")] - public static Result OnSuccessWithTransactionScope(this Result self, Func f) - => self.BindWithTransactionScope(f); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use BindWithTransactionScope() instead.")] - public static Result OnSuccessWithTransactionScope(this Result self, Func f) - => self.BindWithTransactionScope(f); - - - // Async - both operands - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use MapWithTransactionScope() instead.")] - public static Task> OnSuccessWithTransactionScope(this Task> self, Func> f) - => self.MapWithTransactionScope(f); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use MapWithTransactionScope() instead.")] - public static Task> OnSuccessWithTransactionScope(this Task self, Func> f) - => self.MapWithTransactionScope(f); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use BindWithTransactionScope() instead.")] - public static Task> OnSuccessWithTransactionScope(this Task> self, Func>> f) - => self.BindWithTransactionScope(f); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use BindWithTransactionScope() instead.")] - public static Task> OnSuccessWithTransactionScope(this Task self, Func>> f) - => self.BindWithTransactionScope(f); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use BindWithTransactionScope() instead.")] - public static Task OnSuccessWithTransactionScope(this Task> self, Func> f) - => self.BindWithTransactionScope(f); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use BindWithTransactionScope() instead.")] - public static Task OnSuccessWithTransactionScope(this Task self, Func> f) - => self.BindWithTransactionScope(f); - - - // Async - left operands - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use MapWithTransactionScope() instead.")] - public static Task> OnSuccessWithTransactionScope(this Task> self, Func f) - => self.MapWithTransactionScope(f); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use MapWithTransactionScope() instead.")] - public static Task> OnSuccessWithTransactionScope(this Task self, Func f) - => self.MapWithTransactionScope(f); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use BindWithTransactionScope() instead.")] - public static Task> OnSuccessWithTransactionScope(this Task> self, Func> f) - => self.BindWithTransactionScope(f); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use BindWithTransactionScope() instead.")] - public static Task> OnSuccessWithTransactionScope(this Task self, Func> f) - => self.BindWithTransactionScope(f); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use BindWithTransactionScope() instead.")] - public static Task OnSuccessWithTransactionScope(this Task> self, Func f) - => self.BindWithTransactionScope(f); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use BindWithTransactionScope() instead.")] - public static Task OnSuccessWithTransactionScope(this Task self, Func f) - => self.BindWithTransactionScope(f); - - - // Async - right operands - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use MapWithTransactionScope() instead.")] - public static Task> OnSuccessWithTransactionScope(this Result self, Func> f) - => self.MapWithTransactionScope(f); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use MapWithTransactionScope() instead.")] - public static Task> OnSuccessWithTransactionScope(this Result self, Func> f) - => self.MapWithTransactionScope(f); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use BindWithTransactionScope() instead.")] - public static Task> OnSuccessWithTransactionScope(this Result self, Func>> f) - => self.BindWithTransactionScope(f); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use BindWithTransactionScope() instead.")] - public static Task> OnSuccessWithTransactionScope(this Result self, Func>> f) - => self.BindWithTransactionScope(f); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use BindWithTransactionScope() instead.")] - public static Task OnSuccessWithTransactionScope(this Result self, Func> f) - => self.BindWithTransactionScope(f); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use BindWithTransactionScope() instead.")] - public static Task OnSuccessWithTransactionScope(this Result self, Func> f) - => self.BindWithTransactionScope(f); - } -} -#endif diff --git a/CSharpFunctionalExtensions/Result/Obsolete/Tap.cs b/CSharpFunctionalExtensions/Result/Obsolete/Tap.cs deleted file mode 100644 index 86022e69..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/Tap.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.ComponentModel; - -namespace CSharpFunctionalExtensions -{ - public static partial class ResultExtensions - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Check() instead.")] - public static Result Tap(this Result result, Func func) - => Check(result, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Check() instead.")] - public static Result Tap(this Result result, Func> func) - => Check(result, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Check() instead.")] - public static Result Tap(this Result result, Func> func) - => Check(result, func); - } -} \ No newline at end of file diff --git a/CSharpFunctionalExtensions/Result/Obsolete/TapAsyncBoth.cs b/CSharpFunctionalExtensions/Result/Obsolete/TapAsyncBoth.cs deleted file mode 100644 index 461a8e03..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/TapAsyncBoth.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.ComponentModel; -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions -{ - public static partial class AsyncResultExtensionsBothOperands - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Check() instead.")] - public static Task> Tap(this Task> resultTask, Func> func) => - Check(resultTask, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Check() instead.")] - public static Task> Tap(this Task> resultTask, Func>> func) => - Check(resultTask, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Check() instead.")] - public static Task> Tap(this Task> resultTask, Func>> func) => - Check(resultTask, func); - } -} diff --git a/CSharpFunctionalExtensions/Result/Obsolete/TapAsyncLeft.cs b/CSharpFunctionalExtensions/Result/Obsolete/TapAsyncLeft.cs deleted file mode 100644 index da4c304d..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/TapAsyncLeft.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.ComponentModel; -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions -{ - public static partial class AsyncResultExtensionsLeftOperand - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Check() instead.")] - public static Task> Tap(this Task> resultTask, Func func) => - Check(resultTask, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Check() instead.")] - public static Task> Tap(this Task> resultTask, Func> func) => - Check(resultTask, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Check() instead.")] - public static Task> Tap(this Task> resultTask, Func> func) => - Check(resultTask, func); - } -} diff --git a/CSharpFunctionalExtensions/Result/Obsolete/TapAsyncRight.cs b/CSharpFunctionalExtensions/Result/Obsolete/TapAsyncRight.cs deleted file mode 100644 index 7b06f054..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/TapAsyncRight.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.ComponentModel; -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions -{ - public static partial class AsyncResultExtensionsRightOperand - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Check() instead.")] - public static Task> Tap(this Result result, Func> func) => Check(result, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Check() instead.")] - public static Task> Tap(this Result result, Func>> func) => - Check(result, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use Check() instead.")] - public static Task> Tap(this Result result, Func>> func) => - Check(result, func); - } -} diff --git a/CSharpFunctionalExtensions/Result/Obsolete/TapIf.cs b/CSharpFunctionalExtensions/Result/Obsolete/TapIf.cs deleted file mode 100644 index d0f4acb3..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/TapIf.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.ComponentModel; - -namespace CSharpFunctionalExtensions -{ - public static partial class ResultExtensions - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CheckIf() instead.")] - public static Result TapIf(this Result result, bool condition, Func func) => - CheckIf(result, condition, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CheckIf() instead.")] - public static Result TapIf(this Result result, bool condition, Func> func) => - CheckIf(result, condition, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CheckIf() instead.")] - public static Result TapIf(this Result result, bool condition, Func> func) => - CheckIf(result, condition, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CheckIf() instead.")] - public static Result TapIf(this Result result, Func predicate, Func func) => - CheckIf(result, predicate, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CheckIf() instead.")] - public static Result TapIf(this Result result, Func predicate, Func> func) => - CheckIf(result, predicate, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CheckIf() instead.")] - public static Result TapIf(this Result result, Func predicate, Func> func) => - CheckIf(result, predicate, func); - } -} \ No newline at end of file diff --git a/CSharpFunctionalExtensions/Result/Obsolete/TapIfAsyncBoth.cs b/CSharpFunctionalExtensions/Result/Obsolete/TapIfAsyncBoth.cs deleted file mode 100644 index b71852b5..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/TapIfAsyncBoth.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.ComponentModel; -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions -{ - public static partial class AsyncResultExtensionsBothOperands - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CheckIf() instead.")] - public static Task> TapIf(this Task> resultTask, bool condition, Func> func) => - CheckIf(resultTask, condition, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CheckIf() instead.")] - public static Task> TapIf(this Task> resultTask, bool condition, Func>> func) => - CheckIf(resultTask, condition, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CheckIf() instead.")] - public static Task> TapIf(this Task> resultTask, bool condition, Func>> func) => - CheckIf(resultTask, condition, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CheckIf() instead.")] - public static Task> TapIf(this Task> resultTask, Func predicate, Func> func) => - CheckIf(resultTask, predicate, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CheckIf() instead.")] - public static Task> TapIf(this Task> resultTask, Func predicate, Func>> func) => - CheckIf(resultTask, predicate, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CheckIf() instead.")] - public static Task> TapIf(this Task> resultTask, Func predicate, Func>> func) => - CheckIf(resultTask, predicate, func); - } -} diff --git a/CSharpFunctionalExtensions/Result/Obsolete/TapIfAsyncLeft.cs b/CSharpFunctionalExtensions/Result/Obsolete/TapIfAsyncLeft.cs deleted file mode 100644 index 6ceb41d1..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/TapIfAsyncLeft.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.ComponentModel; -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions -{ - public static partial class AsyncResultExtensionsLeftOperand - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CheckIf() instead.")] - public static Task> TapIf(this Task> resultTask, bool condition, Func func) => - CheckIf(resultTask, condition, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CheckIf() instead.")] - public static Task> TapIf(this Task> resultTask, bool condition, Func> func) => - CheckIf(resultTask, condition, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CheckIf() instead.")] - public static Task> TapIf(this Task> resultTask, bool condition, Func> func) => - CheckIf(resultTask, condition, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CheckIf() instead.")] - public static Task> TapIf(this Task> resultTask, Func predicate, Func func) => - CheckIf(resultTask, predicate, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CheckIf() instead.")] - public static Task> TapIf(this Task> resultTask, Func predicate, Func> func) => - CheckIf(resultTask, predicate, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CheckIf() instead.")] - public static Task> TapIf(this Task> resultTask, Func predicate, Func> func) => - CheckIf(resultTask, predicate, func); - } -} diff --git a/CSharpFunctionalExtensions/Result/Obsolete/TapIfAsyncRight.cs b/CSharpFunctionalExtensions/Result/Obsolete/TapIfAsyncRight.cs deleted file mode 100644 index 09a5ec69..00000000 --- a/CSharpFunctionalExtensions/Result/Obsolete/TapIfAsyncRight.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.ComponentModel; -using System.Threading.Tasks; - -namespace CSharpFunctionalExtensions -{ - public static partial class AsyncResultExtensionsRightOperand - { - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CheckIf() instead.")] - public static Task> TapIf(this Result result, bool condition, Func> func) => - CheckIf(result, condition, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CheckIf() instead.")] - public static Task> TapIf(this Result result, bool condition, Func>> func) => - CheckIf(result, condition, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CheckIf() instead.")] - public static Task> TapIf(this Result result, bool condition, Func>> func) => - CheckIf(result, condition, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CheckIf() instead.")] - public static Task> TapIf(this Result result, Func predicate, Func> func) => - CheckIf(result, predicate, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CheckIf() instead.")] - public static Task> TapIf(this Result result, Func predicate, Func>> func) => - CheckIf(result, predicate, func); - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Use CheckIf() instead.")] - public static Task> TapIf(this Result result, Func predicate, Func>> func) => - CheckIf(result, predicate, func); - } -} diff --git a/Common.Build.props b/Common.Build.props index fb3e81c0..79239bc7 100644 --- a/Common.Build.props +++ b/Common.Build.props @@ -1,6 +1,6 @@ - net40;net45;net461;netstandard2.0;net5.0;net6.0 + netstandard2.0;net6.0;net8.0 Vladimir Khorikov CSharpFunctionalExtensions - functional extensions for C# false diff --git a/Dockerfile b/Dockerfile index 35f818f0..9b80f8ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:6.0 as build +FROM mcr.microsoft.com/dotnet/sdk:8.0 as build ARG Version WORKDIR /app