Beispiel #1
0
        public void ValidaDados()
        {
            Nome            = Nome.ToUpper().Trim();
            Telefone        = Telefone.Replace("(", "").Replace(")", "").Replace("-", "");
            TelefoneCelular = TelefoneCelular.Replace("(", "").Replace(")", "").Replace("-", "");
            Cnpj            = Cnpj.Replace("/", "").Replace("-", "");

            if (Nome.Length < 3)
            {
                throw new Exception("Nome informado inválido!");
            }
            if (Telefone.Length < 10)
            {
                throw new Exception("Telefone informado inválido!");
            }
            if (TelefoneCelular.Length < 11)
            {
                throw new Exception("Telefone Celular informado inválido!");
            }

            var opcaoCnpj  = ValidaCnpj(Cnpj);
            var opcaoEmail = ValidaEmail(Email);

            if (opcaoCnpj.Equals(false))
            {
                throw new Exception("O CNPJ informado inválido!");
            }

            if (opcaoEmail.Equals(false))
            {
                throw new Exception("O E-mail informado inválido!");
            }
        }
        public void Numero(string numero, string mensagemEsperada)
        {
            // Arrange
            var telefoneCelular = new TelefoneCelular("61", numero);

            // Act
            telefoneCelular.EstaValido();

            // Assert
            AssertMensagemExperada(mensagemEsperada, telefoneCelular);
        }