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)); } }
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); } }
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); }