Example #1
0
        public async Task WHEN_sagaThrowsErrorOnStart_THEN_sagaStepExceptionIsThrown()
        {
            // given
            Guid       id         = Guid.NewGuid();
            ISagaEvent startEvent = new InvalidCreatedEvent()
            {
                ID = id
            };

            // then
            await Assert.ThrowsAsync <TestSagaException>(async() =>
            {
                // when
                ISaga saga = await sagaCoordinator.
                             Publish(startEvent);
            });
        }
Example #2
0
        public async Task WHEN_sagaThrowsErrorOnStart_THEN_sagaShouldNotExists()
        {
            // given
            Guid       id         = Guid.NewGuid();
            ISagaEvent startEvent = new InvalidCreatedEvent()
            {
                ID = id
            };

            // when
            await Assert.ThrowsAsync <TestSagaException>(async() =>
            {
                ISaga saga = await sagaCoordinator.
                             Publish(startEvent);
            });

            // then
            ISaga persistedSaga = await sagaPersistance.Get(id);

            persistedSaga?.ExecutionState.IsDeleted.ShouldBeTrue();
        }