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 isAgeValidThrowsException() { Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.isAgeValid(-1)); }