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

			LocalBus.InboundPipeline.Dispatch(message);

			_repository.ShouldContainSaga(_sagaId).ShouldNotBeNull();
		}
        public void The_saga_should_be_created_when_an_initiating_message_is_received()
        {
            InitiateSimpleSaga message = new InitiateSimpleSaga(_sagaId);

            LocalBus.InboundPipeline.Dispatch(message);

            _repository.ShouldContainSaga(_sagaId);
        }
Exemple #3
0
        public async Task The_saga_should_be_created_when_an_initiating_message_is_received()
        {
            var message = new InitiateSimpleSaga(_sagaId);

            await InputQueueSendEndpoint.Send(message);

            Guid?sagaId = await _repository.ShouldContainSaga(_sagaId, TestTimeout);

            sagaId.HasValue.ShouldBe(true);
        }
        public async Task The_saga_should_be_created_when_an_initiating_message_is_received()
        {
            var message = new InitiateSimpleSaga(_sagaId);

            await InputQueueSendEndpoint.Send(message);

            Guid? sagaId = await _repository.ShouldContainSaga(_sagaId, TestTimeout);

            sagaId.HasValue.ShouldBe(true);
        }
        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.ShouldNotBe(null);

            Func<InitiateSimpleSaga, Guid> call = exp.Compile();

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

            Guid value = call(m);

            value.ShouldBe(m.CorrelationId);
        }
        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()
        {
            InitiateSimpleSaga message = new InitiateSimpleSaga(_sagaId);

            LocalBus.InboundPipeline.Dispatch(message);

            try
            {
                LocalBus.InboundPipeline.Dispatch(message);
            }
            catch (SagaException sex)
            {
                Assert.AreEqual(sex.MessageType, typeof(InitiateSimpleSaga));
            }
        }
Exemple #8
0
        public async Task The_message_should_fault()
        {
            Task <ConsumeContext <Fault <InitiateSimpleSaga> > > faulted = SubscribeHandler <Fault <InitiateSimpleSaga> >();

            var message = new InitiateSimpleSaga(_sagaId);

            await InputQueueSendEndpoint.Send(message);

            Guid?sagaId = await _repository.ShouldContainSaga(_sagaId, TestTimeout);

            sagaId.HasValue.ShouldBe(true);

            await InputQueueSendEndpoint.Send(message);

            await faulted;
        }
Exemple #9
0
        public async Task An_exception_should_be_thrown()
        {
            var message = new InitiateSimpleSaga(_sagaId);

            await BusSendEndpoint.Send(message);


            try
            {
                await BusSendEndpoint.Send(message);
            }
            catch (SagaException sex)
            {
                Assert.AreEqual(sex.MessageType, typeof(InitiateSimpleSaga));
            }
        }
        public void A_correlated_message_should_find_the_correct_saga()
        {
            var repository = new NHibernateSagaRepository<TestSaga>(_sessionFactory);
            var ping = new PingMessage(_sagaId);

            var initiatePolicy = new InitiatingSagaPolicy<TestSaga, InitiateSimpleSaga>(x => x.CorrelationId, x => false);

            var message = new InitiateSimpleSaga(_sagaId);
            IConsumeContext<InitiateSimpleSaga> context = message.ToConsumeContext();

            repository.GetSaga(context, message.CorrelationId, GetHandlers, initiatePolicy)
                .Each(x => x(context));

            List<TestSaga> sagas = repository.Where(x => x.CorrelationId == _sagaId).ToList();

            Assert.AreEqual(1, sagas.Count);
            Assert.IsNotNull(sagas[0]);
            Assert.AreEqual(_sagaId, sagas[0].CorrelationId);
        }
        public async Task The_message_should_fault()
        {
            Task<ConsumeContext<Fault<InitiateSimpleSaga>>> faulted = SubscribeHandler<Fault<InitiateSimpleSaga>>();

            var message = new InitiateSimpleSaga(_sagaId);

            await InputQueueSendEndpoint.Send(message);

            Guid? sagaId = await _repository.ShouldContainSaga(_sagaId, TestTimeout);

            sagaId.HasValue.ShouldBe(true);

            await InputQueueSendEndpoint.Send(message);

            await faulted;
        }
        public async Task An_exception_should_be_thrown()
        {
            var message = new InitiateSimpleSaga(_sagaId);

            await BusSendEndpoint.Send(message);


            try
            {
                await BusSendEndpoint.Send(message);
            }
            catch (SagaException sex)
            {
                Assert.AreEqual(sex.MessageType, typeof(InitiateSimpleSaga));
            }
        }
		public void An_exception_should_be_thrown()
		{
			InitiateSimpleSaga message = new InitiateSimpleSaga(_sagaId);

			LocalBus.InboundPipeline.Dispatch(message);

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