public void AndPasswordIsEmpty()
        {
            // Arrange
            var user = new User { Email = "*****@*****.**", Password = string.Empty, ConfirmPassword = "******" };

            // Action
            var result = CreateNewUserValidator.Validate(user);

            // Arrange
            StringAssert.IsMatch("Password is EMPTY.", result.First());
        }
        public void AndPasswordAndConfirmPasswordDoesNotMatch()
        {
            // Arrange
            var user = new User { Email = "*****@*****.**", Password = "******", ConfirmPassword = "******" };

            // Action
            var result = CreateNewUserValidator.Validate(user);

            // Arrange
            StringAssert.IsMatch("Password and Confirm Password does not match.", result.First());
        }
Exemple #3
0
        public void Create(User user)
        {
            using (var transaction = new TransactionScope())
            {
                var validationErrors = Validate(user, new CreateNewUserValidator()).ToList();
                if (validationErrors.Any()) throw new DomainEntityValidationException { ValidationErrors = validationErrors };

                _userRepository.Create(user);
                _notificationService.SendEmail(BuildNewUserNotificationMessage(user));

                transaction.Complete();
            }
        }
        public void AndUserIsValid()
        {
            // Arrange
            var user = new User {Email = "*****@*****.**", Password = "******", ConfirmPassword = "******"};

            // Action
            var result = CreateNewUserValidator.Validate(user);

            // Assert
            Assert.IsEmpty(result);
        }
Exemple #5
0
 private IEnumerable<string> Validate(User user, IDomainEntityValidator<User> validator)
 {
     return validator.Validate(user);
 }
Exemple #6
0
 private string GenerateActivationLink(User user)
 {
     return string.Format("http://omoney.com.ua/activate/{0}", user.Email);
 }
Exemple #7
0
 private EmailNotificationMessage BuildNewUserNotificationMessage(User user)
 {
     return new EmailNotificationMessage {Subject = "Wellcome to OMoney!", Body = string.Format("Please follow this link: <a href='{0}'>link</a>", GenerateActivationLink(user))};
 }
Exemple #8
0
 public void Update(User user)
 {
     throw new System.NotImplementedException();
 }
Exemple #9
0
 public void Activate(User user)
 {
     throw new NotImplementedException();
 }