public void IsUserExistTest() { string username = "******"; string password = "******"; bool actual = true; bool predicted = aUserBusinessLogic.IsUserExist(username, password); Assert.AreEqual(actual, predicted); }
protected void logInButton_Click(object sender, EventArgs e) { string userName = userNameTextBox.Text; string password = passwordTextBox.Text; bool isUserNameExist = aUserBusinessLogic.IsUserExist(userName, password); string userType = aUserBusinessLogic.CheackRole(userName, password); if (isUserNameExist) { if (rememberCheckBox.Checked) { Response.Cookies["UserName"].Value = userNameTextBox.Text; Response.Cookies["Password"].Value = passwordTextBox.Text; Response.Cookies["UserName"].Expires = DateTime.Now.AddDays(15); Response.Cookies["Password"].Expires = DateTime.Now.AddDays(15); } else { Response.Cookies["UserName"].Expires = DateTime.Now.AddDays(-1); Response.Cookies["Password"].Expires = DateTime.Now.AddDays(-1); } if (userType == "U") { Session["UserName"] = userNameTextBox.Text; Response.Redirect("UserHome.aspx"); } if (userType == "A") { Session["UserName"] = userNameTextBox.Text; Response.Redirect("Admin.aspx"); } } else { lblError.Text = "Invalid User Name or Password"; } }