Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }