Fixing an issue with output parameters that are of type IntPtr
[castle.git] / MonoRail / Castle.MonoRail.Framework / Test / MockSmtpSender.cs
blob08c18710fb31f080199bfc7f13f602426edeb612
1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.MonoRail.Framework.Test
17 using Castle.Components.Common.EmailSender;
19 /// <summary>
20 /// Represents a mock implementation of <see cref="IEmailSender"/> for unit test purposes.
21 /// </summary>
22 public class MockSmtpSender : IEmailSender
24 private readonly MockEngineContext context;
26 /// <summary>
27 /// Initializes a new instance of the <see cref="MockSmtpSender"/> class.
28 /// </summary>
29 /// <param name="context">The context.</param>
30 public MockSmtpSender(MockEngineContext context)
32 this.context = context;
35 /// <summary>
36 /// Sends a message.
37 /// </summary>
38 /// <param name="from">From field</param>
39 /// <param name="to">To field</param>
40 /// <param name="subject">e-mail's subject</param>
41 /// <param name="messageText">message's body</param>
42 public void Send(string from, string to, string subject, string messageText)
44 Send(new Message(from, to, subject, messageText));
47 /// <summary>
48 /// Sends a message.
49 /// </summary>
50 /// <param name="message">Message instance</param>
51 public void Send(Message message)
53 context.AddEmailMessageSent(message);
56 /// <summary>
57 /// Sends multiple messages.
58 /// </summary>
59 /// <param name="messages">Array of messages</param>
60 public void Send(Message[] messages)
62 foreach(Message message in messages)
64 context.AddEmailMessageSent(message);