Ejemplo n.º 1
0
        public void SetValueObjectToNull()
        {
            TemplatedMailMessage email = new TemplatedMailMessage(@"Net\Mail\NoComments.tpl");

            email.Merge(new TestClass());

            email.Merge(null);
        }
Ejemplo n.º 2
0
        public void ConstructorsTest()
        {
            TemplatedMailMessage email = new TemplatedMailMessage(@"Net\Mail\NoComments.tpl", "*****@*****.**", "*****@*****.**");

            Assert.AreEqual(@"Net\Mail\NoComments.tpl", email.Content);
            Assert.AreEqual("*****@*****.**", email.From.Address);
            Assert.AreEqual(1, email.To.Count);
            Assert.AreEqual("*****@*****.**", email.To[0].Address);
        }
Ejemplo n.º 3
0
        public void MultiLineCommentsTest()
        {
            TemplatedMailMessage email = new TemplatedMailMessage(@"Net\Mail\MultiLineComments.tpl");

            email.Merge(new TestClass());

            Assert.IsNotNull(email.Body);
            Assert.IsNotEmpty(email.Body);
            Assert.AreEqual(TestClass.ExpectedContent, email.Body);
        }
Ejemplo n.º 4
0
        public void GetMergeValuesTest()
        {
            TemplatedMailMessage email = new TemplatedMailMessage(@"Net\Mail\NoComments.tpl");

            email.Subject = "Test";
            email.Merge(new TestClass());

            Assert.IsNotNull(email.GetMergeValue("FullName"));
            Assert.AreEqual("Ben Jammin", email.GetMergeValue("FullName"));
            Assert.IsNotNull(email.GetMergeValue("Link"));
            Assert.AreEqual("www.thesite.com/activate?uid=s87df87at827gf4f7g78fg34", email.GetMergeValue("Link"));
        }
Ejemplo n.º 5
0
        public void LayoutTemplateTest()
        {
            TemplatedMailMessage email = new TemplatedMailMessage(@"Net\Mail\TemplateContent.tpl");

            email.Layout = @"Net\Mail\TemplateLayout.tpl";
            email.AddTemplate("Header", "Hello {{FullName}}");
            email.AddTemplate("Footer", "Thank You,<br/><br/>The Team<br/><br/>*This is a disclaimer.");
            email.Merge(new TestClass());

            Assert.IsNotNull(email.Body);
            Assert.IsNotEmpty(email.Body);
            Assert.AreEqual(TestClass.ExpectedContentWithLayout, email.Body);
        }
Ejemplo n.º 6
0
        public void AnonymousClassValues()
        {
            TemplatedMailMessage email = new TemplatedMailMessage(@"Net\Mail\NoComments.tpl");

            email.Subject = "Test";
            email.Merge(new
            {
                FullName = "Ben Jammin",
                Link     = "www.thesite.com/activate?uid=s87df87at827gf4f7g78fg34"
            });

            Assert.IsNotNull(email.Body);
            Assert.IsNotEmpty(email.Body);
            Assert.AreEqual(TestClass.ExpectedContent, email.Body);
        }
Ejemplo n.º 7
0
        public void MemberSetTest()
        {
            TemplatedMailMessage email       = new TemplatedMailMessage(@"Net\Mail\NoComments.tpl");
            TestClass            mergeObject = new TestClass();

            email.From = new MailAddress("*****@*****.**");
            email.To.Add("*****@*****.**");

            email.Merge(mergeObject);

            Assert.AreEqual(@"Net\Mail\NoComments.tpl", email.Content);
            Assert.AreSame(mergeObject, email.MergeObject);
            Assert.IsNotNull(email.Body);
            Assert.IsNotEmpty(email.Body);
            Assert.AreEqual(TestClass.ExpectedContent, email.Body);
        }