public void ExecuteInvokesAction()
        {
            var invoked = false;

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

            var command = new ActionCommand(action);

            command.Execute();

            Assert.IsTrue(invoked);
        }
        public void ExecuteOverloadInvokesActionWithParameter()
        {
            var invoked = false;

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

            var command = new ActionCommand(action);

            command.Execute(new object());

            Assert.IsTrue(invoked);
        }
 public void CanExecuteOverloadExecutesFalsePredicate()
 {
     var command = new ActionCommand(obj => { }, obj => (int)obj == 1);
     Assert.IsFalse(command.CanExecute(0));
 }
 public void CanExecuteIsTrueByDefault()
 {
     var command = new ActionCommand(obj => { });
     Assert.IsTrue(command.CanExecute(null));
 }
 public void ConstructorThrowsExceptionIfActionParameterIsNull()
 {
     var command = new ActionCommand(null);
     command.CanExecute(false);
 }