public void SuppressExecution_throws_if_called_after_execution() { var data = new InterceptionContextMutableData { HasExecuted = true }; Assert.Equal( Strings.SuppressionAfterExecution, Assert.Throws<InvalidOperationException>(() => data.SuppressExecution()).Message); Assert.False(data.IsExecutionSuppressed); }
public void SuppressExecution_can_be_called_before_execution() { var data = new InterceptionContextMutableData(); Assert.False(data.IsExecutionSuppressed); data.SuppressExecution(); Assert.True(data.IsExecutionSuppressed); }
public void SuppressExecution_throws_if_called_after_execution() { var data = new InterceptionContextMutableData { HasExecuted = true }; Assert.Equal( Strings.SuppressionAfterExecution, Assert.Throws <InvalidOperationException>(() => data.SuppressExecution()).Message); Assert.False(data.IsExecutionSuppressed); }
/// <summary> /// Prevents the operation from being executed if called before the operation has executed. /// </summary> /// <exception cref="InvalidOperationException"> /// Thrown if this method is called after the operation has already executed. /// </exception> public void SuppressExecution() { _mutableData.SuppressExecution(); }