public void RaiseCanExecuteChanged() { int count = 0; var command = new ManualRelayCommand(() => { }, () => true); command.CanExecuteChanged += (sender, args) => count++; Assert.AreEqual(0, count); command.RaiseCanExecuteChanged(); Assert.AreEqual(1, count); }
public static async Task WhenRaiseCanExecuteChanged() { var count = 0; var command = new ManualRelayCommand <int>(x => { }, x => true); command.CanExecuteChanged += (sender, args) => count++; Assert.AreEqual(0, count); command.RaiseCanExecuteChanged(); await Application.Current.Dispatcher.SimulateYield(); Assert.AreEqual(1, count); }
private void RaiseCanExecute() { ManualRelayCommandNoCondition.RaiseCanExecuteChanged(); ManualRelayCommand.RaiseCanExecuteChanged(); ManualRelayCommandWithParameter.RaiseCanExecuteChanged(); RelayCommandNoCondition.RaiseCanExecuteChanged(); RelayCommand.RaiseCanExecuteChanged(); RelayCommandWithParamater.RaiseCanExecuteChanged(); ObservingRelayCommand.RaiseCanExecuteChanged(); ObservingRelayCommandWithParameter.RaiseCanExecuteChanged(); ConditionRelayCommand.RaiseCanExecuteChanged(); ConditionRelayCommandWithParameter.RaiseCanExecuteChanged(); }