Exemple #1
0
            public void WhenRateLimitExceeded_AndRetryDisabled_ThenThrowException()
            {
                var options = new HibpClientOptions
                {
                    RetryOnRateLimitExceeded = false
                };

                var sut = new HibpClient(new HttpClient(new Return429RateLimitExceededResponseHandler()), options);

                Assert.ThrowsAsync <HibpClientException>(() => _ = sut.GetAccountBreachesAsync(EmailAddress));
            }
Exemple #2
0
            public async Task WhenRateLimitExceededOnlyOnFirstRequest_AndRetryEnabled_ThenReturnOkResponse()
            {
                var options = new HibpClientOptions
                {
                    RetryOnRateLimitExceeded = true
                };

                var sut = new HibpClient(new HttpClient(new Return429RateLimitExceededResponseHandler()), options);

                var result = await sut.GetAccountBreachesAsync(EmailAddress);

                Assert.That(result.Count(), Is.EqualTo(3));
            }