User: johnsimons
Date: 2009/12/19 10:00 PM

Modified:
 /MonoRail/trunk/src/Castle.MonoRail.Framework.Tests/Services/
  EmailTemplateServiceTestCase.cs
 /MonoRail/trunk/src/Castle.MonoRail.Framework/Services/
  EmailTemplateService.cs

Log:
 Fixed 
http://groups.google.com/group/castle-project-users/browse_thread/thread/6a19f5d89973fec6/

File Changes:

Directory: /MonoRail/trunk/src/Castle.MonoRail.Framework/Services/
==================================================================

File [modified]: EmailTemplateService.cs
Delta lines: +44 -2
===================================================================

--- 
MonoRail/trunk/src/Castle.MonoRail.Framework.Tests/Services/EmailTemplateServiceTestCase.cs
 2009-12-20 04:39:37 UTC (rev 6480)
+++ 
MonoRail/trunk/src/Castle.MonoRail.Framework.Tests/Services/EmailTemplateServiceTestCase.cs
 2009-12-20 05:00:20 UTC (rev 6481)
@@ -20,7 +20,6 @@
        using Castle.Components.Common.EmailSender;
        using NUnit.Framework;
        using Rhino.Mocks;
-       using Rhino.Mocks.Constraints;
        using Test;
        using Is=Rhino.Mocks.Constraints.Is;
 
@@ -128,7 +127,7 @@
                        {
                                
Expect.Call(viewEngineManagerMock.HasTemplate("mail\\" + 
templateName)).Return(true);
 
-                               Expect.Call(delegate() { 
viewEngineManagerMock.Process(templateName, "layout", null, null); })
+                               Expect.Call(() => 
viewEngineManagerMock.Process(templateName, "layout", null, null))
                                        .Constraints(
                                                Is.Equal("mail\\" + 
templateName),
                                                Is.Equal("layout"),
@@ -153,6 +152,33 @@
                        }
                }
 
+               [Test]
+               public void 
RenderMailMessage_MessageFormatIsHtmlEvenIfHtmlTagHasAttributes()
+               {
+                       const string templateName = "welcome";
+                       Hashtable parameters = new Hashtable();
+
+                       using (mockRepository.Record())
+                       {
+                               
Expect.Call(viewEngineManagerMock.HasTemplate("mail\\" + 
templateName)).Return(true);
+
+                               Expect.Call(() => 
viewEngineManagerMock.Process(templateName, "layout", null, null))
+                                       .Constraints(
+                                               Is.Equal("mail\\" + 
templateName),
+                                               Is.Equal("layout"),
+                                               Is.Anything(),
+                                               Is.Anything())
+                                       .Do(new Render(RendersHtmlEmail));
+                       }
+
+                       using (mockRepository.Playback())
+                       {
+                               Message message = 
service.RenderMailMessage(templateName, "layout", parameters);
+
+                               Assert.AreEqual(Format.Html, message.Format);
+                       }
+               }
+
                public delegate void Render(string templateName, string 
layoutName,
                                            TextWriter output, 
IDictionary<string, object> parameters);
 
@@ -170,6 +196,22 @@
                        output.WriteLine("body");
                }
 
+               public static void RendersHtmlEmail(string templateName, string 
layoutName, TextWriter output,
+                                                                               
IDictionary<string, object> parameters)
+               {
+                       output.WriteLine("to: [email protected]");
+                       output.WriteLine("cc: [email protected]");
+                       output.WriteLine("bcc: [email protected]");
+                       output.WriteLine("from: [email protected]");
+                       output.WriteLine("reply-to: Test Reply 
<[email protected]>");
+                       output.WriteLine("subject: Hello!");
+                       output.WriteLine("X-something: Mime-super-content");
+                       output.WriteLine("<html lang=\"en-US\" 
xml:lang=\"en-US\" xmlns=\"http://www.w3.org/1999/xhtml\";>");
+                       output.WriteLine("<head>Html message test</head>");
+                       output.WriteLine("<body>This is the body</body>");
+                       output.WriteLine("</html>");
+               }
+
                private class DummyController : Controller
                {

Directory: /MonoRail/trunk/src/Castle.MonoRail.Framework.Tests/Services/
========================================================================

File [modified]: EmailTemplateServiceTestCase.cs
Delta lines: +0 -0
===================================================================

--

You received this message because you are subscribed to the Google Groups 
"Castle Project Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-commits?hl=en.


Reply via email to