Пример #1
0
 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);
     }
 }
Пример #2
0
 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);
     }
 }
Пример #3
0
 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);
     }
 }
Пример #4
0
 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);
     }
 }
Пример #5
0
 public void areNewPassAndRepeatedSameThrowsException()
 {
     Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.areNewPassAndRepeatedSame("131", "3232231"));
 }
Пример #6
0
 public void isAgeValidThrowsException()
 {
     Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.isAgeValid(-1));
 }
Пример #7
0
 public void isGenderValidThrowsException()
 {
     Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.isGenderValid("zzzz"));
 }
Пример #8
0
 public void isEMailTakenThrowsException()
 {
     Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.isEMailTaken(emails, "*****@*****.**"));
 }
Пример #9
0
 public void isEMailCorrectMailIsCorrect()
 {
     Assert.DoesNotThrow(() => ValidateProfile.isEMailCorrect("*****@*****.**"));
 }
Пример #10
0
 public void arePasswordsSameThrowsException()
 {
     Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.arePasswordsSame("S4i4VgIP4Wg0Gn19QAEeo2jSgF6Aj2NQfiJN+KwcKGFcW7zj", "123"));
 }
Пример #11
0
 public void isMovieSelectedThrowsException()
 {
     Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.isMovieSelected(0));
 }
Пример #12
0
 public void isProfilePictureOKThrowsException()
 {
     Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.isProfilePictureOK(new byte[0]));
 }
Пример #13
0
 public void isLastNameCorrectThrowsException()
 {
     Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.isLastNameCorrect("asd1"));
 }
Пример #14
0
 public void isEMailCorrectThrowsException()
 {
     Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.isEMailCorrect("1234"));
 }
Пример #15
0
 public void isUserValidThrowsException()
 {
     Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.isUserNameValid("Pesho!"));
 }
Пример #16
0
 public void isUserNameTakenThrowsException()
 {
     Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.isUserNameTaken(usernames, "Pesho"));
 }