Ejemplo n.º 1
0
        public void FakeCnhIsValid()
        {
            var doc = new Cnh();

            doc.GerarFake();
            Assert.IsTrue(doc.DocumentoValido());
        }
Ejemplo n.º 2
0
        public override void CarregarEntidadeDoForm()
        {
            entidade.ClearNotifications();
            Endereco endereco = new Endereco(
                txtEnderecoLogradouro.Text,
                txtEnderecoNumero.Text,
                cidade,
                txtEnderecoBairro.Text,
                txtEnderecoComplemento.Text,
                txtEnderecoCEP.Text,
                txtEnderecoCaixaPostal.Text);
            // endereco.SetValidations();
            TipoPessoa tipoPessoa = TipoPessoa.Fisica;

            if (rdPj.Checked)
            {
                tipoPessoa = TipoPessoa.Juridica;
            }

            string vencCNH = "";

            txtCnhValidade.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals; // tira a formatação
            vencCNH = txtCnhValidade.Text;                                       //texto não formatado
            txtCnhValidade.TextMaskFormat = MaskFormat.IncludePromptAndLiterals; // retorna a formatação
            if (vencCNH.Length == 8)
            {
                vencCNH = txtCnhValidade.Text;
            }
            else
            {
                vencCNH = "";
            }
            Cnh cnh = new Cnh(
                txtCnhRegistro.Text,
                vencCNH,
                txtCnhLetra.Text);

            entidade.SetValues(
                txtNome.Text,
                txtCpfCnpj.Text,
                txtRgIe.Text,
                endereco,
                tipoPessoa,
                txtNomePai.Text,
                txtNomeMae.Text,
                txtDataNascimento.Text,
                cnh,
                txtTelefone1.Text,
                txtTelefone2.Text);
        }
Ejemplo n.º 3
0
        public void CnhIsValid()
        {
            var doc = new Cnh("13975859080");

            Assert.IsTrue(doc.DocumentoValido());
        }
        } //construtor para EF

        public void SetValues(string nome, string cpfCnpj, string rgIe, Endereco endereco, TipoPessoa tipoPessoa, string NomePai, string NomeMae, string DataNascimento, Cnh Cnh, string telefone1, string telefone2)
        {
            this.Nome           = nome;
            this.CpfCnpj        = cpfCnpj;
            this.RgIe           = rgIe.Trim().ToUpper();
            this.Endereco       = endereco;
            this.TipoPessoa     = tipoPessoa;
            this.NomePai        = NomePai.Trim().ToUpper();
            this.NomeMae        = NomeMae.Trim().ToUpper();
            this.DataNascimento = DataNascimento.Trim().ToUpper();
            this.Cnh            = Cnh;
            this.Telefone1      = telefone1;
            this.Telefone2      = telefone2;
            SetValidations();
        }
Ejemplo n.º 5
0
        public void ValidCnhTest()
        {
            var cnh = new Cnh("04592402198");

            Assert.IsTrue(cnh.IsValid());
        }
Ejemplo n.º 6
0
        public void CnhLess14CharsTest()
        {
            var cnh = new Cnh("79258070112304");

            Assert.IsFalse(cnh.IsValid());
        }
Ejemplo n.º 7
0
        public void InvalidCnhTest()
        {
            var cnh = new Cnh("78258015104");

            Assert.IsFalse(cnh.IsValid());
        }