private void Execute_doesnt_retry(Action <IExecutionStrategy, Func <int> > execute) { var executionStrategy = new NonRetryingExecutionStrategy(); var executionCount = 0; Assert.Throws <TimeoutException>( () => execute(executionStrategy, () => { executionCount++; throw new TimeoutException(); })); Assert.Equal(1, executionCount); }
private void ExecuteAsync_doesnt_retry(Func <IExecutionStrategy, Func <Task <int> >, Task> executeAsync) { var executionStrategy = new NonRetryingExecutionStrategy(); var executionCount = 0; Assert.Throws <TimeoutException>( () => ExceptionHelpers.UnwrapAggregateExceptions( () => executeAsync(executionStrategy, () => { executionCount++; throw new TimeoutException(); }).Wait())); Assert.Equal(1, executionCount); }