Example #1
0
        [Test] public void SendEmail()
        {
            var emailsSent_Before = SendEmails.Sent_EmailMessages.size();
            var to               = "*****@*****.**";
            var subject          = "a subject";
            var message          = "a message";
            var emailMessagePost = new EmailMessage_Post
            {
                To      = to,
                Subject = subject,
                Message = message
            };

            TmRest.SendEmail(emailMessagePost);

            var sentMessages     = SendEmails.Sent_EmailMessages;
            var emailsSent_After = sentMessages.size();
            var lastMessage      = sentMessages.last();

            Assert.IsTrue(new SendEmails().serverNotConfigured());
            Assert.Greater(emailsSent_Before, 0);
            Assert.AreNotEqual(emailsSent_Before, emailsSent_After);
            Assert.AreEqual(lastMessage.To, emailMessagePost.To);
            Assert.AreEqual(lastMessage.Subject, emailMessagePost.Subject);
            Assert.AreEqual(lastMessage.Message, emailMessagePost.Message);
        }
Example #2
0
        [Test] public void SendEmail()
        {
            var emailsSent_Before = SendEmails.Sent_EmailMessages.size();
            var to      = "*****@*****.**";
            var subject = "a subject";
            var message = "a message".line();
            //var extraText         = "\r\nSent by TeamMentor. \r\n\r\n";
            var emailMessagePost = new EmailMessage_Post
            {
                To      = to,
                Subject = subject,
                Message = message
            };

            TmRest.SendEmail(emailMessagePost);

            var sentMessages     = SendEmails.Sent_EmailMessages;
            var emailsSent_After = sentMessages.size();
            var lastMessage      = sentMessages.last();

            Assert.IsTrue(new SendEmails().serverNotConfigured());

            Assert.AreEqual(emailsSent_Before + 1, emailsSent_After);
            Assert.AreEqual(lastMessage.To, emailMessagePost.To);
            Assert.AreEqual(lastMessage.Subject, emailMessagePost.Subject);
            Assert.AreEqual(lastMessage.Message, emailMessagePost.Message.line() + TMConsts.EMAIL_DEFAULT_FOOTER);
        }