コード例 #1
0
        public async Task A_correlated_message_should_find_the_correct_saga()
        {
            Guid sagaId  = NewId.NextGuid();
            var  message = new InitiateSimpleSaga(sagaId);

            await InputQueueSendEndpoint.Send(message).ConfigureAwait(false);

            var found = await ExtensionMethodsForSagas.ShouldContainSaga(_sagaRepository.Value, message.CorrelationId, TestTimeout);

            found.ShouldBeTrue();

            var nextMessage = new CompleteSimpleSaga {
                CorrelationId = sagaId
            };

            await InputQueueSendEndpoint.Send(nextMessage).ConfigureAwait(false);

            found = await _sagaRepository.Value.ShouldContainSaga(sagaId, x => x.Completed, TestTimeout).ConfigureAwait(false);

            found.ShouldBeTrue();
            var retrieveRepository = _sagaRepository.Value as IRetrieveSagaFromRepository <SimpleSaga>;
            var retrieved          = await retrieveRepository.GetSaga(sagaId);

            retrieved.ShouldNotBeNull();
            retrieved.Completed.ShouldBeTrue();
        }
コード例 #2
0
        public async Task An_initiating_message_should_start_the_saga()
        {
            Guid sagaId  = NewId.NextGuid();
            var  message = new InitiateSimpleSaga(sagaId);

            await InputQueueSendEndpoint.Send(message).ConfigureAwait(false);

            var found = await ExtensionMethodsForSagas.ShouldContainSaga(_sagaRepository.Value, message.CorrelationId, TestTimeout);

            found.ShouldBeTrue();
        }