コード例 #1
0
        public void ExecuteInvokeAction()
        {
            var invoked = false;
            var command = new RelayCommand(obj => invoked = true);

            command.Execute();

            Assert.IsTrue(invoked);
        }
コード例 #2
0
        public void ExecuteOverloadInvokeActionWithParameter()
        {
            var invoked = false;
            var command = new RelayCommand(obj =>
            {
                Assert.IsNotNull(obj);
                invoked = true;
            });

            command.Execute(new object());
            Assert.IsTrue(invoked);
        }
コード例 #3
0
 public void CanExecuteOverloadExecutesTruePredicate()
 {
     var command = new RelayCommand(obj => { }, obj => (int)obj == 1);
     Assert.IsTrue(command.CanExecute(1));
 }
コード例 #4
0
 public void ConstructorThrowsExceptionIfActionParameterIsNull()
 {
     var command = new RelayCommand(null);
 }
コード例 #5
0
 public void CanExecuteIsTrueByDefault()
 {
     var command = new RelayCommand(obj => { });
     Assert.IsTrue(command.CanExecute(null));
 }