public void Constructor_WithCanExecuteParameter_CanExecuteIsNotNull() { ObservableVariable <bool> canExecute = new ObservableVariable <bool>(); ObservableCommand command = new ObservableCommand(canExecute); Assert.IsNotNull(command.CanExecute); }
public void Constructor_WithCanExecuteParameter_CanExecuteValueIsTrue() { ObservableVariable <bool> canExecute = new ObservableVariable <bool>(true); ObservableCommand command = new ObservableCommand(canExecute); Assert.IsTrue(command.CanExecute.Value); }
public IEnumerator Subscribe_WhenSubscription_NoCallbackIsRaised() { ObservableVariable<int> variable = new ObservableVariable<int>(); variable.Changed += IncrementCallbackCount; Assert.IsTrue(callbackCount == 0); yield return null; }
public IEnumerator Value_WhenSetTheSameValue_DontRaiseCallback() { ObservableVariable<int> variable = new ObservableVariable<int>(); variable.Value = 14; Assert.IsTrue(variable.Value == 14); yield return null; }
public IEnumerator Value_WhenSetAValue_KeepsThatValue() { ObservableVariable<int> variable = new ObservableVariable<int>(); variable.Value = 14; Assert.IsTrue(variable.Value == 14); yield return null; }
public IEnumerator Subscribe_WhenValueChange_OnlyOneCallCallbackIsRaised() { ObservableVariable<int> variable = new ObservableVariable<int>(); variable.Changed += IncrementCallbackCount; variable.Value = 42; Assert.IsTrue(callbackCount == 1); yield return null; }
public IEnumerator Subscribe_WhenValueChange_CallCallback() { ObservableVariable<int> variable = new ObservableVariable<int>(); variable.Changed += CopyIntVariable; variable.Value = 14; Assert.IsTrue(intMirrorVariable == 14); yield return null; }
public void Generic_Execute_WhenCanExecute_ParameterIsReceived() { ObservableVariable <bool> canExecute = new ObservableVariable <bool>(true); ObservableCommand <int> command = new ObservableCommand <int>(canExecute); int mirrorVariable = -1; command.ExecuteRequested += (int value) => mirrorVariable = value; command.Execute(14); Assert.IsTrue(mirrorVariable == 14); }
public void Execute_WhenCanNotExecute_DoNotRaiseEvent() { ObservableVariable <bool> canExecute = new ObservableVariable <bool>(); ObservableCommand command = new ObservableCommand(canExecute); canExecute.Value = false; int callbackCount = 0; command.ExecuteRequested += () => callbackCount++; command.Execute(); Assert.IsTrue(callbackCount == 0); }
public void Generic_Execute_WhenCanNotExecute_DoNotRaiseEvent() { ObservableVariable <bool> canExecute = new ObservableVariable <bool>(true); ObservableCommand <int> command = new ObservableCommand <int>(canExecute); canExecute.Value = false; int callbackCount = 0; command.ExecuteRequested += (int value) => callbackCount++; command.Execute(14); Assert.IsTrue(callbackCount == 0); }