public async Task TestaCreate() { var obj = new ProductCreateParameter() { Name = "Teste", Description = "descrição", Information = "Informação de teste", Amount = 20.0M, PurchaseDate = DateTime.Today, SubcategoryCode = 1234 }; var response = await _controller.Post(obj); Assert.IsType <CreatedAtActionResult>(response.Result); Assert.IsType <ActionResult <ProductPresenter> >(response); }
public async Task <ActionResult <ProductPresenter> > Post([FromBody] ProductCreateParameter product) { var result = await _productService.Create(product.ToModel()); return(CreatedAtAction(nameof(Get), new { productCode = result.Code }, new ProductPresenter(result))); }