public async Task setup_scenario() { _baseHttpClient = new StubHttpClient(new HttpResponseMessage()); _state = new StubCircuitBreakerState { ShouldAcceptResponse = false }; var stateCache = new StubCircuitBreakerManager { State = _state }; var configuration = new CircuitBreakingConfiguration(); var httpClient = _baseHttpClient.AddCircuitBreaking(configuration, stateCache); _response = await httpClient.GetAsync("/ping"); }
public async Task setup_scenario() { _expectedResponse = new HttpResponseMessage(HttpStatusCode.OK); _baseHttpClient = new StubHttpClient(_expectedResponse); _state = new StubCircuitBreakerState { ShouldAcceptResponse = true }; var stateCache = new StubCircuitBreakerManager { State = _state }; var configuration = new CircuitBreakingConfiguration(); var httpClient = _baseHttpClient.AddCircuitBreaking(configuration, stateCache); _actualResponse = await httpClient.GetAsync("/ping"); }
public async Task setup_scenario() { _exceptionToThrow = new Exception(); _state = new StubCircuitBreakerState { ShouldAcceptResponse = true }; var baseHttpClient = new StubHttpClient(_exceptionToThrow); var stateCache = new StubCircuitBreakerManager { State = _state }; var configuration = new CircuitBreakingConfiguration(); var httpClient = baseHttpClient.AddCircuitBreaking(configuration, stateCache); try { await httpClient.GetAsync("/ping"); } catch (Exception e) { _caughtException = e; } }