1

I have this method:

public void Timeout(PaymentResponseTimeout state)
{
if (Data.PaymentResponseProcessAt > DateTime.UtcNow) return;

Bus.Send(Settings.Default.BookingAutomationQueue, new QueuePnrCmd(Data.SessionData, Data.QueueingInformation));

CloseWorkflow();
}

And I want to test if the message has been send correctly, i'm doing this with following test:

Test.Initialize();    
Test.Saga<GdsFlowService>()
    .WithExternalDependencies(s => s.Data.SessionData = TestData.GetSessionDataGds())
    .ExpectSend< QueuePnrCmd >()
    .When(s => s.Timeout(new PaymentResponseTimeout()))
    .AssertSagaCompletionIs(true);

But when doing this i get following exception:

System.Exception : ExpectedSendInvocation<Gateway.Bus.FlowCoordinator.Contracts.Command.QueuePnrCmd> not fulfilled.

When i watch the queue i see that one has been added.

Now my question is how can I check with a test that it has been send correct. I'm I forgetting to do something in the configuration maybe?

Thank you for your time.

  • Are you trying to test the client actually called the Send method, or are you testing the saga implementation? The NServiceBus.Testing framework is designed to test your handlers and saga implementations. If you want to test the client has actually sent the message you will have to do that via your existing mocking framework. – stephenl Jan 07 '14 at 23:51
  • 1
    Did you call `Test.Initialize()` ? – John Simons Jan 08 '14 at 05:09
  • I'm testing the sage implementation. And i call Test.Initialize(). With the expectSend i expect that it works the same as the ExpectTimeoutToBeSetIn, that works without a problem. Or is this a wrong assumption? – user3169442 Jan 08 '14 at 07:19

0 Answers0