public void OkCommand_CanExecute_WithPassword_IsTrue() { var viewModel = new PasswordViewModel(new PasswordWindowTranslation()); viewModel.SetInteraction(new PasswordInteraction(PasswordMiddleButton.Remove, "", "") { Password = "******" }); Assert.IsTrue(viewModel.OkCommand.CanExecute(null)); }
public void FtpPassword_OnSet_WritesToInteractionAndCallCanExecuteChanged() { var interacton = new PasswordInteraction(PasswordMiddleButton.Skip, "", ""); var viewModel = new PasswordViewModel(new PasswordWindowTranslation()); viewModel.SetInteraction(interacton); var canExecuteChanged = false; viewModel.OkCommand.CanExecuteChanged += (sender, args) => canExecuteChanged = true; viewModel.Password = "******"; Assert.AreEqual("MyPassword", interacton.Password); Assert.IsTrue(canExecuteChanged); }
public void OnInteractionSet_SetsPasswordsInView() { var viewModel = new PasswordViewModel(new PasswordWindowTranslation()); var canExecuteChanged = false; viewModel.OkCommand.CanExecuteChanged += (sender, args) => canExecuteChanged = true; var interaction = new PasswordInteraction(PasswordMiddleButton.Skip, "", "") { Password = "******" }; var actionWasCalled = false; viewModel.SetPasswordAction = x => actionWasCalled = true; viewModel.SetInteraction(interaction); Assert.IsTrue(actionWasCalled); Assert.IsTrue(canExecuteChanged); }