public void Should_throw_validation_exception()
    {
        if (!MsSqlMicrosoftDataClientConnectionBuilder.IsSql2016OrHigher())
        {
            return;
        }
        var exception = Assert.ThrowsAsync <Exception>(async() =>
                                                       await Scenario.Define <Context>()
                                                       .WithEndpoint <SagaEndpoint>(b => b
                                                                                    .When(session =>
        {
            var startSagaMessage = new StartSagaMessage
            {
                Property = "Test"
            };
            return(session.SendLocal(startSagaMessage));
        }))
                                                       .Done(c => c.StartSagaFinderUsed)
                                                       .Run());

        Assert.AreEqual("The saga 'When_correlation_property_is_not_mapped+SagaEndpoint+TestSaga' defines a correlation property 'Property' which is not mapped to any message. Either map it or remove it from the saga definition.", exception.Message);
    }
Exemplo n.º 2
0
    public async Task Should_correlate_the_following_message_correctly()
    {
        if (!MsSqlMicrosoftDataClientConnectionBuilder.IsSql2016OrHigher())
        {
            return;
        }
        var context = await Scenario.Define <Context>()
                      .WithEndpoint <SagaEndpoint>(b => b
                                                   .When(session =>
        {
            var startSagaMessage = new StartSagaMessage
            {
                Property = "Test"
            };
            return(session.SendLocal(startSagaMessage));
        }))
                      .Done(c => c.HandledOtherMessage)
                      .Run()
                      .ConfigureAwait(false);

        Assert.True(context.StartSagaFinderUsed);
    }