Пример #1
0
        public void ValidateRequestToApi()
        {
            //Arrange
            string                palabraRequest    = "asdf";
            TelemetryClient       telemetry         = new TelemetryClient();
            ValidarRequestService validacionRequest = new ValidarRequestService(telemetry);
            //Act
            ResultResponse resultData = validacionRequest.CheckRequest(palabraRequest);

            //Assert
            Assert.IsTrue(string.IsNullOrEmpty(resultData.MessageError));
        }
Пример #2
0
        public ActionResult <ResultResponse> ObtenerProductos([FromHeader] string producto)
        {
            ValidarRequestService validacionService = new ValidarRequestService(_telemetry);
            ResultResponse        resultValidate    = validacionService.CheckRequest(producto);

            if (!string.IsNullOrEmpty(resultValidate.IdError))
            {
                return(BadRequest(resultValidate.MessageError));
            }

            PalindromoHelper  palindrome       = new ValidarBusqueda(producto);
            PalindromoService objectPalindromo = new PalindromoService(palindrome, _telemetry);
            bool resultPalindromo = Convert.ToBoolean(objectPalindromo.ValidarPalindromo(producto).IsPalindromo);

            ProductosService objectService = new ProductosService(_telemetry);
            ResultResponse   registros     = objectService.ObtenerProducto(producto, resultPalindromo);

            return(Ok(registros));
        }