public void OkCommand_CanExecute_UserPasswordIsRequiredAndNotSet_IsFalse() { var viewModel = new EncryptionPasswordViewModel(new EncryptionPasswordsWindowTranslation()); viewModel.SetInteraction(new EncryptionPasswordInteraction(true, false, true)); 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 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); }