예제 #1
0
        public async Task DeveExcluirEmpresa()
        {
            var empresa = EmpresaBuilder.Novo().Build();

            _empresaRepositorioMock.Setup(r => r.ObterPorIdAsync(EmpresaId)).Returns(Task.FromResult(empresa));

            await _exclusaoDeEmpresa.Excluir(EmpresaId);

            _empresaRepositorioMock.Verify(r => r.Remover(empresa));
        }
예제 #2
0
        public async Task <IActionResult> Delete(int id)
        {
            await _exclusaoDeEmpresa.Excluir(id);

            if (!OperacaoValida())
            {
                return(BadRequestResponse());
            }

            return(Ok(true));
        }
예제 #3
0
        public async Task Deletar_Empresa_Inexistente()
        {
            var builder = new EmpresaBuilder()
                          .WithId(1);

            var empresa = builder.Build();

            _empresaRepository
            .Setup(c => c.GetWithFuncionarios(It.IsAny <Predicate <Empresa> >()))
            .ReturnsAsync(new List <Empresa>()
            {
            });

            await _exclusaoDeEmpresa.Excluir(1);

            Assert.True(_notificationContext.HasNotifications);
            _notificationContext.Notifications.Should().HaveCount(1);

            Assert.Contains(_notificationContext.Notifications,
                            n => n.Key.Equals("EmpresaInexistente"));

            _empresaRepository.Verify(r => r.Delete(1), Times.Never);
        }
        public async Task <IActionResult> Delete(int id)
        {
            await _exclusaoDeEmpresa.Excluir(id);

            return(Ok());
        }