Ejemplo n.º 1
0
        public void Skip_AskOwnerPW_DoNotSetOwnerPassword_AskUserPassword_SetUserPassword_OkButtonIsNotExecutable_SkipAndRemoveAreExecutable()
        {
            var vm = new EncryptionPasswordViewModelwithSkip(true, true);

            vm.OwnerPassword = "";
            vm.UserPassword  = "******";
            Assert.IsFalse(vm.OkCommand.IsExecutable, "OK Command should not be executable");
            Assert.IsTrue(vm.RemoveCommand.IsExecutable, "Skip Command is not executable");
            Assert.IsTrue(vm.SkipCommand.IsExecutable, "SkipCommand is not executable");
        }
Ejemplo n.º 2
0
        public void Skip_DoNotAskOwnerPW_SetOwnerPassword_DoNotAskUserPassword_DoNotSetUserPassword_OkButtonIsExecutable_SkipAndRemoveAreExecutable()
        {
            var vm = new EncryptionPasswordViewModelwithSkip(false, false);

            vm.OwnerPassword = "";
            vm.UserPassword  = "";
            Assert.IsTrue(vm.OkCommand.IsExecutable, "OK Command is not executable");
            Assert.IsTrue(vm.RemoveCommand.IsExecutable, "Skip Command is not executable");
            Assert.IsTrue(vm.SkipCommand.IsExecutable, "SkipCommand is not executable");
        }
Ejemplo n.º 3
0
        public void Skip_CheckDialogResultInCloseActionForRemoveCommand()
        {
            var vm = new EncryptionPasswordViewModelwithSkip(true, true);

            vm.CloseViewAction = CloseAction;
            vm.OwnerPassword   = "******";
            vm.UserPassword    = "******";

            vm.RemoveCommand.Execute(null);
            Assert.AreEqual(_closeDialogResult, true, "Wrong DialogResult for Remove command");
        }
Ejemplo n.º 4
0
        public void Skip_ExecuteSkip_PasswordsAreEmpty()
        {
            var vm = new EncryptionPasswordViewModelwithSkip(true, true);

            vm.OwnerPassword = "******";
            vm.UserPassword  = "******";

            vm.SkipCommand.Execute(null);

            Assert.IsEmpty(vm.OwnerPassword, "Owner password is not empty after skipping.");
            Assert.IsEmpty(vm.UserPassword, "User password is not empty after skipping.");
        }
Ejemplo n.º 5
0
        public void Skip_ExecuteOk_PasswordsAreTheSettedPasswords()
        {
            var vm = new EncryptionPasswordViewModelwithSkip(true, true);

            vm.OwnerPassword = "******";
            vm.UserPassword  = "******";

            vm.OkCommand.Execute(null);

            Assert.AreEqual("ownerpw", vm.OwnerPassword, "Owner password is not setted password.");
            Assert.AreEqual("userpw", vm.UserPassword, "User password is not setted password.");
        }
Ejemplo n.º 6
0
        public void Skip_CheckResponses()
        {
            var vm = new EncryptionPasswordViewModelwithSkip(true, true);

            vm.OwnerPassword = "******";
            vm.UserPassword  = "******";

            vm.OkCommand.Execute(null);
            Assert.AreEqual(EncryptionPasswordResponse.OK, vm.Response, "Wrong Response for OkCommand");
            vm.RemoveCommand.Execute(null);
            Assert.AreEqual(EncryptionPasswordResponse.Remove, vm.Response, "Wrong Response for RemoveCommand");
            vm.SkipCommand.Execute(null);
            Assert.AreEqual(EncryptionPasswordResponse.Skip, vm.Response, "Wrong Response for SkipCommand");
        }
Ejemplo n.º 7
0
        public EncryptionPasswordsWindow(EncryptionPasswordMiddleButton middleButton, bool askOwnerPassword, bool askUserPassword)
        {
            Loaded += (sender, e) =>
                      MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));

            InitializeComponent();

            switch (middleButton)
            {
            case EncryptionPasswordMiddleButton.Skip:
                DataContext                 = new EncryptionPasswordViewModelwithSkip(askOwnerPassword, askUserPassword);
                RemoveButton.Visibility     = Visibility.Collapsed;
                PasswordHintText.Visibility = Visibility.Collapsed;
                break;

            default:
                DataContext           = new EncryptionPasswordViewModelwithRemove(askUserPassword);
                SkipButton.Visibility = Visibility.Collapsed;
                break;
            }

            EncryptionPasswordViewModel.CloseViewAction = delegate(bool?result) { DialogResult = result; };
        }
Ejemplo n.º 8
0
        public void Skip_ResponseIsInitializedWithCancel()
        {
            var vm = new EncryptionPasswordViewModelwithSkip(true, true);

            Assert.AreEqual(vm.Response, EncryptionPasswordResponse.Cancel);
        }