public void Teste_FuncionarioRepositorio_DeletarFuncionarioComIdInvalido_DeveSerThrowException()
        {
            funcionario    = ObjectMother.RetorneFuncionarioExistenteOk();
            funcionario.Id = 0;
            Action action = () => _repositorio.Deletar(funcionario);

            action.Should().Throw <IdentifierUndefinedException>();
        }
예제 #2
0
        public void Funcionario_InfraData_Deletar_Deve_Deletar_Funcionario_Sem_Vinculo()
        {
            var resultadoSalvar = _funcionarioRepositorio.Salvar(_funcionario);

            _funcionarioRepositorio.Deletar(resultadoSalvar);

            var resultadoBuscar = _funcionarioRepositorio.ObterPorId(resultadoSalvar.Id);

            resultadoBuscar.Should().BeNull();
        }
 public void Deletar(Funcionario funcionario)
 {
     if (funcionario.Id <= 0)
     {
         throw new IdentifierUndefinedException();
     }
     if (_eventoservico.CarregarPorFuncionarios(funcionario.Id).Count() > 0)
     {
         throw new FuncionarioRelacionadoComEventoException();
     }
     _funcionarioRepositorio.Deletar(funcionario);
 }
예제 #4
0
 public void Excluir(Funcionario entidade)
 {
     _funcionarioRepositorio.Deletar(entidade);
 }