Ejemplo n.º 1
0
        public async Task DeveDeletarUmaLinha()
        {
            //arrange
            var linha = new Domain.Entities.Linha(
                nome: "Linha 1",
                id: 1
                );

            await context.AddAsync(linha);

            await context.SaveChangesAsync();

            //act
            await deletarLinha.Executar(id : 1);

            //assert
            Assert.False(deletarLinha.Notifications.Any());
        }
        public async Task <IActionResult> Delete([FromServices] DeletarLinha deletarLinha, long id)
        {
            await deletarLinha.Executar(id);

            if (deletarLinha.Notifications.Any())
            {
                return(BadRequest(deletarLinha.Notifications));
            }

            return(Ok());
        }