mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
#17552: Allowing multiple recipient when using IMessageManager
Work Item: 17552 --HG-- branch : 1.x
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user