예제 #1
0
        public async Task An_initiating_message_should_start_the_saga()
        {
            Guid sagaId  = NewId.NextGuid();
            var  message = new InitiateSimpleSaga(sagaId);

            await InputQueueSendEndpoint.Send(message);

            Guid?found = await _sagaRepository.Value.ShouldContainSaga(message.CorrelationId, TestTimeout);

            found.ShouldBe(sagaId);
        }
예제 #2
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);

            Guid?found = await _sagaRepository.Value.ShouldContainSaga(message.CorrelationId, TestTimeout);

            found.ShouldBe(sagaId);

            var nextMessage = new CompleteSimpleSaga {
                CorrelationId = sagaId
            };

            await InputQueueSendEndpoint.Send(nextMessage);

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

            found.ShouldBe(sagaId);
        }
예제 #3
0
        public async Task An_observed_message_should_find_and_update_the_correct_saga()
        {
            Guid sagaId  = NewId.NextGuid();
            var  message = new InitiateSimpleSaga(sagaId)
            {
                Name = "MySimpleSaga"
            };

            await InputQueueSendEndpoint.Send(message);

            Guid?found = await _sagaRepository.Value.ShouldContainSaga(message.CorrelationId, TestTimeout);

            found.ShouldBe(sagaId);

            var nextMessage = new ObservableSagaMessage {
                Name = "MySimpleSaga"
            };

            await InputQueueSendEndpoint.Send(nextMessage);

            found = await _sagaRepository.Value.ShouldContainSaga(x => x.CorrelationId == sagaId && x.Observed, TestTimeout);

            found.ShouldBe(sagaId);
        }