mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
InvitesRepositoryTests
+ other reworks
This commit is contained in:
@@ -4,6 +4,7 @@ namespace Govor.Core.Infrastructure.Validators;
|
||||
|
||||
public class InvitationValidator : IObjectValidator<Invitation>
|
||||
{
|
||||
public const int MIN_INVITATION_LENGTH = 10;
|
||||
public void Validate(Invitation inv)
|
||||
{
|
||||
try
|
||||
@@ -18,6 +19,8 @@ public class InvitationValidator : IObjectValidator<Invitation>
|
||||
throw new ArgumentException("EndDate cannot be less than StartDate", nameof(inv.EndDate));
|
||||
if(inv.MaxParticipants <= 0)
|
||||
throw new ArgumentException("MaxParticipants cannot be less than 0", nameof(inv.MaxParticipants));
|
||||
if(inv.Code == string.Empty || inv.Code.Length < MIN_INVITATION_LENGTH)
|
||||
throw new ArgumentException($"Code cannot be empty or less then {MIN_INVITATION_LENGTH}", nameof(inv.Code));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user