static void Main(string[] args) { Console.WriteLine("Welcome to password checker. Please enter a string (Ctrl+C) to exit"); var input = Console.ReadLine(); var client = new HibpClient(); var has = client.PasswordHasBeenPwned(input); }
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)); }
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)); }
public void WhenHttpClientIsNull_ThenThrowException() { Assert.Throws <ArgumentNullException>(() => _ = new HibpClient(null)); }