public async Task RecaptchaPostOnValidationEndpoint_WithExcludedOsVersion_ShouldReturnNoContent()
        {
            using (var server = new IdentityServerWithRecaptchaValidationEndpoint()
                                .WithProtectedGrantType("password")
                                .WithExcludedOsVersionsMatching("5\\.0")
                                .WithFailuresForIpAddress("192.168.1.101", NumberOfAllowedLoginFailures)
                                .WithPublicKey("recaptcha-public-key")
                                .WithRecaptchaValidationEndpoint("/recaptcha/validation")
                                .WithNumberOfAllowedLoginFailuresPerIpAddress(NumberOfAllowedLoginFailures).Build())
            {
                var response = await server.CreateRequest("/recaptcha/validation")
                               .AddHeader("HTTP_X_FORWARDED_FOR", "192.168.1.101")
                               .And(request =>
                {
                    var recaptchaValidationResource = new RecaptchaValidationResource
                    {
                        Tenant    = "uk",
                        Email     = "*****@*****.**",
                        OsVersion = "5.0"
                    };
                    request.Content = new ObjectContent(typeof(RecaptchaValidationResource),
                                                        recaptchaValidationResource, new JsonMediaTypeFormatter());
                })
                               .PostAsync();

                response.StatusCode.Should().Be(HttpStatusCode.NoContent);
            }
        }
        public async Task RecaptchaPostOnValidationEndpoint_WithExceededLoginFailures_ShouldContainExpectedRecaptchaBody()
        {
            using (var server = new IdentityServerWithRecaptchaValidationEndpoint()
                                .WithProtectedGrantType("password")
                                .WithFailuresForIpAddress("192.168.1.101", NumberOfAllowedLoginFailures)
                                .WithPublicKey("recaptcha-public-key")
                                .WithRecaptchaValidationEndpoint("/recaptcha/validation")
                                .WithNumberOfAllowedLoginFailuresPerIpAddress(NumberOfAllowedLoginFailures).Build())
            {
                var response = await server.CreateRequest("/recaptcha/validation")
                               .AddHeader("HTTP_X_FORWARDED_FOR", "192.168.1.101")
                               .And(request =>
                {
                    var recaptchaValidationResource = new RecaptchaValidationResource
                    {
                        Tenant    = "uk",
                        Email     = "*****@*****.**",
                        OsVersion = "5.0",
                        Language  = "es-ES"
                    };
                    request.Content = new ObjectContent(typeof(RecaptchaValidationResource),
                                                        recaptchaValidationResource, new JsonMediaTypeFormatter());
                })
                               .PostAsync();

                var resource = await response.Content.ReadAsAsync <IdentityServerUnauthorizedChallengeResource>();

                resource.ChallengeHtml.Should().StartWith("<script src=\"https://www.google.com/recaptcha/api.js?hl=es-ES\"");
            }
        }