public async Task TestaCreate()
        {
            var obj = new CategoryCreateParameter()
            {
                Name        = "Teste",
                Description = "descrição"
            };

            var response = await _controller.Post(obj);

            Assert.IsType <CreatedAtActionResult>(response.Result);
            Assert.IsType <ActionResult <CategoryPresenter> >(response);
        }
Example #2
0
        public async Task <ActionResult <CategoryPresenter> > Post([FromBody] CategoryCreateParameter category)
        {
            Category result = await _categoryService.Create(category.ToModel());

            return(CreatedAtAction(nameof(Get), new { categoryCode = result.Code }, new CategoryPresenter(result)));
        }