Пример #1
0
        [Test] public void send()
        {
            var emailMessage = new EmailMessage
            {
                To          = 10.randomLetters(),
                From        = 10.randomLetters(),
                Subject     = 10.randomLetters(),
                Message     = 10.randomLetters(),
                HtmlMessage = false
            };

            sendEmails.Smtp_Server   = 10.randomLetters();
            sendEmails.Smtp_UserName = 10.randomLetters();
            sendEmails.Smtp_Password = 10.randomLetters();

            //try with bad email values
            var result1 = sendEmails.send(emailMessage);

            Assert.IsFalse(sendEmails.serverNotConfigured());
            Assert.IsFalse(result1);
            Assert.AreEqual(emailMessage.SentStatus, SentStatus.Error);
            //try with good emails values
            SendEmails.Dont_Send_Emails = true;
            emailMessage.To             = "".random_Email();
            emailMessage.From           = "from".random_Email();
            var result2 = sendEmails.send(emailMessage);

            Assert.IsTrue(result2);
            Assert.AreEqual(emailMessage.SentStatus, SentStatus.NotSent);
            SendEmails.Dont_Send_Emails = false;
        }
        public void SetUp()
        {
            var secretData = tmXmlDatabase.UserData.SecretData;

            sendEmails = new SendEmails();
            Assert.IsNotNull(sendEmails);
            Assert.IsNull(sendEmails.Smtp_Password, "In UnitTests SendEmails SMTP password should not be set");
            Assert.IsTrue(sendEmails.serverNotConfigured(), "In UnitTests serverNotConfigured should be in offline mode");
        }
Пример #3
0
        public void SetUp()
        {
            SendEmails.Disable_EmailEngine = false;
            SendEmails.Send_Emails_As_Sync = true;

            sendEmails = new SendEmails();
            Assert.IsNotNull(sendEmails);
            Assert.AreEqual(sendEmails.Smtp_Password, "", "In UnitTests SendEmails SMTP password should not be set");
            Assert.IsTrue(sendEmails.serverNotConfigured(), "In UnitTests serverNotConfigured should be in offline mode");
        }
Пример #4
0
        //SendEmails methods

        //SendEmails workflows
        [Test] public void Check_If_SMTP_Server_Is_Configured()
        {
            Assert.IsTrue(userData.SecretData.SMTP_Server.valid());
            Assert.IsTrue(userData.SecretData.SMTP_UserName.valid());
            Assert.IsTrue(userData.SecretData.SMTP_Password.valid());
            Assert.AreNotEqual(tmConfig.TMSecurity.Default_AdminEmail, new TMConfig.TMSecurity_Config().Default_AdminEmail);

            Assert.IsNotNull(sendEmails);
            Assert.IsFalse(sendEmails.serverNotConfigured());
        }