public void CreateNewUserTest2() { RentItClient target = new RentItClient(); Account newAccount = new Account { UserName = "******", FullName = "Test Testesen", Email = "*****@*****.**", HashedPassword = "******" }; target.CreateNewUser(newAccount); }
public void CreateNewUserTest() { RentItClient target = new RentItClient(); Account newAccount = new Account { UserName = "******", FullName = "Unit Testesen1", Email = "*****@*****.**", HashedPassword = "******" }; bool expected = true; bool actual; actual = target.CreateNewUser(newAccount); Assert.AreEqual(expected, actual); CleanupCreateUser(newAccount.UserName); }
/// <summary> /// registration button click handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnRegister_Click(object sender, EventArgs e) { if (ValidateAll()) { SHA1 sha1 = SHA1.Create(); string hash = GetSHA1Hash(sha1, txtPassword.Text); RentIt.Account acct = new RentIt.Account { UserName = txtUserName.Text, FullName = txtFullName.Text, Email = txtEmail.Text, HashedPassword = hash }; try { this.RentItProxy.CreateNewUser(acct); MessageBox.Show("User " + acct.UserName + " successfully created. Please log in."); txtUserName.Clear(); txtEmail.Clear(); txtFullName.Clear(); txtPassword.Clear(); txtPasswordConfirm.Clear(); // focus login loginUserNameTextBox.Text = acct.UserName; loginPasswordTextBox.Clear(); loginPasswordTextBox.Select(); } catch { MessageBox.Show("Something went wrong :( Please try again."); } } }
public void DeleteAccountTest() { var db = new RentItTestDatabase.RentItDatabaseDataContext(); RentItClient target = new RentItClient(); Account delAccount = new Account { UserName = "******", FullName = "Unit Testesen1", Email = "*****@*****.**", HashedPassword = "******" }; target.CreateNewUser(delAccount); AccountCredentials credentials = new AccountCredentials { UserName = "******", HashedPassword = "******" }; bool expected = true; bool actual; actual = target.DeleteAccount(credentials); Assert.AreEqual(expected, actual); CleanupCreateUser(credentials.UserName); }
private void SetFields() { Cursor.Current = Cursors.WaitCursor; try { // get account RentIt.Account acct = RentItProxy.ValidateCredentials(Credentials); this.account = acct; txtUserName.Text = acct.UserName; txtFullName.Text = acct.FullName; txtEmail.Text = acct.Email; } catch { txtUserName.Text = "Unable to retrieve account"; } Cursor.Current = Cursors.Default; }