From b9bc4e968cf8e3e45479d0b9a61dc78b860c748f Mon Sep 17 00:00:00 2001 From: Jimmy Vo Date: Mon, 7 Apr 2025 10:22:09 -0400 Subject: [PATCH] [PM-15621] Clean up --- src/Core/Validators/CommandResultValidator.cs | 36 ------------------- .../Utilities/CommandResultExtensionTests.cs | 8 ++--- 2 files changed, 4 insertions(+), 40 deletions(-) delete mode 100644 src/Core/Validators/CommandResultValidator.cs diff --git a/src/Core/Validators/CommandResultValidator.cs b/src/Core/Validators/CommandResultValidator.cs deleted file mode 100644 index e670058b01..0000000000 --- a/src/Core/Validators/CommandResultValidator.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Bit.Core.Models.Commands; - -namespace Bit.Core.Validators; - -public static class CommandResultValidator -{ - public static CommandResult ExecuteValidators(Func[] validators) - { - foreach (var validator in validators) - { - var result = validator(); - - if (result is not Success) - { - return result; - } - } - - return new Success(); - } - - public static async Task ExecuteValidatorAsync(Func>[] validators) - { - foreach (var validator in validators) - { - var result = await validator(); - - if (result is not Success) - { - return result; - } - } - - return new Success(); - } -} diff --git a/test/Api.Test/Utilities/CommandResultExtensionTests.cs b/test/Api.Test/Utilities/CommandResultExtensionTests.cs index 2c35501616..dac3bf574d 100644 --- a/test/Api.Test/Utilities/CommandResultExtensionTests.cs +++ b/test/Api.Test/Utilities/CommandResultExtensionTests.cs @@ -38,7 +38,7 @@ public class CommandResultExtensionTests [Theory] [MemberData(nameof(WithGenericTypeTestCases))] - public void MapToActionResult_WithGenericType_ShouldMapToHttpResponse(CommandResult input, ObjectResult expected) + public void MapToActionResultWithErrorMessages_WithGenericType_ShouldMapToHttpResponse(CommandResult input, ObjectResult expected) { var result = input.MapToActionResultWithErrorMessages(); @@ -47,7 +47,7 @@ public class CommandResultExtensionTests [Fact] - public void MapToActionResult_WithGenericType_ShouldThrowExceptionForUnhandledCommandResult() + public void MapToActionResultWithErrorMessages_WithGenericType_ShouldThrowExceptionForUnhandledCommandResult() { var result = new NotImplementedCommandResult(); @@ -80,7 +80,7 @@ public class CommandResultExtensionTests [Theory] [MemberData(nameof(TestCases))] - public void MapToActionResult_ShouldMapToHttpResponse(CommandResult input, ObjectResult expected) + public void MapToActionResultWithErrorMessages_ShouldMapToHttpResponse(CommandResult input, ObjectResult expected) { var result = input.MapToActionResult(); @@ -88,7 +88,7 @@ public class CommandResultExtensionTests } [Fact] - public void MapToActionResult_ShouldThrowExceptionForUnhandledCommandResult() + public void MapToActionResultWithErrorMessages_ShouldThrowExceptionForUnhandledCommandResult() { var result = new NotImplementedCommandResult();