Example #1
0
        public void sendFileTooLargeTest()
        {
            String       path = Path.Combine(Environment.CurrentDirectory, "TestFiles\\FileTooLarge.txt");
            FileInfo     file = new FileInfo(path);
            FileResource msg  = new FileResource(file, LayoutTypeEnum.TYPE_A);

            msg.Callback = CallbackTypeEnum.INACTIVE;

            MultipleSending cliente = new MultipleSending(ACCOUNT, CODE);

            try
            {
                Console.Out.WriteLine("<< Teste de envio de SMS com arquivo muito grande >>");
                List <String> ret = cliente.send(msg);
                foreach (String result in ret)
                {
                    Console.Out.WriteLine(result);
                }

                Assert.Fail("Deve jogar exception");
            }
            catch (ClientHumanException e)
            {
                Console.Out.WriteLine(e.StackTrace);
                Assert.AreEqual("File size exceeds the limit of 1MB.", e.Message);
            }
        }
Example #2
0
        public void sendLoginFailTest()
        {
            ListResource msg = new ListResource("teste;teste", LayoutTypeEnum.TYPE_A);

            msg.Callback = CallbackTypeEnum.INACTIVE;

            MultipleSending cliente = new MultipleSending(null, null);

            try
            {
                Console.Out.WriteLine("<< Teste de envio de SMS com ACCOUNT / CODE invalidos >>");
                List <String> ret = cliente.send(msg);
                foreach (String result in ret)
                {
                    Console.Out.WriteLine(result);
                }

                Assert.Fail("Deve jogar exception");
            }
            catch (ClientHumanException e)
            {
                Console.Out.WriteLine(e.StackTrace);
                Assert.AreEqual("Field \"" + MultipleSending.PARAM_ACCOUNT + "\" is required.", e.Message);
            }
        }
Example #3
0
        public void sendListOKTest()
        {
            String        path = Path.Combine(Environment.CurrentDirectory, "TestFiles\\FileOKD.txt");
            StringBuilder sb   = new StringBuilder();
            StreamReader  sr   = File.OpenText(path);
            String        line = null;

            while ((line = sr.ReadLine()) != null)
            {
                sb.AppendLine(line);
            }

            ListResource msg = new ListResource(sb.ToString(), LayoutTypeEnum.TYPE_D);

            msg.Callback = CallbackTypeEnum.INACTIVE;

            MultipleSending cliente = new MultipleSending(ACCOUNT, CODE);

            try
            {
                Console.Out.WriteLine("<< Teste de envio de SMS com arquivo OK >>");
                List <String> ret = cliente.send(msg);
                foreach (String result in ret)
                {
                    Console.Out.WriteLine(result);
                }
            }
            catch (ClientHumanException e)
            {
                Console.Out.WriteLine(e.StackTrace);
                Assert.Fail("Nao deve jogar exception");
            }
        }
Example #4
0
        public void sendListMalformedEInvalidDateTest()
        {
            String        path = Path.Combine(Environment.CurrentDirectory, "TestFiles\\FileMalformedEInvalidDate.txt");
            StringBuilder sb   = new StringBuilder();
            StreamReader  sr   = File.OpenText(path);
            String        line = null;

            while ((line = sr.ReadLine()) != null)
            {
                sb.AppendLine(line);
            }

            ListResource msg = new ListResource(sb.ToString(), LayoutTypeEnum.TYPE_E);

            msg.Callback = CallbackTypeEnum.INACTIVE;

            MultipleSending cliente = new MultipleSending(ACCOUNT, CODE);

            try {
                Console.Out.WriteLine("<< Teste de envio de SMS com arquivo com problemas de formatacao (layout E) - data invalida >>");
                List <String> ret = cliente.send(msg);
                foreach (String result in ret)
                {
                    Console.Out.WriteLine(result);
                }

                Assert.Fail("Deve jogar exception");
            } catch (ClientHumanException e) {
                Console.Out.WriteLine(e.StackTrace);
                Assert.AreEqual("Date invalid.", e.Message);
            }
        }
Example #5
0
        public void sendFileMalformedEInvalidDateTest()
        {
            String       path = Path.Combine(Environment.CurrentDirectory, "TestFiles\\FileMalformedEInvalidDate.txt");
            FileInfo     file = new FileInfo(path);
            FileResource msg  = new FileResource(file, LayoutTypeEnum.TYPE_E);

            msg.Callback = CallbackTypeEnum.INACTIVE;

            MultipleSending cliente = new MultipleSending(ACCOUNT, CODE);

            try
            {
                Console.Out.WriteLine("<< Teste de envio de SMS com arquivo com problemas de formatacao (layout E) - data invalida >>");
                List <String> ret = cliente.send(msg);
                foreach (String result in ret)
                {
                    Console.Out.WriteLine(result);
                }

                Assert.Fail("Deve jogar exception");
            }
            catch (ClientHumanException e)
            {
                Console.Out.WriteLine(e.StackTrace);
                Assert.AreEqual("Date invalid.", e.Message);
            }
        }
Example #6
0
        public void sendFileOKTest()
        {
            String       path = Path.Combine(Environment.CurrentDirectory, "TestFiles\\FileOKD.txt");
            FileInfo     file = new FileInfo(path);
            FileResource msg  = new FileResource(file, LayoutTypeEnum.TYPE_D);

            msg.Callback = CallbackTypeEnum.INACTIVE;

            MultipleSending cliente = new MultipleSending(ACCOUNT, CODE);

            try {
                Console.Out.WriteLine("<< Teste de envio de SMS com arquivo OK >>");
                List <String> ret = cliente.send(msg);
                foreach (String result in ret)
                {
                    Console.Out.WriteLine(result);
                }
            } catch (ClientHumanException e) {
                Console.Out.WriteLine(e.StackTrace);
                Assert.Fail("Nao deve jogar exception");
            }
        }