public void TestAddUsers() { SignupBLL bll = new SignupBLL(); bool actualResult, expectedResult; bll._fName = "admin"; bll._lName = "admin"; bll._password = "******"; bll._username = "******"; expectedResult = true; actualResult = bll.InsertUsers(); Assert.AreEqual(actualResult, expectedResult); }
private void btnAdd_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtFirstName.Text)) { lblError.Text = "Enter First Name."; return; } DataTable dt = bll.RetriveUsers(); //passing values to BLL through setters bll._fName = txtFirstName.Text; bll._lName = txtLastName.Text; bll._username = txtUsername.Text; if (txtPassword.Text == txtConfirmPassword.Text)//conforming password { bll._password = txtPassword.Text; } else { lblError.Text = "Passwords aren't matching.Please Check!!!!"; return; } //to insert and update according to texts in btnAdd if (btnAdd.Text == "Add") { for (int i = 0; i < dt.Rows.Count; i++) { if (txtUsername.Text == dt.Rows[i][1].ToString()) { lblError.Text = "****Username Already Taken!!! Choose Another One!!****"; return; } } bll.InsertUsers();//method in BLL that insert users } else if (btnAdd.Text == "Update") { bll.UpdateUsers();//method in BLL that updates users } LoadDataGrid(); Clear(); }