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()); }
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); }
private IEnumerable<string> Validate(User user, IDomainEntityValidator<User> validator) { return validator.Validate(user); }
private string GenerateActivationLink(User user) { return string.Format("http://omoney.com.ua/activate/{0}", user.Email); }
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))}; }
public void Update(User user) { throw new System.NotImplementedException(); }
public void Activate(User user) { throw new NotImplementedException(); }