private void buttonChangeEmail_Click(object sender, EventArgs e) { try { ValidateProfile.isEMailCorrect(textBoxEmailChanged.Text); _imov4EProfileSettingsPresenter.ChangeEmail(textBoxEmailChanged.Text); if (_profileScreen.Email.Equals(textBoxEmailChanged.Text)) { _profileScreen.UpdateEmail(); textBoxEmailChanged.Text = null; MessageBox.Show("You have successfully changed your E-mail!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void isEMailCorrectMailIsCorrect() { Assert.DoesNotThrow(() => ValidateProfile.isEMailCorrect("*****@*****.**")); }
public void isEMailCorrectThrowsException() { Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.isEMailCorrect("1234")); }