protected SmsCommandValidator(ISmsDao smsDao)
 {
     _smsDao = smsDao;
     RuleFor(x => x.To).Cascade(CascadeMode.StopOnFirstFailure).NotEmpty().WithMessage("To is missing.").Length(6, 16).WithMessage("To is invalid.");
     RuleFor(x => x.From).NotEmpty().WithMessage("From is missing.").Length(6, 16).WithMessage("From is invalid.");
     RuleFor(x => x.Text).NotEmpty().WithMessage("Text is missing.");
 }
        public SmsValidator(ISmsDao smsDao)
        {
            _smsDao = smsDao;

            RuleSet("Required", () => {
                RuleFor(x => x.To).Cascade(CascadeMode.StopOnFirstFailure).NotEmpty().WithMessage("To is missing.").Length(6, 16).WithMessage("To is invalid.");
                RuleFor(x => x.From).NotEmpty().WithMessage("From is missing.").Length(6, 16).WithMessage("From is invalid.");
                RuleFor(x => x.Text).NotEmpty().WithMessage("Text is missing.");
            });

            RuleSet("InBound", () => {
                RuleFor(x => x.To).MustAsync(IsAccountNumberExists).WithName("To").WithMessage("To parameter not found.").When(x => !string.IsNullOrWhiteSpace(x.To));
            });
            RuleSet("OutBound", () => {
                RuleFor(x => x.From).MustAsync(IsAccountNumberExists).WithName("From").WithMessage("From parameter not found.").When(x => !string.IsNullOrWhiteSpace(x.From));
            });
        }
        public SmsRequestProcessor(IEventStoreDataFactory dataFactory, ISmsDao smsDao, ISmsServiceProvider smsServiceFactory)
        {
            if (dataFactory == null)
            {
                throw new ArgumentNullException("dataFactory");
            }
            if (smsDao == null)
            {
                throw new ArgumentNullException("smsDao");
            }
            if (smsServiceFactory == null)
            {
                throw new ArgumentNullException("smsServiceFactory");
            }

            this.userCred          = new EventStore.ClientAPI.SystemData.UserCredentials(dataFactory.Username, dataFactory.Password);
            this.smsDao            = smsDao;
            this.dataFactory       = dataFactory;
            this.smsServiceFactory = smsServiceFactory;
        }
Beispiel #4
0
 public OutBoundSmsCommandHandler(IValidator <OutBoundSmsCommand> validator, ISmsDao smsDao)
 {
     _validator = validator;
     _smsDao    = smsDao;
 }
 public OutBoundSmsCommandValidator(ISmsDao smsDao) : base(smsDao)
 {
     RuleFor(x => x.From).MustAsync(IsAccountNumberExists).WithName("From").WithMessage("From parameter not found.").When(x => !string.IsNullOrWhiteSpace(x.From));
 }
Beispiel #6
0
 public void Testinitialize()
 {
     _mockReadModelQuery   = new Mock <IReadModelQuery>(MockBehavior.Strict);
     _mockSmsCacheProvider = new Mock <ISmsCacheProvider>(MockBehavior.Strict);
     _smsDao = new SmsDao(_mockReadModelQuery.Object, new UserProfile("akjha"), _mockSmsCacheProvider.Object);
 }
Beispiel #7
0
 public AuthorizationMiddleware(OwinMiddleware next, ISmsDao smsDao) : base(next)
 {
     _smsDao = smsDao;
 }