public void OkCommand_CanExecute_OwnerPasswordIsRequiredAndNotSet_IsFalse() { var viewModel = new EncryptionPasswordViewModel(new EncryptionPasswordsWindowTranslation()); viewModel.SetInteraction(new EncryptionPasswordInteraction(true, true, false)); Assert.IsFalse(viewModel.OkCommand.CanExecute(null)); }
public void OkCommand_CanExecute_IfSkipNotShown_IsTrue() { var viewModel = new EncryptionPasswordViewModel(new EncryptionPasswordsWindowTranslation()); viewModel.SetInteraction(new EncryptionPasswordInteraction(false, true, true)); Assert.IsTrue(viewModel.OkCommand.CanExecute(null)); }
public void OkCommand_CanExecute_RequiredPasswordsAreSet_IsTrue() { var viewModel = new EncryptionPasswordViewModel(new EncryptionPasswordsWindowTranslation()); viewModel.SetInteraction(new EncryptionPasswordInteraction(true, false, true)); viewModel.Interaction.UserPassword = "******"; Assert.True(viewModel.OkCommand.CanExecute(null)); }
public void OnInteractionSet_SetsPasswordsInView() { var viewModel = new EncryptionPasswordViewModel(new EncryptionPasswordsWindowTranslation()); var interaction = new EncryptionPasswordInteraction(false, true, true); var actionWasCalled = false; viewModel.SetPasswordInUi = (x, y) => actionWasCalled = true; viewModel.SetInteraction(interaction); Assert.IsTrue(actionWasCalled); }
public void OkCommand_OnExecute_CompletesInteraction() { var viewModel = new EncryptionPasswordViewModel(new EncryptionPasswordsWindowTranslation()); var interaction = new EncryptionPasswordInteraction(false, true, true); var helper = new InteractionHelper <EncryptionPasswordInteraction>(viewModel, interaction); viewModel.OkCommand.Execute(null); Assert.AreEqual(PasswordResult.StorePassword, interaction.Response); Assert.IsTrue(helper.InteractionIsFinished); }
public EncryptionPasswordsWindow(EncryptionPasswordViewModel viewModel) { _viewModel = viewModel; DataContext = _viewModel; Loaded += (sender, e) => MoveFocus(new TraversalRequest(FocusNavigationDirection.Next)); InitializeComponent(); _viewModel.SetPasswordInUi = SetPasswords; }
public void RemoveCommand_OnExecute_CompletesInteraction() { var viewModel = new EncryptionPasswordViewModel(); var interaction = new EncryptionPasswordInteraction(false, true, true); var helper = new InteractionHelper <EncryptionPasswordInteraction>(viewModel, interaction); viewModel.RemoveCommand.Execute(null); Assert.AreEqual(PasswordResult.RemovePassword, interaction.Response); Assert.IsTrue(helper.InteractionIsFinished); Assert.AreEqual("", interaction.OwnerPassword); Assert.AreEqual("", interaction.UserPassword); }
public void SetingUserPassword_WritesToInteractionAndCallsCanExecuteChanged() { var viewModel = new EncryptionPasswordViewModel(new EncryptionPasswordsWindowTranslation()); var canExecuteChanged = false; viewModel.OkCommand.CanExecuteChanged += (sender, args) => canExecuteChanged = true; var interaction = new EncryptionPasswordInteraction(false, true, true); viewModel.SetInteraction(interaction); viewModel.UserPassword = "******"; Assert.AreEqual("MyPassword", interaction.UserPassword); Assert.IsTrue(canExecuteChanged); }
public void OkCommand_CanExecute_IfInteractionIsNotSet_ReturnsFalse() { var viewModel = new EncryptionPasswordViewModel(new EncryptionPasswordsWindowTranslation()); Assert.IsFalse(viewModel.OkCommand.CanExecute(null)); }