コード例 #1
0
        public NotaFiscal ObterPorId(long id)
        {
            if (id < 1)
            {
                throw new ExcecaoIdentificadorInvalido();
            }

            var nota = _notaFiscalRepositorio.ObterPorId(id);

            if (nota == null)
            {
                return(null);
            }

            nota.Destinatario          = _destinatarioRepositorio.ObterPorId(nota.Destinatario.ID);
            nota.Destinatario.Endereco = _enderecoRepositorio.ObterPorId(nota.Destinatario.Endereco.ID);

            nota.Emitente          = _emitenteRepositorio.ObterPorId(nota.Emitente.ID);
            nota.Emitente.Endereco = _enderecoRepositorio.ObterPorId(nota.Emitente.Endereco.ID);

            nota.Transportador          = _transportadorRepositorio.ObterPorId(nota.Transportador.ID);
            nota.Transportador.Endereco = _enderecoRepositorio.ObterPorId(nota.Transportador.Endereco.ID);

            return(nota);
        }
コード例 #2
0
        public void Transportador_InfraData_ObterPorId_EsperadoOK()
        {
            //Cenário
            BaseSqlTeste.SemearBancoParaTransportador();
            _transportador.ID = 1;

            //Ação
            Transportador transportador = _transportadorRepositorio.ObterPorId(_transportador.ID);

            //Verificação
            transportador.ID.Should().Be(_transportador.ID);
        }
コード例 #3
0
        public Transportador ObterPorId(long id)
        {
            if (id <= 0)
            {
                throw new ExcecaoIdentificadorInvalido();
            }

            var transportador = _transportadorRepositorio.ObterPorId(id);

            if (transportador == null)
            {
                return(null);
            }

            transportador.Endereco = _enderecoRepositorio.ObterPorId(transportador.Endereco.ID);

            return(transportador);
        }