public bool register(ForumDB db, string account, string password, string cofirmpass) { string[] special = { "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "=", "<", ">", "/" }; for (int i = 0; i < special.Count(); i++) { if (account.Contains(special[i])) { return(false); } } if (password.Count() < 6 || password.Count() > 16) { return(false); } if (password != cofirmpass) { return(false); } if (db.insertUser(account, password)) { return(true); } else { return(false); } }
public void 插入新使用者() { ForumDB db = new ForumDB(); bool isSuccess = db.insertUser("test", "1234"); Assert.That(true, Is.EqualTo(isSuccess)); Assert.That("test", Is.EqualTo(db.accounts[1].name)); Assert.That("1234", Is.EqualTo(db.accounts[1].password)); }