#17552: Allowing multiple recipient when using IMessageManager

Work Item: 17552

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2011-12-05 12:20:37 -08:00
parent dfdc3596f6
commit 1b004bbc9d
9 changed files with 119 additions and 47 deletions
@@ -0,0 +1,40 @@
using Autofac;
using Moq;
using NUnit.Framework;
using Orchard.ContentManagement.Records;
using Orchard.Messaging.Events;
using Orchard.Messaging.Services;
using Orchard.Tests.Messaging;
using Orchard.Tests.Utility;
namespace Orchard.Tests.Modules.Email {
[TestFixture]
public class EmailChannelTests {
private MessagingChannelStub _channel;
private IMessageManager _messageManager;
[SetUp]
public void Init() {
var builder = new ContainerBuilder();
builder.RegisterInstance(new Mock<IMessageEventHandler>().Object);
builder.RegisterType<DefaultMessageManager>().As<IMessageManager>();
builder.RegisterInstance(_channel = new MessagingChannelStub()).As<IMessagingChannel>();
var container = builder.Build();
_messageManager = container.Resolve<IMessageManager>();
}
[Test]
public void CanSendEmailUsingAddresses() {
_messageManager.Send(new []{ "steveb@microsoft.com" }, "test", "email");
Assert.That(_channel.Messages.Count, Is.EqualTo(1));
}
[Test]
public void OneMessageIsSentUsingMultipleRecipients() {
_messageManager.Send(new[] { "steveb@microsoft.com", "billg@microsoft.com" }, "test", "email");
Assert.That(_channel.Messages.Count, Is.EqualTo(1));
}
}
}
@@ -143,6 +143,7 @@
<ItemGroup>
<Compile Include="CodeGeneration\Commands\CodeGenerationCommandsTests.cs" />
<Compile Include="Comments\Services\CommentServiceTests.cs" />
<Compile Include="Email\EmailChannelTests.cs" />
<Compile Include="ImportExport\Services\ImportExportServiceTests.cs" />
<Compile Include="Indexing\IndexingTaskExecutorTests.cs" />
<Compile Include="Indexing\LuceneIndexProviderTests.cs" />
@@ -298,6 +299,7 @@
<EmbeddedResource Include="Recipes\Services\FoldersData\Sample1\Module.txt" />
<EmbeddedResource Include="Recipes\Services\FoldersData\Sample1\Recipes\cms.recipe.xml" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.