예제 #1
0
 public Validator(IProvideDateTime dateProvider)
 {
     RuleFor(t => t.CardNumber).Custom((s, context) =>
     {
         var val = CardNumber.Validate(s);
         PopulateContextFailuresFromValidationResult(val, context);
     });
     RuleFor(t => t.Ccv).Custom((s, context) =>
     {
         var val = Ccv.Validate(s);
         PopulateContextFailuresFromValidationResult(val, context);
     });
     RuleFor(command => command.ExpiryDate).Custom((s, context) =>
     {
         var val = ExpiryDate.Validate(s.Month, s.Year, dateProvider);
         PopulateContextFailuresFromValidationResult(val, context);
     });
     RuleFor(command => command.Money).Custom((s, context) =>
     {
         var val = Money.Validate(s.Amount, s.Currency);
         PopulateContextFailuresFromValidationResult(val, context);
     });
 }