Exemplo n.º 1
0
 public IActionResult InvoiceProducts([FromBody] InvoiceRequest invoiceRequest)
 {
     try
     {
         InvoiceProductsResponse response = productService.InvoiceProducts(invoiceRequest);
         return(StatusCode(200, response));
     }
     catch (Exception)
     {
         return(StatusCode(500, Constants.REQUEST_ERROR_MESSAGE));
     }
 }
Exemplo n.º 2
0
 public bool SaveOrder(InvoiceProductsResponse request)
 {
     try
     {
         var    response  = consumerService.Post(request, Constants.URI_Logistics);
         string message   = response.Content.ReadAsStringAsync().Result;
         var    isSuccess = Serialize.DeserializeObject <bool>(message);
         return(isSuccess);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Exemplo n.º 3
0
        public void ProductService_Calculate_Ok()
        {
            //Arrange
            ProductService productService = new ProductService();
            InvoiceRequest invoiceRequest = new InvoiceRequest()
            {
                IdUser = 123, Products = new List <ProductDto>()
                {
                    new ProductDto()
                    {
                        Cantidad = 2, Nombre = "CPU", Precio = 1000000
                    }
                }
            };

            //Act
            InvoiceProductsResponse invoiceProductsResponse = productService.InvoiceProducts(invoiceRequest);

            //Assert
            Assert.AreEqual(true, invoiceProductsResponse.Success);
            Assert.AreEqual(2000000, invoiceProductsResponse.TotalValue);
        }