private void ClickLogInOKButton(object sender, EventArgs e) { _userId = _userIdTextBox.Text; _userPwd = _userPwdTextBox.Text; if (_userId != "" && _userId != null && _userPwd != "" && _userPwd != null) { try { if (_pmodel.LogIn(_userId, _userPwd).Equals("Wrong")) { MessageBox.Show(this, "使用者Id或密碼輸入錯誤!!", "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (_pmodel.LogIn(_userId, _userPwd).Equals("None")) { MessageBox.Show(this, "查無此使用者Id!!", "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MessageBox.Show(this, "登入成功!!", "成功", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); _success = true; } } catch (Exception ex) { Console.WriteLine(ex); } } else { MessageBox.Show(this, "使用者Id或密碼不得為空!!", "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public void CheckSuccessOrNotTest() { presentationModel _pmodel = new presentationModel(new Model(), new Course_Model(), new Professor_Model()); string _userId = "101590320"; string _userPwd = "0000"; String _success; _success = _pmodel.LogIn(_userId, _userPwd); Assert.AreEqual(_success, "Success"); }