1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-05 21:18:13 -05:00

Fixed some changes.

This commit is contained in:
jrmccannon 2025-03-07 14:43:12 -06:00
parent e4aa740a28
commit d8264a9085
No known key found for this signature in database
GPG Key ID: CF03F3DB01CE96A6
3 changed files with 5 additions and 3 deletions

View File

@ -35,6 +35,7 @@ public class InviteOrganizationUsersCommand(IEventService eventService,
public const string IssueNotifyingOwnersOfSeatLimitReached = "Error encountered notifying organization owners of seat limit reached."; public const string IssueNotifyingOwnersOfSeatLimitReached = "Error encountered notifying organization owners of seat limit reached.";
public const string FailedToInviteUsers = "Failed to invite user(s)."; public const string FailedToInviteUsers = "Failed to invite user(s).";
public const string NoUsersToInvite = "No users to invite.";
public async Task<CommandResult<ScimInviteOrganizationUsersResponse>> InviteScimOrganizationUserAsync(OrganizationUserSingleEmailInvite request) public async Task<CommandResult<ScimInviteOrganizationUsersResponse>> InviteScimOrganizationUserAsync(OrganizationUserSingleEmailInvite request)
{ {
@ -78,7 +79,7 @@ public class InviteOrganizationUsersCommand(IEventService eventService,
if (invitesToSend.Length == 0) if (invitesToSend.Length == 0)
{ {
return new Success<IEnumerable<OrganizationUser>>([]); return new Failure<IEnumerable<OrganizationUser>>(NoUsersToInvite);
} }
var validationResult = await inviteUsersValidation.ValidateAsync(new InviteUserOrganizationValidationRequest var validationResult = await inviteUsersValidation.ValidateAsync(new InviteUserOrganizationValidationRequest

View File

@ -37,7 +37,7 @@ public class Success<T>(T value) : CommandResult<T>
public class Failure<T>(IEnumerable<string> errorMessages) : CommandResult<T> public class Failure<T>(IEnumerable<string> errorMessages) : CommandResult<T>
{ {
public List<string> ErrorMessages { get; } = []; public List<string> ErrorMessages { get; } = errorMessages.ToList();
public string ErrorMessage => string.Join(" ", ErrorMessages); public string ErrorMessage => string.Join(" ", ErrorMessages);

View File

@ -58,7 +58,8 @@ public class InviteOrganizationUserCommandTests
var result = await sutProvider.Sut.InviteScimOrganizationUserAsync(request); var result = await sutProvider.Sut.InviteScimOrganizationUserAsync(request);
// Assert // Assert
Assert.IsType<Success<ScimInviteOrganizationUsersResponse>>(result); Assert.IsType<Failure<ScimInviteOrganizationUsersResponse>>(result);
Assert.Equal(InviteOrganizationUsersCommand.NoUsersToInvite, (result as Failure<ScimInviteOrganizationUsersResponse>).ErrorMessage);
await sutProvider.GetDependency<IPaymentService>() await sutProvider.GetDependency<IPaymentService>()
.DidNotReceiveWithAnyArgs() .DidNotReceiveWithAnyArgs()