public void DeveRetornarListaDeAnexoVaziaQuandoInformarArrayDeCaminhoDeArquvioVazio()
        {
            string[]     arrayVazio   = new string[0];
            AnexoFactory anexoFactory = new AnexoFactory();
            List <Anexo> listaAnxeo   = anexoFactory.criarAnexos(arrayVazio);

            Assert.AreEqual(0, listaAnxeo.Count);
        }
        public void DeveDesconsiderarElementoNuloParaCriacaoDaListaDeDestinatario()
        {
            string[] anexos = new string[3];
            anexos[0] = null;
            anexos[1] = "e:\a.txt";
            anexos[2] = "      ";

            AnexoFactory anexoFactory = new AnexoFactory();
            List <Anexo> listaAnexos  = anexoFactory.criarAnexos(anexos);

            Assert.AreEqual(1, listaAnexos.Count);
            Assert.AreEqual(anexos[1], listaAnexos[0].CaminhoArquivo);
        }
Example #3
0
        public void DeveEnviarEmailSemAnexo()
        {
            Mock <IEnvioEmail> envioEmail = new Mock <IEnvioEmail>();

            ValidadorEmail      validador    = new ValidadorEmail();
            DestinatarioFactory destFactory  = new DestinatarioFactory(validador);
            AnexoFactory        anexoFactory = new AnexoFactory();

            EnvioEmailApp envioEmailApp = new EnvioEmailApp(envioEmail.Object, validador, destFactory, anexoFactory);

            string[] emailDest = new string[1];
            emailDest[0] = emailRemetente;

            envioEmailApp.EnviarEmail(emailRemetente, smtpRemetente, senhaRemetente, porta, false, emailDest, emailDest, emailDest, new string[0], assunto, texto);
        }
        public void DeveRetornarListaDeAnexosComOMesmoNumeroDeElementosDoArrayDeCaminhoArquivo()
        {
            string[] anexos = new string[3];
            anexos[0] = @"e:\a.txt";
            anexos[1] = @"e:\Carlos.jpg";
            anexos[2] = @"E:\Bancos Clientes\log.txt";


            AnexoFactory anexoFactory = new AnexoFactory();
            List <Anexo> listaAnexos  = anexoFactory.criarAnexos(anexos);

            Assert.AreEqual(anexos.Length, listaAnexos.Count);

            Assert.AreEqual(anexos[0], listaAnexos[0].CaminhoArquivo);
            Assert.AreEqual(anexos[1], listaAnexos[1].CaminhoArquivo);
            Assert.AreEqual(anexos[2], listaAnexos[2].CaminhoArquivo);
        }
        public void DeveRetornarExcessaoNaCriacaoDeListaDeAnexoSeArrayDeCaminhoDoAnexoForNula()
        {
            AnexoFactory anexoFactory = new AnexoFactory();

            anexoFactory.criarAnexos(null);
        }