public EnterNewUkprnViewModelValidator(IAllowedUkprnValidator ukprnWhitelistValidator)
 {
     RuleFor(x => x.Ukprn)
     .Cascade(CascadeMode.StopOnFirstFailure)
     .NotEmpty()
     .WithMessage(UkprnValidationMessages.MissingUkprn)
     .Must(x => UkprnValidator.IsValidUkprn(x, out _))
     .WithMessage(UkprnValidationMessages.InvalidUkprn)
     .MustAsync(async(ukprn, token) => await ukprnWhitelistValidator.CanUkprnStartApplication(int.Parse(ukprn)))
     .WithMessage(UkprnValidationMessages.NotWhitelistedUkprn);
 }
 public EnterNewUkprnViewModelValidator(IUkprnWhitelistValidator ukprnWhitelistValidator)
 {
     RuleFor(x => x.Ukprn)
     .Cascade(CascadeMode.StopOnFirstFailure)
     .NotEmpty().WithMessage(UkprnValidationMessages.MissingUkprn)
     .Must(x => UkprnValidator.IsValidUkprn(x, out _)).WithMessage(UkprnValidationMessages.InvalidUkprn)
     .Must(((model, s) => s.Trim() != model.CurrentUkprn))
     .WithMessage(UkprnValidationMessages.NewUkprnMustNotBeSame)
     .MustAsync(async(s,
                      token) => await ukprnWhitelistValidator.IsWhitelistedUkprn(long.Parse(s)))
     .WithMessage(UkprnValidationMessages.NotWhitelistedUkprn);
 }