public void ConstructorThrowsExceptionIfActionParameterIsNull() { Assert.Throws<ArgumentNullException>(() => { RelayCommand command = new RelayCommand(null); }); }
public void ExecuteInvokesAction() { bool invoked = false; Action<object> action = x => invoked = true; RelayCommand command = new RelayCommand(action); command.Execute(null); Assert.IsTrue(invoked); }
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); }
public void CanExecuteOverloadExecutesTruePredicate() { RelayCommand command = new RelayCommand(x => { }, y => (int)y == 1); Assert.IsTrue(command.CanExecute(1)); }
public void CanExecuteIsTrueByDefault() { RelayCommand command = new RelayCommand(x => { }); Assert.IsTrue(command.CanExecute(null)); }