private void buttonChangeUsername_Click(object sender, EventArgs e) { try { ValidateProfile.isUserNameValid(textBoxUsernameChanged.Text); _imov4EProfileSettingsPresenter.ChangeUserName(textBoxUsernameChanged.Text); if (_profileScreen.UserName.Equals(textBoxUsernameChanged.Text)) { _profileScreen.UpdateUserName(); textBoxUsernameChanged.Text = null; MessageBox.Show("You have successfully changed your username", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Invalid input", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void isUserValidThrowsException() { Assert.Throws <IncorrectUserDataException>(() => ValidateProfile.isUserNameValid("Pesho!")); }