11 references to HttpClientHedgingResiliencePredicates
Microsoft.Extensions.Http.Resilience (1)
Hedging\HttpHedgingStrategyOptions.cs (1)
27ShouldHandle = args => new ValueTask<bool>(HttpClientHedgingResiliencePredicates.IsTransient(args.Outcome, args.Context.CancellationToken));
Microsoft.Extensions.Http.Resilience.Tests (10)
Hedging\HttpClientHedgingResiliencePredicatesTests.cs (10)
20Assert.True(HttpClientHedgingResiliencePredicates.IsTransientHttpException(new TimeoutRejectedException())); 21Assert.True(HttpClientHedgingResiliencePredicates.IsTransientHttpException(new BrokenCircuitException())); 22Assert.True(HttpClientHedgingResiliencePredicates.IsTransientHttpException(new HttpRequestException())); 23Assert.False(HttpClientHedgingResiliencePredicates.IsTransientHttpException(new InvalidOperationException())); 29Assert.True(HttpClientHedgingResiliencePredicates.IsTransient(Outcome.FromException<HttpResponseMessage>(new TimeoutRejectedException()))); 30Assert.True(HttpClientHedgingResiliencePredicates.IsTransient(Outcome.FromException<HttpResponseMessage>(new BrokenCircuitException()))); 31Assert.True(HttpClientHedgingResiliencePredicates.IsTransient(Outcome.FromException<HttpResponseMessage>(new HttpRequestException()))); 32Assert.False(HttpClientHedgingResiliencePredicates.IsTransient(Outcome.FromException<HttpResponseMessage>(new InvalidOperationException()))); 33Assert.False(HttpClientHedgingResiliencePredicates.IsTransient(Outcome.FromResult<HttpResponseMessage>(null))); 43HttpClientHedgingResiliencePredicates.IsTransient(Outcome.FromResult(response)).Should().Be(expected);