mirror of
https://github.com/bitwarden/server.git
synced 2025-04-05 05:00:19 -05:00
Fixed some changes.
This commit is contained in:
parent
e4aa740a28
commit
d8264a9085
@ -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 FailedToInviteUsers = "Failed to invite user(s).";
|
||||
public const string NoUsersToInvite = "No users to invite.";
|
||||
|
||||
public async Task<CommandResult<ScimInviteOrganizationUsersResponse>> InviteScimOrganizationUserAsync(OrganizationUserSingleEmailInvite request)
|
||||
{
|
||||
@ -78,7 +79,7 @@ public class InviteOrganizationUsersCommand(IEventService eventService,
|
||||
|
||||
if (invitesToSend.Length == 0)
|
||||
{
|
||||
return new Success<IEnumerable<OrganizationUser>>([]);
|
||||
return new Failure<IEnumerable<OrganizationUser>>(NoUsersToInvite);
|
||||
}
|
||||
|
||||
var validationResult = await inviteUsersValidation.ValidateAsync(new InviteUserOrganizationValidationRequest
|
||||
|
@ -37,7 +37,7 @@ public class Success<T>(T value) : 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);
|
||||
|
||||
|
@ -58,7 +58,8 @@ public class InviteOrganizationUserCommandTests
|
||||
var result = await sutProvider.Sut.InviteScimOrganizationUserAsync(request);
|
||||
|
||||
// Assert
|
||||
Assert.IsType<Success<ScimInviteOrganizationUsersResponse>>(result);
|
||||
Assert.IsType<Failure<ScimInviteOrganizationUsersResponse>>(result);
|
||||
Assert.Equal(InviteOrganizationUsersCommand.NoUsersToInvite, (result as Failure<ScimInviteOrganizationUsersResponse>).ErrorMessage);
|
||||
|
||||
await sutProvider.GetDependency<IPaymentService>()
|
||||
.DidNotReceiveWithAnyArgs()
|
||||
|
Loading…
x
Reference in New Issue
Block a user