private void btnCalcular_Click(object sender, EventArgs e)
        {
            if (this.rdInforme.Checked)
            {
                if (this.txtMatricula.Text != String.Empty)
                {
                    if (ValidarMatricula(this.txtMatricula.Text))
                    {
                        MessageBox.Show("Matricula verificada: " + MatriculaTeste.InformarMatricula(this.txtMatricula.Text), "Resultado", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Matricula inválida.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Nenhuma matrícula foi informada", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }

            if (this.rdArquivo.Checked)
            {
                if (ValidarPath(this.txtPath.Text))
                {
                    int result = MatriculaTeste.VerificarMatriculaArquivo(this.txtPath.Text);

                    if (result == 1)
                    {
                        MessageBox.Show("Verificação de matrículas em arquivo efetuado.", "Resultado", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Erro ao verificar matrículas em arquivo.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Diretório do arquivo inválido.", "Erro", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Beispiel #2
0
        public void TestarVerificarMatriculaArquivo()
        {
            int resultado = MatriculaTeste.VerificarMatriculaArquivo(@"matriculasSemDV.txt");

            Assert.AreEqual(1, resultado);
        }