Esempio n. 1
0
 public void CommandExecutes()
 {
     bool executed = false;
     RelayCommand target = new RelayCommand(() => executed = true);
     target.Execute(null);
     Assert.IsTrue(executed);
 }
Esempio n. 2
0
        public void ReceiveCorrectParameter()
        {
            bool canExecuteGotParam = false;
            bool executeGotParam = false;
            
            string paramValue = "whatever";

            RelayCommand<string> target = new RelayCommand<string>(
                (param) => executeGotParam = (param == paramValue), 
                (param) => canExecuteGotParam = (param == paramValue));

            target.CanExecute(paramValue);
            target.Execute(paramValue);

            Assert.IsTrue(canExecuteGotParam);
            Assert.IsTrue(executeGotParam);
        }