public void CreateUser(string username, string password, string firstName, string lastName) { var user = new User(username, password, firstName, lastName); if (UserRepository.IsUserAvailable(username)) throw new Exception("Account unavailable"); if (!AuthenticationService.IsPasswordValid(user)) throw new Exception("Account password is not valid"); UserRepository.Save(user); }
public void Save(User user) { throw new NotImplementedException(); }
public bool IsPasswordValid(User user) { return user.Password.Length > 5; }