예제 #1
0
        public void ChangePassword_ChangePassword_ReturnsActionName()
        {
            ChangePasswordController controller = new ChangePasswordController(true);
            RedirectToActionResult   result     = (RedirectToActionResult)controller.ChangePassword(new ChangePassword()
            {
                UserName    = "******",
                NewPassword = "******"
            });
            ViewResult result2 = (ViewResult)controller.ChangePassword(new NetCoreUserInterface.Models.ChangePassword()
            {
            });

            Assert.AreEqual("Todos", result.ActionName);
            Assert.AreEqual("ChangePassword", result2.ViewName);
        }
예제 #2
0
        // Event Handlers
        // Confirm Button Event Handler
        private void ButtonConfirm_Click(object sender, EventArgs e)
        {
            // Validate the passwords
            ChangePasswordController changePasswordController = new ChangePasswordController(_employee);

            try
            {
                changePasswordController.ValidatePassword(textBoxOldPassword.Text, textBoxNewPassword.Text, textBoxReconfrimPassword.Text);
                changePasswordController.ChangePassword();
                if (_isFirstLogin)
                {
                    changePasswordController.ActivateAccount();
                }
                _isPasswordChanged = true;
                this.Close();
            }
            catch (InvalidChangePasswordException exception)
            {
                exception.ShowErrorMessage();
            }
        }