Пример #1
0
        public void ShouldSendMailWithOptionalProperties()
        {
            //Given
            var expectedMail = new ExpectedMail("*****@*****.**", "*****@*****.**", "test mail", "test mail body");

            //optional properties
            expectedMail.ccRecipient = "*****@*****.**";
            expectedMail.replyTo     = "*****@*****.**";

            var job = new TestSendMailJob();

            var context = TestUtil.NewJobExecutionContextFor(job);

            context.MergedJobDataMap.Put("smtp_host", "someserver");
            context.MergedJobDataMap.Put("recipient", expectedMail.recipient);
            context.MergedJobDataMap.Put("cc_recipient", expectedMail.ccRecipient);
            context.MergedJobDataMap.Put("sender", expectedMail.sender);
            context.MergedJobDataMap.Put("reply_to", expectedMail.replyTo);
            context.MergedJobDataMap.Put("subject", expectedMail.subject);
            context.MergedJobDataMap.Put("message", expectedMail.message);

            //When
            job.Execute(context);

            //Then
            expectedMail.IsEqualTo(job.actualMailSent);
            Assert.AreEqual("someserver", job.actualSmtpHost);
        }
Пример #2
0
        public void ShouldSetNetworkProperties()
        {
            //Given
            var expectedMail = new ExpectedMail("*****@*****.**", "*****@*****.**", "test mail", "test mail body");

            //optional properties
            expectedMail.ccRecipient = "*****@*****.**";
            expectedMail.replyTo     = "*****@*****.**";

            var job = new TestSendMailJob();

            var context = TestUtil.NewJobExecutionContextFor(job);

            context.MergedJobDataMap.Put("smtp_host", "someserver");
            context.MergedJobDataMap.Put("recipient", expectedMail.recipient);
            context.MergedJobDataMap.Put("sender", expectedMail.sender);
            context.MergedJobDataMap.Put("subject", expectedMail.subject);
            context.MergedJobDataMap.Put("message", expectedMail.message);
            context.MergedJobDataMap.Put("smtp_username", "user 123");
            context.MergedJobDataMap.Put("smtp_password", "pass 321");
            context.MergedJobDataMap.Put("smtp_port", "123");

            //When
            job.Execute(context);

            //Then
            Assert.AreEqual("someserver", job.actualSmtpHost);
            Assert.AreEqual("user 123", job.actualSmtpUserName);
            Assert.AreEqual("pass 321", job.actualSmtpPassword);
            Assert.AreEqual(123, job.actualSmtpPort);
        }
Пример #3
0
        public void ShouldSendMailWithOptionalProperties()
        {
            //Given
            ExpectedMail expectedMail =
                new ExpectedMail("*****@*****.**", "*****@*****.**", "test mail", "test mail body");
            //optional properties
            expectedMail.CcRecipient = "*****@*****.**";
            expectedMail.ReplyTo = "*****@*****.**";

            TestSendMailJob job = new TestSendMailJob();

            IJobExecutionContext context = TestUtil.NewJobExecutionContextFor(job);
            context.JobDetail.JobDataMap.Put("smtp_host", "someserver");
            context.JobDetail.JobDataMap.Put("recipient", expectedMail.Recipient);
            context.JobDetail.JobDataMap.Put("cc_recipient", expectedMail.CcRecipient);
            context.JobDetail.JobDataMap.Put("sender", expectedMail.Sender);
            context.JobDetail.JobDataMap.Put("reply_to", expectedMail.ReplyTo);
            context.JobDetail.JobDataMap.Put("subject", expectedMail.Subject);
            context.JobDetail.JobDataMap.Put("message", expectedMail.Message);

            //When
            job.Execute(context);

            //Then
            expectedMail.IsEqualTo(job.ActualMailSent);
            Assert.AreEqual("someserver", job.ActualSmtpHost);
        }
Пример #4
0
        public void ShouldSendMailWithOptionalProperties()
        {
            //Given
            ExpectedMail expectedMail =
                new ExpectedMail("*****@*****.**", "*****@*****.**", "test mail", "test mail body");

            //optional properties
            expectedMail.CcRecipient = "*****@*****.**";
            expectedMail.ReplyTo     = "*****@*****.**";

            TestSendMailJob job = new TestSendMailJob();

            JobExecutionContext context = TestUtil.NewJobExecutionContextFor(job);

            context.JobDetail.JobDataMap.Put("smtp_host", "someserver");
            context.JobDetail.JobDataMap.Put("recipient", expectedMail.Recipient);
            context.JobDetail.JobDataMap.Put("cc_recipient", expectedMail.CcRecipient);
            context.JobDetail.JobDataMap.Put("sender", expectedMail.Sender);
            context.JobDetail.JobDataMap.Put("reply_to", expectedMail.ReplyTo);
            context.JobDetail.JobDataMap.Put("subject", expectedMail.Subject);
            context.JobDetail.JobDataMap.Put("message", expectedMail.Message);

            //When
            job.Execute(context);

            //Then
            expectedMail.IsEqualTo(job.ActualMailSent);
            Assert.That(job.ActualSmtpHost, Is.EqualTo("someserver"));
        }
        public void ShouldSendMailWithMandatoryProperties()
        {
            //Given
            var expectedMail = new ExpectedMail("*****@*****.**", "*****@*****.**", "test mail", "test mail body");
            var job = new TestSendMailJob();

            var context = TestUtil.NewJobExecutionContextFor(job);
            context.JobDetail.JobDataMap.Put("smtp_host", "someserver");
            context.JobDetail.JobDataMap.Put("recipient", expectedMail.recipient);
            context.JobDetail.JobDataMap.Put("sender", expectedMail.sender);
            context.JobDetail.JobDataMap.Put("subject", expectedMail.subject);
            context.JobDetail.JobDataMap.Put("message", expectedMail.message);

            //When
            job.Execute(context);

            //Then
            expectedMail.IsEqualTo(job.actualMailSent);
            Assert.AreEqual("someserver", job.actualSmtpHost);
        }
Пример #6
0
        public void ShouldSendMailWithMandatoryProperties()
        {
            //Given
            var expectedMail = new ExpectedMail("*****@*****.**", "*****@*****.**", "test mail", "test mail body");
            var job          = new TestSendMailJob();

            var context = TestUtil.NewJobExecutionContextFor(job);

            context.JobDetail.JobDataMap.Put("smtp_host", "someserver");
            context.JobDetail.JobDataMap.Put("recipient", expectedMail.recipient);
            context.JobDetail.JobDataMap.Put("sender", expectedMail.sender);
            context.JobDetail.JobDataMap.Put("subject", expectedMail.subject);
            context.JobDetail.JobDataMap.Put("message", expectedMail.message);

            //When
            job.Execute(context);

            //Then
            expectedMail.IsEqualTo(job.actualMailSent);
            Assert.AreEqual("someserver", job.actualSmtpHost);
        }
Пример #7
0
        public void ShouldSetNetworkProperties()
        {
            //Given
            var expectedMail = new ExpectedMail("*****@*****.**", "*****@*****.**", "test mail", "test mail body");

            //optional properties
            expectedMail.ccRecipient = "*****@*****.**";
            expectedMail.replyTo = "*****@*****.**";

            var job = new TestSendMailJob();

            var context = TestUtil.NewJobExecutionContextFor(job);
            context.MergedJobDataMap.Put("smtp_host", "someserver");
            context.MergedJobDataMap.Put("recipient", expectedMail.recipient);
            context.MergedJobDataMap.Put("sender", expectedMail.sender);
            context.MergedJobDataMap.Put("subject", expectedMail.subject);
            context.MergedJobDataMap.Put("message", expectedMail.message);
            context.MergedJobDataMap.Put("smtp_username", "user 123");
            context.MergedJobDataMap.Put("smtp_password", "pass 321");
            context.MergedJobDataMap.Put("smtp_port", "123");

            //When
            job.Execute(context);

            //Then
            Assert.AreEqual("someserver", job.actualSmtpHost);
            Assert.AreEqual("user 123", job.actualSmtpUserName);
            Assert.AreEqual("pass 321", job.actualSmtpPassword);
            Assert.AreEqual(123, job.actualSmtpPort);
        }