public void VerificationScopeIsInvalid() { var user = new User("*****@*****.**", "andrebaltieri", "123456"); var verificationCode = "123456"; Assert.AreEqual(false, user.VerificationScopeIsValid(verificationCode)); }
public OnUserRegisteredEvent(User user) { Date = DateTime.Now; User = user; EmailTitle = EmailTemplates.WelcomeEmailTitle; EmailBody = EmailTemplates.WelcomeEmailBody; }
public User Register(RegisterUserCommand command) { // Cria a instâcia do usuário var user = new User(command.Email, command.Username, command.Password); // Tenta registrar o usuário user.Register(); // Chama o commit if(Commit()) { // Dispara o evento de usuário registrado DomainEvent.Raise(new OnUserRegisteredEvent(user)); // Retorna o usuário return user; } // Se não comitou, retorna nulo return null; }
public void Update(User user) { _context.Entry<User>(user).State = System.Data.Entity.EntityState.Modified; }
public void Save(User user) { _context.Users.Add(user); }
public void RegisterScopeIsInvalidWhenUsernameIsNull() { var user = new User("*****@*****.**", "", "123456"); Assert.AreEqual(false, user.RegisterScopeIsValid()); }
public void RegisterScopeIsValid() { var user = new User("*****@*****.**", "andrebaltieri", "123456"); Assert.AreEqual(true, user.RegisterScopeIsValid()); }