public void The_saga_should_be_created_when_an_initiating_message_is_received()
        {
            var message = new InitiateSimpleSaga(_sagaId);

            LocalBus.InboundPipeline.Dispatch(message);

            _repository.ShouldContainSaga(_sagaId).ShouldNotBeNull();
        }
        public void Should_return_an_expression_that_gets_the_correlation_value_if_matched()
        {
            Expression <Func <InitiateSimpleSaga, Guid> > exp = _builder.Build((saga, message) => saga.CorrelationId == message.CorrelationId);

            exp.ShouldNotBeNull();

            var call = exp.Compile();

            var m = new InitiateSimpleSaga(Guid.NewGuid());

            Guid value = call(m);

            value.ShouldEqual(m.CorrelationId);
        }
        public void An_exception_should_be_thrown()
        {
            var message = new InitiateSimpleSaga(_sagaId);

            LocalBus.InboundPipeline.Dispatch(message);

            try
            {
                LocalBus.InboundPipeline.Dispatch(message);
            }
            catch (SagaException sex)
            {
                Assert.AreEqual(sex.MessageType, typeof(InitiateSimpleSaga));
            }
        }