1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-05 11:42:22 -05:00

[PM-15621] Clean up

This commit is contained in:
Jimmy Vo 2025-04-07 10:22:09 -04:00
parent 8762fe10b3
commit b9bc4e968c
No known key found for this signature in database
GPG Key ID: 7CB834D6F4FFCA11
2 changed files with 4 additions and 40 deletions

View File

@ -1,36 +0,0 @@
using Bit.Core.Models.Commands;
namespace Bit.Core.Validators;
public static class CommandResultValidator
{
public static CommandResult ExecuteValidators(Func<CommandResult>[] validators)
{
foreach (var validator in validators)
{
var result = validator();
if (result is not Success)
{
return result;
}
}
return new Success();
}
public static async Task<CommandResult> ExecuteValidatorAsync(Func<Task<CommandResult>>[] validators)
{
foreach (var validator in validators)
{
var result = await validator();
if (result is not Success)
{
return result;
}
}
return new Success();
}
}

View File

@ -38,7 +38,7 @@ public class CommandResultExtensionTests
[Theory]
[MemberData(nameof(WithGenericTypeTestCases))]
public void MapToActionResult_WithGenericType_ShouldMapToHttpResponse(CommandResult<Cipher> input, ObjectResult expected)
public void MapToActionResultWithErrorMessages_WithGenericType_ShouldMapToHttpResponse(CommandResult<Cipher> 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<Cipher>();