public async Task <ActionResult <SubcategoryPresenter> > Put([FromBody] SubcategoryParameter subcategory, long subcategoryCode) { var result = await _subcategoryService.Update(subcategoryCode, subcategory.ToModel()); if (result is null) { return(NotFound()); } return(new SubcategoryPresenter(result)); }
public async Task TestaUpdate(long code) { var subcategory = new SubcategoryParameter() { SubcategoryCode = code, CategoryCode = code, Description = "Teste atualizãção", IsActive = false, Name = "Atualizada" }; var response = await _controller.Put(subcategory, code); if (code == 1234) { Assert.IsType <ActionResult <SubcategoryPresenter> >(response); } else { Assert.IsType <NotFoundResult>(response.Result); } }