public async Task setup_scenario() { var retryManager = new StubRetryManager { Delay = new StubRetryDelay(10), Predicate = new StubRetryPredicate(2) }; _baseHttpClient = new StubHttpClient(); var configuration = new RetryingConfiguration { RetryPolicy = "default" }; var httpClient = _baseHttpClient.AddRetrying( configuration, retryManager, new [] { _callback }); var message = new HttpRequestMessage(HttpMethod.Get, "/get-content"); message.Properties.Add("propertyA", "valueA"); message.Properties.Add("propertyB", 12358); try { await httpClient.SendAsync(message); } catch { // Ignore the exception } }
public async Task setup_scenario() { _exceptionToThrow = new Exception(); var retryManager = new StubRetryManager { Delay = new StubRetryDelay(10), Predicate = new StubRetryPredicate(ExpectedRetries) }; var baseHttpClient = new StubHttpClient(_exceptionToThrow); var configuration = new RetryingConfiguration { RetryPolicy = "default" }; var httpClient = baseHttpClient.AddRetrying(configuration, retryManager, new[] { _callback }); try { await httpClient.GetAsync("/ping"); } catch (Exception e) { _caughtException = e; } }
public async Task setup_scenario() { var retryManager = new StubRetryManager { Delay = new StubRetryDelay(10), Predicate = new StubRetryPredicate(1) }; var baseHttpClient = new StubHttpClient(new Exception()); var configuration = new RetryingConfiguration { RetryPolicy = "default" }; var httpClient = baseHttpClient.AddRetrying( configuration, retryManager, new[] { _callback }); try { await httpClient.GetAsync("/ping"); } catch { // Ignore the exception } }