public async Task IsPwnedPasswordAsync_WithImATeapot_Throws()
    {
        using var httpClient = new HttpClient(new MockErroringHttpMessageHandler(desiredResultStatusCode: 418));
        using var c          = new HaveIBeenPwnedClient(this.ClientSettings, httpClient);

        await Assert.ThrowsAsync <HaveIBeenPwnedClientException>(() => c.IsPwnedPasswordAsync("DUMMY"));
    }
    public async Task IsPwnedPasswordAsync_CancellationToken_NotFound_ThrowsHaveIBeenPwnedClientException()
    {
        using var httpClient = new HttpClient(new MockErroringHttpMessageHandler(desiredResultStatusCode: 404));
        using var c          = new HaveIBeenPwnedClient(this.ClientSettings, httpClient);

        await Assert.ThrowsAsync <HaveIBeenPwnedClientException>(() => c.IsPwnedPasswordAsync("UNKNOWN", CancellationToken.None));
    }
    public async Task IsPwnedPasswordAsync_CancellationToken_WithNullValueForPassword_Throws()
    {
        using var httpClient = new HttpClient(new MockHttpMessageHandler());
        using var c          = new HaveIBeenPwnedClient(this.ClientSettings, httpClient);

        await Assert.ThrowsAsync <ArgumentNullException>(() => c.IsPwnedPasswordAsync(null, CancellationToken.None));
    }
    public async Task IsPwnedPasswordAsync_WithCancellationToken_RateLimitExceeded_ThrowsRateLimitExceededException()
    {
        using var cancellationTokenSource = new CancellationTokenSource();
        using var httpClient = new HttpClient(new MockErroringHttpMessageHandler(desiredResultStatusCode: 429));
        using var c          = new HaveIBeenPwnedClient(this.ClientSettings, httpClient);

        await Assert.ThrowsAsync <RateLimitExceededException>(() => c.IsPwnedPasswordAsync("DUMMY", CancellationToken.None));
    }
    public async Task IsPwnedPasswordAsync_CancellationToken_KnownInput_Succeeds()
    {
        using var httpClient = new HttpClient(new MockHttpMessageHandler());
        using var c          = new HaveIBeenPwnedClient(this.ClientSettings, httpClient);

        var result = await c.IsPwnedPasswordAsync("P@ssw0rd", CancellationToken.None);

        Assert.True(result);
    }
    public async Task IsPwnedPasswordAsync_CancellationToken_AfterDispose_Throws()
    {
        using var httpClient = new HttpClient(new MockHttpMessageHandler());

        var c = new HaveIBeenPwnedClient(this.ClientSettings, httpClient);

        c.Dispose();

        await Assert.ThrowsAsync <ObjectDisposedException>(() => c.IsPwnedPasswordAsync("DUMMY", CancellationToken.None));
    }
    public async Task IsPwnedPassword_WithValidKnownInput_ReturnsTrue(string password, bool isExpected, bool requestPadding)
    {
        var settings = CreateSettings();

        settings.RequestPaddingForPwnedPasswordResponses = requestPadding;

        using var httpClient = new HttpClient();
        using var c          = new HaveIBeenPwnedClient(settings, httpClient);

        var result = await c.IsPwnedPasswordAsync(password);

        Assert.Equal(isExpected, result);
    }