Example #1
0
        public async Task RunAsync_EventIsNotOfGivenType_ThrowsArgumentOutOfRange()
        {
            // Arrange
            var sagaStepAdapter = CreateSagaStepAdapter();
            var sagaEvent       = new SagaEvent02();

            // Assert
            await Assert
            .ThrowsAsync <ArgumentOutOfRangeException>(() => sagaStepAdapter.RunAsync(sagaEvent))
            .ConfigureAwait(false);
        }
Example #2
0
        public void IsResponsible_EventTypeNotEqualPredicateReturnsTrue_ReturnFalse()
        {
            // Arrange
            var sagaStepConfiguration = new SagaStepConfiguration <SagaEvent01, SagaStep01Mock>(new SagaVersion("1.0.0"), 1, _ => true);
            var sagaEvent             = new SagaEvent02();

            // Act
            var result = sagaStepConfiguration.IsResponsible(sagaEvent);

            // Assert
            Assert.False(result);
        }
Example #3
0
        public void Create_RefsNullOneStepWithDifferentEvent_ThrowInvalidOperation()
        {
            // Arrange
            var func      = new SagaStepResolver().Create();
            var sagaEvent = new SagaEvent02();

            var configurations = new List <ISagaStepConfiguration>
            {
                new SagaStepConfiguration <SagaEvent01, SagaStep01Mock>(new SagaVersion("1.0.0"), 0, _ => false)
            };

            // Assert
            Assert.Throws <InvalidOperationException>(() => func(sagaEvent, null, configurations));
        }