Ejemplo n.º 1
0
        public IActionResult Validate([FromBody] StrongPasswordApiModel apiModel)
        {
            if (apiModel == null)
            {
                return(BadRequest(new { message = "Problems parsing JSON" }));
            }

            bool isPasswordStrong = validateStrongPassword.IsValid(apiModel.Value);

            if (isPasswordStrong)
            {
                return(NoContent());
            }
            return(UnprocessableEntity(new
            {
                property = "value",
                message = "Invalid"
            }));
        }
        public void ShouldReturnFalseWhenValueIsNull()
        {
            bool result = validateStrongPassword.IsValid(null);

            result.Should().BeFalse();
        }