Ejemplo n.º 1
0
        public void Consume_NoSagaExists_Throws()
        {
            //Arrange
            var message = new MySagaConsumingMessage(Guid.NewGuid());

            // Act
            Action act = () => sut.Consume(message);

            // Assert
            act.ShouldThrow <ArgumentException>().Which.Message.Contains("Saga with this CorrelationId does not exist");
        }
Ejemplo n.º 2
0
        public void Consume_MessageWithoutId_ThrowsException()
        {
            //Arrange
            var message = new MySagaConsumingMessage();

            // Act
            Action act = () => sut.Consume(message);

            // Assert
            act.ShouldThrow <ArgumentException>().Which.Message.Contains("CorrelationId was not provided in the message");
        }
Ejemplo n.º 3
0
        public void GetSagaTypesConsuming_Returns_MySaga()
        {
            //Arrange
            var consumedMessage = new MySagaConsumingMessage();

            // Act
            var result = NSagaReflection.GetSagaTypesConsuming(consumedMessage, typeof(NSagaReflectionTests).Assembly);

            // Assert
            result.Should().HaveCount(1).And.Contain(typeof(MySaga));
        }
Ejemplo n.º 4
0
        public void Consume_MessageConsumed_SagaPersisted()
        {
            //Arrange
            var correlationId = Guid.NewGuid();

            sut.Consume(new MySagaInitiatingMessage(correlationId));
            var message = new MySagaConsumingMessage(correlationId);

            // Act
            sut.Consume(message);

            // Assert
            var saga = repository.Find <MySaga>(correlationId);

            saga.SagaData.IsConsumingMessageReceived.Should().BeTrue();
        }
Ejemplo n.º 5
0
        public OperationResult Consume(MySagaConsumingMessage message)
        {
            SagaData.IsConsumingMessageReceived = true;

            return(new OperationResult());
        }