public async Task DeleteClienteAsync_Sucesso()
        {
            repository.DeleteClienteAsync(Arg.Any <int>()).Returns(Cliente);
            var controle = mapper.Map <ClienteView>(Cliente);
            var retorno  = await manager.DeleteClienteAsync(Cliente.Id);

            await repository.Received().DeleteClienteAsync(Arg.Any <int>());

            retorno.Should().BeEquivalentTo(controle);
        }
        public async Task Delete_NoContent()
        {
            manager.DeleteClienteAsync(Arg.Any <int>()).Returns(clienteView);

            var resultado = (StatusCodeResult)await controller.Delete(1);

            await manager.Received().DeleteClienteAsync(Arg.Any <int>());

            resultado.StatusCode.Should().Be(StatusCodes.Status204NoContent);
        }
Beispiel #3
0
        public async Task <IActionResult> Delete(int id)
        {
            var clienteExcliudo = await clienteManager.DeleteClienteAsync(id);

            if (clienteExcliudo == null)
            {
                return(NotFound());
            }
            return(NoContent());
        }
        public async Task <IActionResult> Delete(int id)
        {
            await clienteManager.DeleteClienteAsync(id);

            return(NoContent());
        }