예제 #1
0
        public void Remove_CanExecuteAllCommands()
        {
            var vm = new EncryptionPasswordViewModelwithRemove();

            Assert.IsTrue(vm.OkCommand.IsExecutable, "OK Command ist not executable");
            Assert.IsTrue(vm.RemoveCommand.IsExecutable, "Skip Command is not executable");
            Assert.IsTrue(vm.SkipCommand.IsExecutable, "SkipCommand is not executable");
        }
예제 #2
0
        public void Remove_CheckDialogResultInCloseActionForRemoveCommand()
        {
            var vm = new EncryptionPasswordViewModelwithRemove();

            vm.CloseViewAction = CloseAction;

            vm.RemoveCommand.Execute(null);
            Assert.AreEqual(_closeDialogResult, true, "Wrong DialogResult for Remove command");
        }
예제 #3
0
        public void Remove_CheckResponses()
        {
            var vm = new EncryptionPasswordViewModelwithRemove();

            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");
        }
예제 #4
0
        public void Remove_ExecuteSkip_PasswordsAreEmpty()
        {
            var vm = new EncryptionPasswordViewModelwithRemove(true);

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

            vm.RemoveCommand.Execute(null);

            Assert.IsEmpty(vm.OwnerPassword, "OwnerPassword is not empty after removing.");
            Assert.IsEmpty(vm.UserPassword, "UserPassword is not empty after removing.");
        }
예제 #5
0
        public void Remove_ExecuteOk_PasswordsAreTheSettedPasswords()
        {
            var vm = new EncryptionPasswordViewModelwithRemove(true);

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

            vm.OkCommand.Execute(null);

            Assert.AreEqual("ownerpw", vm.OwnerPassword, "OwnerPassword is not setted password.");
            Assert.AreEqual("userpw", vm.UserPassword, "UserPassword is not setted password.");
        }
예제 #6
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; };
        }
예제 #7
0
        public void Remove_WithoutAskUserPassword_DoesNotRequireUserPassword()
        {
            var vm = new EncryptionPasswordViewModelwithRemove(false);

            Assert.IsFalse(vm.AskUserPassword);
        }
예제 #8
0
        public void Remove_WithAskUserPassword_RequiresUserPassword()
        {
            var vm = new EncryptionPasswordViewModelwithRemove(true);

            Assert.IsTrue(vm.AskUserPassword);
        }
예제 #9
0
        public void Remove_InitTest()
        {
            var vm = new EncryptionPasswordViewModelwithRemove();

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