Exemple #1
0
 public void ConstructorThrowsExceptionIfActionParameterIsNull()
 {
     Assert.Throws<ArgumentNullException>(() =>
     {
         RelayCommand command = new RelayCommand(null);
     });
 }
Exemple #2
0
        public void ExecuteInvokesAction()
        {
            bool invoked = false;

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

            RelayCommand command = new RelayCommand(action);

            command.Execute(null);

            Assert.IsTrue(invoked);
        }
Exemple #3
0
        public void ExecuteOverloadInvokesActionWithParameter()
        {
            bool invoked = false;

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

            RelayCommand command = new RelayCommand(action);

            command.Execute(new object());

            Assert.IsTrue(invoked);
        }
Exemple #4
0
 public void CanExecuteOverloadExecutesTruePredicate()
 {
     RelayCommand command = new RelayCommand(x => { }, y => (int)y == 1);
     Assert.IsTrue(command.CanExecute(1));
 }
Exemple #5
0
 public void CanExecuteIsTrueByDefault()
 {
     RelayCommand command = new RelayCommand(x => { });
     Assert.IsTrue(command.CanExecute(null));
 }