コード例 #1
0
        public void Telefone_Formato_Correto()
        {
            telefone = new Telefones(1, "1156775967", "976337887");
            var tel = new TelefoneValidoSpecification();

            Assert.True(tel.IsSatisfiedBy(telefone));
        }
コード例 #2
0
        public TelefoneCadastroValidator(Telefones telefone)
        {
            var telefoneFormato = new TelefoneValidoSpecification();
            var celularFormato  = new CelularValidoSpecification();

            if (!telefoneFormato.IsSatisfiedBy(telefone))
            {
                telefone.validateResult.notifications.Add(new Notification(1, "O Telefone deve ter entre 10 e 11 caracteres.", DateTime.Now));
            }

            if (!celularFormato.IsSatisfiedBy(telefone))
            {
                telefone.validateResult.notifications.Add(new Notification(1, "O Telefone deve ter entre 10 e 11 caracteres.", DateTime.Now));
            }
        }