public async Task E_Possivel_Adicionar_Churras() { var serviceMock = new Mock <IChurrasService>(); var churras = new ChurrasEntity(1, "thomaz", DateTime.Now, "churras", 10, 10); serviceMock.Setup(x => x.Insert(It.IsAny <ChurrasEntity>())).ReturnsAsync(churras); _churrasService = serviceMock.Object; var result = await _churrasService.Insert(churras); Assert.NotNull(result); }
public async Task <IActionResult> Post([FromBody] ChurrasEntity churrasEntity) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { await _churrasService.Insert(churrasEntity); return(Ok($"Churras marcado com sucesso")); } catch (Exception) { throw; } }