forked from mauroservienti/NServiceBus.IntegrationTesting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DoneSnippets.cs
38 lines (35 loc) · 1.27 KB
/
DoneSnippets.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System.Threading.Tasks;
using MyService;
using NServiceBus.AcceptanceTesting;
using NServiceBus.IntegrationTesting;
namespace DoneSnippets
{
public class When_sending_AMessage
{
public async Task AReplyMessage_is_received_and_ASaga_is_started()
{
await Scenario.Define<IntegrationScenarioContext>()
.WithEndpoint<MyServiceEndpoint>()
.WithEndpoint<MyOtherServiceEndpoint>()
// begin-snippet: simple-done-condition
.Done(ctx =>
{
return ctx.HasFailedMessages();
})
// end-snippet
.Run();
await Scenario.Define<IntegrationScenarioContext>()
.WithEndpoint<MyServiceEndpoint>()
.WithEndpoint<MyOtherServiceEndpoint>()
// begin-snippet: complete-done-condition
.Done(ctx =>
{
return ctx.SagaWasInvoked<ASaga>() || ctx.HasFailedMessages();
})
// end-snippet
.Run();
}
class MyServiceEndpoint : EndpointConfigurationBuilder{ /* omitted */ }
class MyOtherServiceEndpoint : EndpointConfigurationBuilder{ /* omited */ }
}
}