public async Task TestaCreate() { var obj = new SubcategoryCreateParameter() { Name = "Teste", Description = "descrição", CategoryCode = 1234 }; var response = await _controller.Post(obj); Assert.IsType <CreatedAtActionResult>(response.Result); Assert.IsType <ActionResult <SubcategoryPresenter> >(response); }
public async Task <ActionResult <SubcategoryPresenter> > Post([FromBody] SubcategoryCreateParameter subcategory) { var result = await _subcategoryService.Create(subcategory.ToModel()); return(CreatedAtAction(nameof(Get), new { subcategoryCode = result.Code }, new SubcategoryPresenter(result))); }