public void TestEditProfile() { TextBox testFirstNameBox = new TextBox(); TextBox testLastNameBox = new TextBox(); PasswordBox testPasswordBox = new PasswordBox(); TextBox testEmailBox = new TextBox(); TextBox testSecretPinBox = new TextBox(); testFirstNameBox.Text = "name"; testLastNameBox.Text = "surname"; testPasswordBox.Password = "******"; testEmailBox.Text = "*****@*****.**"; testSecretPinBox.Text = "1234"; Books365.BLL.User user = new Books365.BLL.User(); using (Books365.AppContext db = new Books365.AppContext()) { user.AddNewUser(testFirstNameBox, testLastNameBox, testPasswordBox, testEmailBox, testSecretPinBox); TextBox testNewFirstNameBox = new TextBox(); TextBox testNewLastNameBox = new TextBox(); user.EditProfile(testNewFirstNameBox, testNewLastNameBox, testPasswordBox, testPasswordBox, testSecretPinBox); Assert.Equal(testFirstNameBox.Text, testNewFirstNameBox.Text); Assert.Equal(testLastNameBox.Text, testNewLastNameBox.Text); db.Users.RemoveRange(db.Users.Where(u => u.Email == testEmailBox.Text)); db.EmailCurrentUser.RemoveRange(db.EmailCurrentUser.Where(u => u.Email == testEmailBox.Text)); db.SaveChanges(); } }
private void EditProfileFunc() { Books365.BLL.User u = new Books365.BLL.User(); u.EditProfile(this.FirstNameTextBox, this.LastNameTextBox, this.PasswordTextBox, this.ConfirmPasswordTextBox, this.SecretPinTextBox); }