Пример #1
0
 public void ConstructorThrowsExceptionIfActionParameterIsNull()
 {
     Assert.Throws<ArgumentNullException>(() =>
     {
         RelayCommand command = new RelayCommand(null);
     });
 }
Пример #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);
        }
Пример #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);
        }
Пример #4
0
 public void CanExecuteOverloadExecutesTruePredicate()
 {
     RelayCommand command = new RelayCommand(x => { }, y => (int)y == 1);
     Assert.IsTrue(command.CanExecute(1));
 }
Пример #5
0
 public void CanExecuteIsTrueByDefault()
 {
     RelayCommand command = new RelayCommand(x => { });
     Assert.IsTrue(command.CanExecute(null));
 }