User: johnsimons
Date: 2009/12/11 10:57 PM

Removed:
 /Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender.Tests/
  AssemblyInfo.cs, SmtpSenderCreateMessageTest.cs
 /Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender/
  AssemblyInfo.cs, Message.cs, MessageAttachment.cs, 
MessageAttachmentCollection.cs
 /Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender/Mock/

Modified:
 /Components/EmailSender/trunk/
  default.build
 /Components/EmailSender/trunk/src/
  Changes.txt
 /Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender.Tests/
  Castle.Components.Common.EmailSender.Tests.csproj
 /Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender/
  Castle.Components.Common.EmailSender-vs2008.csproj, IEmailSender.cs
 /Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender/Smtp/
  SmtpSender.cs

Log:
 Now that v1.1.0 of EmailSender is out, it is time to do the changes proposed 
in:
 http://support.castleproject.org/projects/COMP/issues/view/COMP-ISSUE-90
 So I'm committing these changes and making a major release of the EmailSender 
Component soon.
 If your project is dependant on EmailSender and you would like to upgrade to 
this release, let me know if you need any help.

File Changes:

Directory: 
/Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender/
==================================================================================

File [removed]: AssemblyInfo.cs
Delta lines: +0 -11
===================================================================

--- 
Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender/Castle.Components.Common.EmailSender-vs2008.csproj
    2009-12-12 05:25:05 UTC (rev 6404)
+++ 
Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender/Castle.Components.Common.EmailSender-vs2008.csproj
    2009-12-12 05:57:40 UTC (rev 6405)
@@ -106,17 +106,6 @@
     <Compile Include="IEmailSender.cs">
       <SubType>Code</SubType>
     </Compile>
-    <Compile Include="Message.cs">
-      <SubType>Code</SubType>
-    </Compile>
-    <Compile Include="MessageAttachment.cs">
-      <SubType>Code</SubType>
-    </Compile>
-    <Compile Include="MessageAttachmentCollection.cs">
-      <SubType>Code</SubType>
-    </Compile>
-    <Compile Include="Mock\StubEmailSender.cs" />
-    <Compile Include="AssemblyInfo.cs" />
     <Compile Include="Smtp\SmtpSender.cs" />
   </ItemGroup>

File [modified]: Castle.Components.Common.EmailSender-vs2008.csproj
Delta lines: +3 -2
===================================================================

--- 
Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender/IEmailSender.cs
       2009-12-12 05:25:05 UTC (rev 6404)
+++ 
Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender/IEmailSender.cs
       2009-12-12 05:57:40 UTC (rev 6405)
@@ -15,6 +15,7 @@
 namespace Castle.Components.Common.EmailSender
 {
        using System;
+       using System.Net.Mail;
 
        /// <summary>
        /// Abstracts an approach to send e-mails
@@ -34,12 +35,12 @@
                /// Sends a message. 
                /// </summary>
                /// <param name="message">Message instance</param>
-               void Send(Message message);
+               void Send(MailMessage message);
 
                /// <summary>
                /// Sends multiple messages. 
                /// </summary>
                /// <param name="messages">Array of messages</param>
-               void Send(Message[] messages);
+               void Send(MailMessage[] messages);
        }

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

--- 
Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender/Message.cs
    2009-12-12 05:25:05 UTC (rev 6404)
+++ 
Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender/Message.cs
    2009-12-12 05:57:40 UTC (rev 6405)
@@ -1,240 +0,0 @@
-// Copyright 2004-2009 Castle Project - http://www.castleproject.org/
-// 
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-namespace Castle.Components.Common.EmailSender
-{
-       using System;
-       using System.Collections.Generic;
-       using System.Net.Mail;
-       using System.Runtime.Serialization;
-       using System.Text;
-       using System.Collections;
-       using System.Collections.Specialized;
-
-       /// <summary>
-       /// Message formats
-       /// </summary>
-       [Serializable]
-       public enum Format
-       {
-               /// <summary>
-               /// The body is composed of html content
-               /// </summary>
-               Html,
-               /// <summary>
-               /// The body is pure text
-               /// </summary>
-               Text
-       }
-
-       /// <summary>
-       /// Message priority
-       /// </summary>
-       [Serializable]
-       public enum MessagePriority
-       {
-               Normal,
-               High,
-               Low
-       }
-
-       /// <summary>
-       /// Abstracts an e-mail message
-       /// </summary>
-       [Serializable]
-       public class Message : ISerializable
-       {
-               private String to;
-               private String from;
-               private String cc;
-               private String bcc;
-               private String body;
-               private String subject;
-               private MailAddress replyTo;
-               private Format format = Format.Text;
-               private Encoding encoding = Encoding.ASCII;
-               private MessagePriority priority = MessagePriority.Normal;
-               private readonly IDictionary headers = new HybridDictionary();
-               private readonly IDictionary fields = new HybridDictionary();
-               private readonly MessageAttachmentCollection attachments = new 
MessageAttachmentCollection();
-               private readonly IDictionary<string, LinkedResource> 
linkedResources = new Dictionary<string, LinkedResource>();
-
-               /// <summary>
-               /// Initializes a new instance of the <see cref="Message"/> 
class.
-               /// </summary>
-               public Message()
-               {
-               }
-
-               /// <summary>
-               /// Initializes a new instance of the <see cref="Message"/> 
class.
-               /// </summary>
-               /// <param name="from">From header.</param>
-               /// <param name="to">To header.</param>
-               /// <param name="subject">The subject header.</param>
-               /// <param name="body">The message body.</param>
-               public Message(string from, string to, string subject, string 
body)
-               {
-                       this.to = to;
-                       this.from = from;
-                       this.body = body;
-                       this.subject = subject;
-               }
-
-               public Message(SerializationInfo info, StreamingContext context)
-               {
-                       to = info.GetString("to");
-                       from = info.GetString("from");
-                       cc = info.GetString("cc");
-                       bcc = info.GetString("bcc");
-                       body = info.GetString("body");
-                       subject = info.GetString("subject");
-
-                       bool hasReplyTo = info.GetBoolean("hasReplyTo");
-
-                       if (hasReplyTo)
-                       {
-                               replyTo = new 
MailAddress(info.GetString(replyTo.Address), 
info.GetString("replyTo.DisplayName"));
-                       }
-
-                       format = (Format) info.GetValue("format", typeof 
(Format));
-                       encoding = (Encoding) info.GetValue("encoding", typeof 
(Encoding));
-                       priority = (MessagePriority) info.GetValue("priority", 
typeof (MessagePriority));
-
-                       headers = (IDictionary) info.GetValue("headers", typeof 
(IDictionary));
-                       fields = (IDictionary) info.GetValue("fields", typeof 
(IDictionary));
-
-                       attachments = (MessageAttachmentCollection) 
info.GetValue("attachments", typeof (MessageAttachmentCollection));
-                       linkedResources =
-                               (IDictionary<string, LinkedResource>) 
info.GetValue("linkedResources", typeof (IDictionary<string, LinkedResource>));
-               }
-
-               public String To
-               {
-                       get { return to; }
-                       set { to = value; }
-               }
-
-               public String From
-               {
-                       get { return from; }
-                       set { from = value; }
-               }
-
-               public String Cc
-               {
-                       get { return cc; }
-                       set { cc = value; }
-               }
-
-               public String Bcc
-               {
-                       get { return bcc; }
-                       set { bcc = value; }
-               }
-
-               public String Body
-               {
-                       get { return body; }
-                       set { body = value; }
-               }
-
-               public String Subject
-               {
-                       get { return subject; }
-                       set { subject = value; }
-               }
-
-               public MailAddress ReplyTo
-               {
-                       get { return replyTo; }
-                       set { replyTo = value; }
-               }
-
-               public Format Format
-               {
-                       get { return format; }
-                       set { format = value; }
-               }
-
-               public Encoding Encoding
-               {
-                       get { return encoding; }
-                       set { encoding = value; }
-               }
-
-               public MessagePriority Priority
-               {
-                       get { return priority; }
-                       set { priority = value; }
-               }
-
-               public IDictionary Headers
-               {
-                       get { return headers; }
-               }
-
-               public IDictionary Fields
-               {
-                       get { return fields; }
-               }
-
-               public MessageAttachmentCollection Attachments
-               {
-                       get { return attachments; }
-               }
-
-               /// <summary>
-               /// You can add any number of inline attachments to this mail 
message. Inline attachments 
-               /// differ from normal attachments in that they can be 
displayed withing the email body, 
-               /// which makes this very handy for displaying images that can 
be viewed without having to 
-               /// access an external server. 
-               /// Provide an unique identifier (id) and use it with a &lt;img 
src="cid:my_id" /> tag from 
-               /// within your view code.
-               /// </summary>
-               public IDictionary<string, LinkedResource> Resources
-               {
-                       get { return linkedResources; }
-               }
-
-               public void GetObjectData(SerializationInfo info, 
StreamingContext context)
-               {
-            info.AddValue("to", to);
-                       info.AddValue("from", from);
-                       info.AddValue("cc", cc);
-                       info.AddValue("bcc", bcc);
-                       info.AddValue("body", body);
-                       info.AddValue("subject", subject);
-
-                       bool hasReplyTo = replyTo != null;
-
-                       info.AddValue("hasReplyTo", hasReplyTo);
-
-                       if (hasReplyTo)
-                       {
-                               info.AddValue("replyTo.Address", 
replyTo.Address);
-                               info.AddValue("replyTo.DisplayName", 
replyTo.DisplayName);                      
-                       }
-
-                       info.AddValue("format", format);
-                       info.AddValue("encoding", encoding);
-                       info.AddValue("priority", priority);
-
-                       info.AddValue("headers", headers);
-                       info.AddValue("fields", fields);
-                       info.AddValue("attachments", attachments);
-                       info.AddValue("linkedResources", linkedResources);
-               }
-       }

File [removed]: Message.cs
Delta lines: +0 -116
===================================================================

--- 
Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender/MessageAttachment.cs
  2009-12-12 05:25:05 UTC (rev 6404)
+++ 
Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender/MessageAttachment.cs
  2009-12-12 05:57:40 UTC (rev 6405)
@@ -1,117 +0,0 @@
-// Copyright 2004-2009 Castle Project - http://www.castleproject.org/
-// 
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-namespace Castle.Components.Common.EmailSender
-{
-       using System;
-       using System.IO;
-       
-       public enum AttachmentEncoding
-       {
-               Base64,
-               UUEncode
-       }
-       
-       /// <summary>
-       /// Represents a file attachment
-       /// </summary>
-       [Serializable]
-       public class MessageAttachment
-       {
-               private String fileName;
-               private readonly String mediaType;
-               private readonly Stream stream;
-
-               /// <summary>
-               /// Creates a new attachment
-               /// </summary>
-               public MessageAttachment()
-               {
-               }
-
-               /// <summary>
-               /// Creates a new attachment
-               /// </summary>
-               /// <param name="mediaType">Look at 
System.Net.Mimie.MediaTypeNames for help.</param>
-               /// <param name="fileName">Path to the file.</param>
-               public MessageAttachment(String mediaType, String fileName)
-               {
-                       this.mediaType = mediaType;
-
-                       if (fileName == null) throw new 
ArgumentNullException("fileName");
-
-                       FileInfo info = new FileInfo(fileName);
-
-                       if (!info.Exists) throw new ArgumentException("The 
specified file does not exists", "fileName");
-
-                       this.fileName = fileName;
-               }
-
-               /// <summary>
-               /// Creates a new attachment
-               /// </summary>
-               /// <param name="mediaType">Look at 
System.Net.Mime.MediaTypeNames for help.</param>
-               /// <param name="stream">File stream.</param>
-               public MessageAttachment(String mediaType, Stream stream)
-               {
-                       this.mediaType = mediaType;
-
-                       if (stream == null)
-                       {
-                               throw new ArgumentNullException("stream");
-                       }
-
-                       this.stream = stream;
-               }
-
-               /// <summary>
-               /// Initializes a new instance of the <see 
cref="MessageAttachment"/> class.
-               /// </summary>
-               /// <param name="fileName">Name of the file.</param>
-               /// <param name="mediaType">Type of the media.</param>
-               /// <param name="stream">The stream.</param>
-               public MessageAttachment(string fileName, string mediaType, 
Stream stream) : this(mediaType, stream)
-               {
-                       this.fileName = fileName;
-               }
-
-               /// <summary>
-               /// Gets the name of the file.
-               /// </summary>
-               /// <value>The name of the file.</value>
-               public String FileName
-               {
-                       get { return fileName; }
-                       set { fileName = value; }
-               }
-               
-               /// <summary>
-               /// Gets the type of the media.
-               /// </summary>
-               /// <value>The type of the media.</value>
-               public String MediaType
-               {
-                       get { return mediaType; }
-               }
-
-               /// <summary>
-               /// Gets the stream.
-               /// </summary>
-               /// <value>The stream.</value>
-               public Stream Stream
-               {
-                       get { return stream; }
-               }
-       }

File [removed]: MessageAttachment.cs
Delta lines: +0 -27
===================================================================

--- 
Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender/MessageAttachmentCollection.cs
        2009-12-12 05:25:05 UTC (rev 6404)
+++ 
Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender/MessageAttachmentCollection.cs
        2009-12-12 05:57:40 UTC (rev 6405)
@@ -1,28 +0,0 @@
-// Copyright 2004-2009 Castle Project - http://www.castleproject.org/
-// 
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-namespace Castle.Components.Common.EmailSender
-{
-       using System;
-       using System.Collections;
-
-       [Serializable]
-       public class MessageAttachmentCollection : CollectionBase
-       {
-               public void Add(MessageAttachment attachment)
-               {
-                       InnerList.Add(attachment);
-               }
-       }

File [removed]: MessageAttachmentCollection.cs
Delta lines: +19 -86
===================================================================

--- 
Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender/Smtp/SmtpSender.cs
    2009-12-12 05:25:05 UTC (rev 6404)
+++ 
Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender/Smtp/SmtpSender.cs
    2009-12-12 05:57:40 UTC (rev 6405)
@@ -15,7 +15,6 @@
 namespace Castle.Components.Common.EmailSender.Smtp
 {
        using System;
-       using System.Collections;
        using System.ComponentModel;
        using System.Net;
        using System.Net.Mail;
@@ -31,7 +30,7 @@
                private readonly string hostname;
                private int port = 25;
                private int? timeout;
-               private bool useSSL;
+               private bool useSsl;
                private readonly NetworkCredential credentials = new 
NetworkCredential();
 
                /// <summary>
@@ -88,10 +87,10 @@
                /// a secure communication channel.
                /// </summary>
                /// <value><c>true</c> if should use SSL; otherwise, 
<c>false</c>.</value>
-               public bool UseSSL
+               public bool UseSsl
                {
-                       get { return useSSL; }
-                       set { useSSL = value; }
+                       get { return useSsl; }
+                       set { useSsl = value; }
                }
 
                /// <summary>
@@ -109,7 +108,7 @@
                        if (subject == null) throw new 
ArgumentNullException("subject");
                        if (messageText == null) throw new 
ArgumentNullException("messageText");
 
-                       Send(new Message(from, to, subject, messageText));
+                       Send(new MailMessage(from, to, subject, messageText));
                }
 
                /// <summary>
@@ -117,7 +116,7 @@
                /// </summary>
                /// <exception cref="ArgumentNullException">If the message is 
null</exception>
                /// <param name="message">Message instance</param>
-               public void Send(Message message)
+               public void Send(MailMessage message)
                {
                        if (message == null) throw new 
ArgumentNullException("message");
 
@@ -131,105 +130,39 @@
                                SmtpClient smtpClient = new 
SmtpClient(hostname, port);
                                Configure(smtpClient);
 
-                               MailMessage msg = CreateMailMessage(message);
                                Guid msgGuid = new Guid();
                                SendCompletedEventHandler sceh = null;
                                sceh = delegate(object sender, 
AsyncCompletedEventArgs e)
-                                       {
-                                               if (msgGuid == 
(Guid)e.UserState)
-                                                       msg.Dispose();
-                                               // The handler itself, cannot 
be null, test omitted
-                                               smtpClient.SendCompleted -= 
sceh;
-                                       };
+                               {
+                                       if (msgGuid == (Guid)e.UserState)
+                                               message.Dispose();
+                                       // The handler itself, cannot be null, 
test omitted
+                                       smtpClient.SendCompleted -= sceh;
+                               };
                                smtpClient.SendCompleted += sceh;
-                               smtpClient.SendAsync(msg, msgGuid);
+                               smtpClient.SendAsync(message, msgGuid);
                        }
                        else
                        {
-                               using (MailMessage msg = 
CreateMailMessage(message))
+                               using (message)
                                {
                                        SmtpClient smtpClient = new 
SmtpClient(hostname, port);
                                        Configure(smtpClient);
 
-                                       smtpClient.Send(msg);
+                                       smtpClient.Send(message);
                                }
                        }
                }
 
-               public void Send(Message[] messages)
+               public void Send(MailMessage[] messages)
                {
-                       foreach (Message message in messages)
+                       foreach (MailMessage message in messages)
                        {
                                Send(message);
                        }
                }
 
                /// <summary>
-               /// Converts a message from 
Castle.Components.Common.EmailSender.Message  type
-               /// to System.Net.Mail.MailMessage
-               /// </summary>
-               /// <param name="message">The message to convert.</param>
-               /// <returns>The converted message .</returns>
-               public MailMessage CreateMailMessage(Message message)
-               {
-                       MailMessage mailMessage = new MailMessage(message.From, 
message.To.Replace(';', ','));
-
-                       if (!String.IsNullOrEmpty(message.Cc))
-                       {
-                               mailMessage.CC.Add(message.Cc.Replace(';', 
','));
-                       }
-
-                       if (!String.IsNullOrEmpty(message.Bcc))
-                       {
-                               mailMessage.Bcc.Add(message.Bcc.Replace(';', 
','));
-                       }
-
-                       mailMessage.Subject = message.Subject;
-                       mailMessage.Body = message.Body;
-                       mailMessage.BodyEncoding = message.Encoding;
-                       mailMessage.IsBodyHtml = (message.Format == 
Format.Html);
-                       mailMessage.Priority = 
(MailPriority)Enum.Parse(typeof(MailPriority), message.Priority.ToString());
-                       mailMessage.ReplyTo = message.ReplyTo;
-
-                       foreach (DictionaryEntry entry in message.Headers)
-                       {
-                               mailMessage.Headers.Add((string)entry.Key, 
(string)entry.Value);
-                       }
-
-                       foreach (MessageAttachment attachment in 
message.Attachments)
-                       {
-                               Attachment mailAttach;
-
-                               if (attachment.Stream != null)
-                               {
-                                       mailAttach = new 
Attachment(attachment.Stream, attachment.FileName, attachment.MediaType);
-                               }
-                               else
-                               {
-                                       mailAttach = new 
Attachment(attachment.FileName, attachment.MediaType);
-                               }
-
-                               mailMessage.Attachments.Add(mailAttach);
-                       }
-
-                       if (message.Resources != null && 
message.Resources.Count > 0)
-                       {
-                               AlternateView htmlView = 
AlternateView.CreateAlternateViewFromString(message.Body, message.Encoding, 
"text/html");
-                               foreach (string id in message.Resources.Keys)
-                               {
-                                       LinkedResource r = 
message.Resources[id];
-                                       r.ContentId = id;
-                                       if (r.ContentStream != null)
-                                       {
-                                               htmlView.LinkedResources.Add(r);
-                                       }
-                               }
-                               mailMessage.AlternateViews.Add(htmlView);
-                       }
-                       return mailMessage;
-               }
-
-               /// <summary>
                /// Gets or sets the domain.
                /// </summary>
                /// <value>The domain.</value>
@@ -279,9 +212,9 @@
                                smtpClient.Timeout = timeout.Value;
                        }
 
-                       if (useSSL)
+                       if (useSsl)
                        {
-                               smtpClient.EnableSsl = useSSL;
+                               smtpClient.EnableSsl = useSsl;
                        }
                }

Directory: 
/Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender.Tests/
========================================================================================

File [removed]: AssemblyInfo.cs
Delta lines: +0 -4
===================================================================

--- 
Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender.Tests/Castle.Components.Common.EmailSender.Tests.csproj
       2009-12-12 05:25:05 UTC (rev 6404)
+++ 
Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender.Tests/Castle.Components.Common.EmailSender.Tests.csproj
       2009-12-12 05:57:40 UTC (rev 6405)
@@ -42,10 +42,6 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="AssemblyInfo.cs" />
-    <Compile Include="SmtpSenderCreateMessageTest.cs" />
-  </ItemGroup>
-  <ItemGroup>
     <ProjectReference 
Include="..\Castle.Components.Common.EmailSender\Castle.Components.Common.EmailSender-vs2008.csproj">
       <Project>{CFF1D57F-9FEB-4941-B8FE-8E28F4A8AAC7}</Project>

File [modified]: Castle.Components.Common.EmailSender.Tests.csproj
Delta lines: +0 -161
===================================================================

--- 
Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender.Tests/SmtpSenderCreateMessageTest.cs
  2009-12-12 05:25:05 UTC (rev 6404)
+++ 
Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender.Tests/SmtpSenderCreateMessageTest.cs
  2009-12-12 05:57:40 UTC (rev 6405)
@@ -1,161 +0,0 @@
-// Copyright 2004-2009 Castle Project - http://www.castleproject.org/
-// 
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-namespace Castle.Components.Common.EmailSender.Tests
-{
-       using System.IO;
-       using System.Net.Mail;
-       using System.Text;
-       using NUnit.Framework;
-       using Smtp;
-
-       [TestFixture]
-       public class SmtpSenderCreateMessageTest
-       {
-               private SmtpSender smtpSender;
-               private readonly string attachmentFilename = 
Path.GetTempFileName();
-
-               [SetUp]
-               public void TestSetup()
-               {
-                       smtpSender = new SmtpSender("localhost");
-                       File.WriteAllText(attachmentFilename, "Test Data");
-               }
-
-               [TearDown]
-               public void TestCleanup()
-               {
-                       if (File.Exists(attachmentFilename))
-                       {
-                               File.Delete(attachmentFilename);
-                       }
-               }
-
-               [Test]
-               public void 
Ensure_CreateMessage_assigns_correct_mime_type_to_attachments_when_supplied_with_data_stream()
-               {
-                       Message msg = new Message("[email protected]", 
"[email protected]", "subject", "body");
-                       msg.Attachments.Add(new 
MessageAttachment("Attachment.txt", "text/plain", GetTestData()));
-
-                       using (MailMessage mailMsg = 
smtpSender.CreateMailMessage(msg))
-                       {
-                               Assert.AreEqual(1, mailMsg.Attachments.Count, 
"Attachment count doesn't match");
-                               Assert.AreEqual("text/plain", 
mailMsg.Attachments[0].ContentType.MediaType);
-                       }
-               }
-
-               [Test]
-               public void 
Ensure_CreateMessage_supplies_correct_filename_to_attachments_when_supplied_with_data_stream()
-               {
-                       Message msg = new Message("[email protected]", 
"[email protected]", "subject", "body");
-                       msg.Attachments.Add(new 
MessageAttachment("Attachment.txt", "text/plain", GetTestData()));
-
-                       using (MailMessage mailMsg = 
smtpSender.CreateMailMessage(msg))
-                       {
-                               Assert.AreEqual(1, mailMsg.Attachments.Count, 
"Attachment count doesn't match");
-                               Assert.AreEqual("Attachment.txt", 
mailMsg.Attachments[0].Name);
-                       }
-               }
-
-               [Test]
-               public void 
Ensure_CreateMessage_assigns_correct_mime_type_to_attachments_when_supplied_with_filename()
-               {
-                       Message msg = new Message("[email protected]", 
"[email protected]", "subject", "body");
-                       msg.Attachments.Add(new MessageAttachment("text/plain", 
attachmentFilename));
-
-                       using (MailMessage mailMsg = 
smtpSender.CreateMailMessage(msg))
-                       {
-                               Assert.AreEqual(1, mailMsg.Attachments.Count, 
"Attachment count doesn't match");
-                               Assert.AreEqual("text/plain", 
mailMsg.Attachments[0].ContentType.MediaType);
-                       }
-               }
-
-               [Test]
-               public void 
Ensure_CreateMessage_supplies_correct_filename_to_attachments_when_supplied_with_filename()
-               {
-                       Message msg = new Message("[email protected]", 
"[email protected]", "subject", "body");
-                       msg.Attachments.Add(new MessageAttachment("text/plain", 
attachmentFilename));
-
-                       using (MailMessage mailMsg = 
smtpSender.CreateMailMessage(msg))
-                       {
-                               Assert.AreEqual(1, mailMsg.Attachments.Count, 
"Attachment count doesn't match");
-                               
Assert.AreEqual(Path.GetFileName(attachmentFilename), 
mailMsg.Attachments[0].Name);
-                       }
-               }
-
-               [Test]
-               public void 
Ensure_CreateMessage_supplies_correct_bcc_to_message_when_bcc_is_delimited()
-               {
-                       Message msg = new Message("[email protected]", 
"[email protected]", "subject", "body")
-                       {
-                               Bcc = "[email protected];[email protected]"
-                       };
-
-                       using (MailMessage mailMsg = 
smtpSender.CreateMailMessage(msg))
-                       {
-                               Assert.AreEqual(2, mailMsg.Bcc.Count, "Bcc 
parse count doesn't match");
-                       }
-               }
-
-               [Test]
-               public void 
Ensure_CreateMessage_supplies_correct_cc_to_message_when_cc_is_delimited()
-               {
-                       Message msg = new Message("[email protected]", 
"[email protected]", "subject", "body")
-                       {
-                               Cc = "[email protected];[email protected]"
-                       };
-
-                       using (MailMessage mailMsg = 
smtpSender.CreateMailMessage(msg))
-                       {
-                               Assert.AreEqual(2, mailMsg.CC.Count, "Cc parse 
count doesn't match");
-                       }
-               }
-
-               [Test]
-               public void 
Ensure_CreateMessage_supplies_correct_cc_to_message_when_cc_is_not_delimited()
-               {
-                       Message msg = new Message("[email protected]", 
"[email protected]", "subject", "body")
-                       {
-                               Cc = "[email protected]"
-                       };
-
-                       using (MailMessage mailMsg = 
smtpSender.CreateMailMessage(msg))
-                       {
-                               Assert.AreEqual(1, mailMsg.CC.Count, "Cc parse 
count doesn't match");
-                               Assert.AreEqual(new 
MailAddress("[email protected]"), mailMsg.CC[0], "Cc set doesn't match");
-                       }
-               }
-
-               [Test]
-               public void 
Ensure_CreateMessage_supplies_correct_bcc_to_message_when_bcc_is_not_delimited()
-               {
-                       Message msg = new Message("[email protected]", 
"[email protected]", "subject", "body")
-                       {
-                               Bcc = "[email protected]"
-                       };
-
-                       using (MailMessage mailMsg = 
smtpSender.CreateMailMessage(msg))
-                       {
-                               Assert.AreEqual(1, mailMsg.Bcc.Count, "Bcc 
parse count doesn't match");
-                               Assert.AreEqual(new 
MailAddress("[email protected]"), mailMsg.Bcc[0], "Bcc set doesn't match");
-                       }
-               }
-
-               private static Stream GetTestData()
-               {
-                       byte[] b = Encoding.ASCII.GetBytes("Test Data");
-                       return new MemoryStream(b);
-               }
-       }
-}

File [removed]: SmtpSenderCreateMessageTest.cs
Delta lines: +10 -0
===================================================================

--- Components/EmailSender/trunk/src/Changes.txt        2009-12-12 05:25:05 UTC 
(rev 6404)
+++ Components/EmailSender/trunk/src/Changes.txt        2009-12-12 05:57:40 UTC 
(rev 6405)
@@ -1,5 +1,15 @@
+2.0
+---
+
+- Renamed SmtpSender UseSSL propetry to UseSsl
+- Removed Message, MassageAttachment and MessageAttachmentCollection and 
replaced them with the equivalent .Net classes, MailMessage, Attachment and 
AttachmentCollection.
+- Removed StubEmailSender, not of much use, preference is to use a mocking 
framework like RhinoMocks instead.
+- Removed SmtpSenderCreateMessageTest, not relevant anymore.
+
+
 1.1
 ---
+
 - Applied patch by Steve Bering, with changes by John Simons. COMP-ISSUE-88 - 
Patch for SmtpSender to enable multiple CC and BCC recipients
 - Applied patch by Bryan Brown, with changes by John Simons. COMP-ISSUE-34 - 
Error sending mail when using Mono 2.0

Directory: 
/Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender/Smtp/
=======================================================================================

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

--- 
Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender.Tests/AssemblyInfo.cs
 2009-12-12 05:25:05 UTC (rev 6404)
+++ 
Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender.Tests/AssemblyInfo.cs
 2009-12-12 05:57:40 UTC (rev 6405)
@@ -1,29 +0,0 @@
-// Copyright 2004-2009 Castle Project - http://www.castleproject.org/
-//  
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// 
-using System;
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-[assembly: CLSCompliant(true)]
-[assembly: ComVisible(false)]
-[assembly: AssemblyTitle("Castle.Components.Common.EmailSender.Tests for 
Microsoft .NET Framework 3.5")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyCompany("Castle Project")]
-[assembly: AssemblyProduct("Castle.Components.Common.EmailSender.Tests")]
-[assembly: AssemblyCopyright("Castle Project, original author or authors")]
-[assembly: AssemblyInformationalVersion("1.1.0.0")]
-[assembly: AssemblyVersion("1.1.0.0")]
-[assembly: AssemblyFileVersion("1.1.0.0")]
-[assembly: AssemblyDelaySign(false)]

Directory: /Components/EmailSender/trunk/src/
=============================================

File [modified]: Changes.txt
Delta lines: +0 -0
===================================================================

Directory: /Components/EmailSender/trunk/
=========================================

File [modified]: default.build
Delta lines: +0 -29
===================================================================

--- 
Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender/AssemblyInfo.cs
       2009-12-12 05:25:05 UTC (rev 6404)
+++ 
Components/EmailSender/trunk/src/Castle.Components.Common.EmailSender/AssemblyInfo.cs
       2009-12-12 05:57:40 UTC (rev 6405)
@@ -1,29 +0,0 @@
-// Copyright 2004-2009 Castle Project - http://www.castleproject.org/
-//  
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// 
-//     http://www.apache.org/licenses/LICENSE-2.0
-// 
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// 
-using System;
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-[assembly: CLSCompliant(true)]
-[assembly: ComVisible(false)]
-[assembly: AssemblyTitle("Castle.Components.Common.EmailSender for Microsoft 
.NET Framework 3.5")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyCompany("Castle Project")]
-[assembly: AssemblyProduct("Castle.Components.Common.EmailSender")]
-[assembly: AssemblyCopyright("Castle Project, original author or authors")]
-[assembly: AssemblyInformationalVersion("1.1.0.0")]
-[assembly: AssemblyVersion("1.1.0.0")]
-[assembly: AssemblyFileVersion("1.1.0.0")]
-[assembly: AssemblyDelaySign(false)]

--

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