private void buttonChangeGender_Click(object sender, EventArgs e) { try { if (comboBoxGenderChanged.Text == "Male") { ValidateProfile.isGenderValid(comboBoxGenderChanged.Text.First().ToString()); _imov4EProfileSettingsPresenter.ChangeGender("M"); if (_profileScreen.Gender.Equals(comboBoxGenderChanged.Text.First().ToString())) { _profileScreen.UpdateGender(); comboBoxGenderChanged.Text = null; MessageBox.Show("You have successfully changed your gender!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else if (comboBoxGenderChanged.Text == "Female") { ValidateProfile.isGenderValid(comboBoxGenderChanged.Text.First().ToString()); _imov4EProfileSettingsPresenter.ChangeGender("F"); if (_profileScreen.Gender.Equals(comboBoxGenderChanged.Text.First().ToString())) { _profileScreen.UpdateGender(); comboBoxGenderChanged.Text = null; MessageBox.Show("You have successfully changed your gender!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void buttonChangePassword_Click(object sender, EventArgs e) { try { ValidateProfile.areNewPassAndRepeatedSame(textBoxNewPassword.Text, textBoxNewPasswordRepeat.Text); ValidateProfile.isPasswordCorrect(textBoxNewPassword.Text); _imov4EProfileSettingsPresenter.ChangePassword(textBoxOldPassword.Text, textBoxNewPassword.Text, textBoxNewPasswordRepeat.Text); textBoxNewPasswordRepeat.Text = null; textBoxNewPassword.Text = null; textBoxOldPassword.Text = null; MessageBox.Show("You have successfully changed your password", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void buttonChangeLName_Click(object sender, EventArgs e) { try { ValidateProfile.isLastNameCorrect(textBoxLNameChanged.Text); _imov4EProfileSettingsPresenter.ChangeLastName(textBoxLNameChanged.Text); if (_profileScreen.LastName.Equals(textBoxLNameChanged.Text)) { _profileScreen.UpdateLastName(); textBoxLNameChanged.Text = null; MessageBox.Show("You have successfully changed your lastname!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void buttonChangeBYear_Click(object sender, EventArgs e) { try { ValidateProfile.isAgeValid(int.Parse(comboBoxBYearChanged.Text)); _imov4EProfileSettingsPresenter.ChangeAge(int.Parse(comboBoxBYearChanged.Text)); if (_profileScreen.Age.Equals(int.Parse(comboBoxBYearChanged.Text))) { _profileScreen.UpdateBirthYear(); comboBoxBYearChanged.Text = null; MessageBox.Show("You have successfully changed your birth-year", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void areNewPassAndRepeatedSameThrowsException() { Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.areNewPassAndRepeatedSame("131", "3232231")); }
public void isAgeValidThrowsException() { Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.isAgeValid(-1)); }
public void isGenderValidThrowsException() { Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.isGenderValid("zzzz")); }
public void isEMailTakenThrowsException() { Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.isEMailTaken(emails, "*****@*****.**")); }
public void isEMailCorrectMailIsCorrect() { Assert.DoesNotThrow(() => ValidateProfile.isEMailCorrect("*****@*****.**")); }
public void arePasswordsSameThrowsException() { Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.arePasswordsSame("S4i4VgIP4Wg0Gn19QAEeo2jSgF6Aj2NQfiJN+KwcKGFcW7zj", "123")); }
public void isMovieSelectedThrowsException() { Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.isMovieSelected(0)); }
public void isProfilePictureOKThrowsException() { Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.isProfilePictureOK(new byte[0])); }
public void isLastNameCorrectThrowsException() { Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.isLastNameCorrect("asd1")); }
public void isEMailCorrectThrowsException() { Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.isEMailCorrect("1234")); }
public void isUserValidThrowsException() { Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.isUserNameValid("Pesho!")); }
public void isUserNameTakenThrowsException() { Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.isUserNameTaken(usernames, "Pesho")); }