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

PasswordManagerInviteUserValidation to PasswordManagerInviteUserValidator

This commit is contained in:
jrmccannon 2025-03-24 12:39:03 -05:00
parent f0770eda93
commit 038c00d21f
No known key found for this signature in database
GPG Key ID: CF03F3DB01CE96A6
3 changed files with 7 additions and 7 deletions

View File

@ -38,7 +38,7 @@ public class InviteUsersValidator(
}
var subscriptionUpdate = new PasswordManagerSubscriptionUpdate(request);
var passwordManagerValidationResult = PasswordManagerInviteUserValidation.Validate(subscriptionUpdate);
var passwordManagerValidationResult = PasswordManagerInviteUserValidator.Validate(subscriptionUpdate);
if (passwordManagerValidationResult is Invalid<PasswordManagerSubscriptionUpdate> invalidSubscriptionUpdate)
{

View File

@ -2,7 +2,7 @@
namespace Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUsers.Validation.PasswordManager;
public static class PasswordManagerInviteUserValidation
public static class PasswordManagerInviteUserValidator
{
// NOTE This is only for validating adding users to an organization, not removing
public static ValidationResult<PasswordManagerSubscriptionUpdate> Validate(PasswordManagerSubscriptionUpdate subscriptionUpdate)

View File

@ -10,7 +10,7 @@ using Xunit;
namespace Bit.Core.Test.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUsers.Validation;
public class PasswordManagerInviteUserValidationTests
public class PasswordManagerInviteUserValidatorTests
{
[Theory]
[BitAutoData]
@ -22,7 +22,7 @@ public class PasswordManagerInviteUserValidationTests
var subscriptionUpdate = new PasswordManagerSubscriptionUpdate(organizationDto, 0, 0);
var result = PasswordManagerInviteUserValidation.Validate(subscriptionUpdate);
var result = PasswordManagerInviteUserValidator.Validate(subscriptionUpdate);
Assert.IsType<Valid<PasswordManagerSubscriptionUpdate>>(result);
}
@ -40,7 +40,7 @@ public class PasswordManagerInviteUserValidationTests
var subscriptionUpdate = new PasswordManagerSubscriptionUpdate(organizationDto, seatsOccupiedByUsers, additionalSeats);
var result = PasswordManagerInviteUserValidation.Validate(subscriptionUpdate);
var result = PasswordManagerInviteUserValidator.Validate(subscriptionUpdate);
Assert.IsType<Valid<PasswordManagerSubscriptionUpdate>>(result);
}
@ -59,7 +59,7 @@ public class PasswordManagerInviteUserValidationTests
var subscriptionUpdate = new PasswordManagerSubscriptionUpdate(organizationDto, seatsOccupiedByUsers, additionalSeats);
var result = PasswordManagerInviteUserValidation.Validate(subscriptionUpdate);
var result = PasswordManagerInviteUserValidator.Validate(subscriptionUpdate);
Assert.IsType<Invalid<PasswordManagerSubscriptionUpdate>>(result);
Assert.Equal(PasswordManagerSeatLimitHasBeenReachedError.Code, (result as Invalid<PasswordManagerSubscriptionUpdate>)!.ErrorMessageString);
@ -79,7 +79,7 @@ public class PasswordManagerInviteUserValidationTests
var subscriptionUpdate = new PasswordManagerSubscriptionUpdate(organizationDto, seatsOccupiedByUsers, additionalSeats);
var result = PasswordManagerInviteUserValidation.Validate(subscriptionUpdate);
var result = PasswordManagerInviteUserValidator.Validate(subscriptionUpdate);
Assert.IsType<Invalid<PasswordManagerSubscriptionUpdate>>(result);
Assert.Equal(PasswordManagerPlanDoesNotAllowAdditionalSeatsError.Code, (result as Invalid<PasswordManagerSubscriptionUpdate>)!.ErrorMessageString);