Exemplo n.º 1
0
        public void ActionCommand_ExecuteInvokeAction_WhenActionParameterIsNotNull()
        {
            bool invoked = false;

            Action<object> action = obj => invoked = true;

            var command = new ActionCommand(action);
            command.Execute(null);

            Assert.IsTrue(invoked);
        }
Exemplo n.º 2
0
        public void ActionCommand_ExecuteOverloadInvokeAction_WhenParameterIsNotNull()
        {
            bool invoked = false;

            Action<object> action = obj =>
            {
                Assert.IsNotNull(obj);
                invoked = true;
            };

            var command = new ActionCommand(action);
            command.Execute(new object());

            Assert.IsTrue(invoked);
        }
Exemplo n.º 3
0
        public void ActionCommand_CanExecuteOverloadExecute_WhenPredicateisFalse()
        {
            var command = new ActionCommand(obj => { }, obj => (int)obj == 1);

            Assert.IsFalse(command.CanExecute(2));
        }
Exemplo n.º 4
0
        public void ActionCommand_CanExecuteIsTrue_TruePredicateIsNull()
        {
            var command = new ActionCommand(obj => { });

            Assert.IsTrue(command.CanExecute(null));
        }
Exemplo n.º 5
0
 public void ActionCommand_ConstructorThrowsException_WhenActionParameterIsNull()
 {
     var actionCommand = new ActionCommand(null);
 }