public void Constructor_PredicateConditionsAreNotMet_CommandDoesNotExecute()
        {
            int num = 4;
            CommandDrivenControlViewModel _viewModel = new CommandDrivenControlViewModel((x) => SomeMethodThatDoesSomething(), (y) => (int)y > 5, "Action!", "Click here!");

            Assert.IsFalse(_viewModel.Action.CanExecute(num));
        }
Пример #2
0
 private void InitializeClosableWorkspaceActions()
 {
     DeactivateWorkspace = new CommandDrivenControlViewModel((x) => MakeWorkspaceInactive(), "Close", "Close this workspace.");
 }
        public void Constructor_PredicateIsNull_CommandExecutes()
        {
            CommandDrivenControlViewModel _viewModel = new CommandDrivenControlViewModel((x) => SomeMethodThatDoesSomething(), null, "Action!", "Click here!");

            Assert.IsTrue(_viewModel.Action.CanExecute(new object()));
        }
        public void Constructor_ActionIsNull_CommandDoesNotExecute()
        {
            CommandDrivenControlViewModel _viewModel = new CommandDrivenControlViewModel(null, "Action!");

            Assert.IsFalse(_viewModel.Action.CanExecute(new object()));
        }
        public void ConstructorWithoutToolTip_ActionIsNull_ToolTipReadsNotInitializedMessage()
        {
            CommandDrivenControlViewModel _viewModel = new CommandDrivenControlViewModel(null, "Action!");

            Assert.AreEqual("Not initialized. Cannot perform labeled action.", _viewModel.ToolTip);
        }
        public void ConstructorWithoutToolTip_ActionIsNotNull_ToolTipReadsInitializedMessage()
        {
            CommandDrivenControlViewModel _viewModel = new CommandDrivenControlViewModel((x) => SomeMethodThatDoesSomething(), "Action!");

            Assert.AreEqual("Click to perform labeled action.", _viewModel.ToolTip);
        }
        public void ConstructorWithoutToolTip_ActionIsNotNull_HeaderIsNotEmptyString()
        {
            CommandDrivenControlViewModel _viewModel = new CommandDrivenControlViewModel((x) => SomeMethodThatDoesSomething(), "Action!");

            Assert.AreNotEqual(String.Empty, _viewModel.ToolTip);
        }