Esempio n. 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);
     }
 }
 public void isGenderValidThrowsException()
 {
     Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.isGenderValid("zzzz"));
 }