CanExecute() public method

public CanExecute ( object parameter ) : bool
parameter object
return bool
Ejemplo n.º 1
0
 public void RelayCommand_CanExecute_WhenConstructedWithoutAPredicate_ReturnsTrueAsADefault()
 {
     //------------Setup for test--------------------------
     var relayCommand = new RelayCommand(o => { });
     //------------Execute Test---------------------------
     var canExecute = relayCommand.CanExecute(null);
     //------------Assert Results-------------------------
     Assert.IsTrue(canExecute);
 }
Ejemplo n.º 2
0
 public void RelayCommand_CanExecute_WhenConstructedWithAPredicate_PredicateIsCalled()
 {
     //------------Setup for test--------------------------
     var canExecuteWasCalled = false;
     var relayCommand = new RelayCommand(o => { }, o =>
     {
         canExecuteWasCalled = true;
         return true;
     });
     //------------Execute Test---------------------------
     var canExecute = relayCommand.CanExecute(null);
     //------------Assert Results-------------------------
     Assert.IsTrue(canExecuteWasCalled);
     Assert.IsTrue(canExecute);
 }