Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mauroservienti committed Jun 2, 2020
1 parent fe3b317 commit 6973b06
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using MyMessages.Messages;
using NServiceBus.Pipeline;
using NServiceBus.Testing;
using NUnit.Framework;
using System;
using System.Linq;
using System.Threading.Tasks;

namespace NServiceBus.IntegrationTesting.Tests
{
public class Publish_Operation_Interceptor
{
[Test]
public async Task Should_Capture_Publish_Message_Operation()
{
var scenarioContext = new IntegrationScenarioContext();
var context = new TestableOutgoingPublishContext
{
Message = new OutgoingLogicalMessage(typeof(AMessage), new AMessage())
};

var sut = new InterceptPublishOperations("fake-endpoint", scenarioContext);
await sut.Invoke(context, () => Task.CompletedTask).ConfigureAwait(false);

var operation = scenarioContext.OutgoingMessageOperations.SingleOrDefault() as PublishOperation;

Assert.AreEqual(1, scenarioContext.OutgoingMessageOperations.Count());
Assert.IsNotNull(operation);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using MyMessages.Messages;
using NServiceBus.Pipeline;
using NServiceBus.Testing;
using NUnit.Framework;
using System;
using System.Linq;
using System.Threading.Tasks;

namespace NServiceBus.IntegrationTesting.Tests
{
public class Reply_Operation_Interceptor
{
[Test]
public async Task Should_Capture_Reply_Message_Operation()
{
var scenarioContext = new IntegrationScenarioContext();
var context = new TestableOutgoingReplyContext
{
Message = new OutgoingLogicalMessage(typeof(AMessage), new AMessage())
};

var sut = new InterceptReplyOperations("fake-endpoint", scenarioContext);
await sut.Invoke(context, () => Task.CompletedTask).ConfigureAwait(false);

var operation = scenarioContext.OutgoingMessageOperations.SingleOrDefault() as ReplyOperation;

Assert.AreEqual(1, scenarioContext.OutgoingMessageOperations.Count());
Assert.IsNotNull(operation);
}
}
}

0 comments on commit 6973b06

Please sign in to comment.