public async Task Given_bad_http_responses_then_retry_delay_durations_should_increase() { var handler = new StubMessageHandler(); var nAttempts = 2; for (int i = 0; i < nAttempts; i++) { handler.QueueResponse(StubResponse.WithIOError()); } handler.QueueResponse(StubResponse.StartStream()); var evt = new EventSource(new Configuration(_uri, handler)); var backoffs = new List <TimeSpan>(); evt.Error += (_, e) => { backoffs.Add(evt.BackOffDelay); if (backoffs.Count >= nAttempts) { evt.Close(); } }; await evt.StartAsync(); Assert.NotEmpty(backoffs); Assert.NotEqual(backoffs[0], backoffs[1]); Assert.True(backoffs[1] > backoffs[0]); }