Ejemplo n.º 1
0
        [TestCase("AbTp9!fok", true)] // true
        public void Deve_Validar_Senhas_Corretamente_Para_ConfigTotalCaracteres(
            string password,
            bool expectedIsValid)
        {
            // Arrange
            var service = new ValidaSenhaService();

            //Act
            var result = service.Valida(password);

            //Assert
            Assert.AreEqual(expectedIsValid, result);
        }
Ejemplo n.º 2
0
 public async Task <IActionResult> Post([FromBody] ValidaSenhaRequest request)
 {
     try
     {
         if (request is null)
         {
             return(BadRequest());
         }
         var success = _service.Valida(request.Senha);
         return(await Task.FromResult <IActionResult>(Ok(new { success = success })));
     }
     catch (System.Exception ex)
     {
         this._logger.LogError(ex, "OOoops!");
         return(Problem(
                    type: "http://itivalidacomplexidadesenha/internalerror",
                    title: $"One or more model errors occurred. traceId: {ControllerContext.HttpContext.TraceIdentifier}",
                    statusCode: StatusCodes.Status500InternalServerError,
                    detail: ex.Message,
                    instance: Request.Path
                    ));
     }
 }