private void buttonChangeFName_Click(object sender, EventArgs e) { try { ValidateProfile.isFirstNameCorrect(textBoxFNameChanged.Text); _imov4EProfileSettingsPresenter.ChangeFirstName(textBoxFNameChanged.Text); if (_profileScreen.FirstName.Equals(textBoxFNameChanged.Text)) { _profileScreen.UpdateFirstNmae(); textBoxFNameChanged.Text = null; MessageBox.Show("You have successfully changed your firstname!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void isFirstNameCorrectThrowsException() { Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.isFirstNameCorrect("asd1")); }