Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
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));
            }
Ejemplo n.º 3
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));
            }
Ejemplo n.º 4
0
 public void WhenHttpClientIsNull_ThenThrowException()
 {
     Assert.Throws <ArgumentNullException>(() => _ = new HibpClient(null));
 }