예제 #1
0
        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));
        }
예제 #2
0
        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));
        }
예제 #3
0
        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));
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }