public void valid_insert_product() { // setp repository .Setup(rp => rp.Insert(It.IsAny <Product>())) .Verifiable(); var productRandom = ProductMother.MartilloProductWithStock(); // act var productCreate = createManager.Create( description: productRandom.Description, name: productRandom.Name, friendlyName: productRandom.FriendlyName, price: productRandom.Price, tax: productRandom.Tax, initialStock: new QuantityValue(100, "UM"), taxDescription: productRandom.TaxDescription) // val .Should() .BeOfType <ProductViewModel>(); repository.Verify(); }
public IActionResult Post(ProductRequest productRequest) { var product = createManager.Create( productRequest.Description, productRequest.Name, productRequest.FriendlyName, productRequest.Price, productRequest.Tax, productRequest.InitialStock, productRequest.TaxDescription); return(CreatedAtAction( nameof(ProductsGetController.GetById), nameof(ProductsGetController).Replace("Controller", ""), new { productId = product.Id }, product)); }