Exemple #1
0
        public OperationResult Consume(GetSomeConsumedErrorsForSagaWithErrors message)
        {
            this.SagaData.IsConsumed = true;
            var errors = new OperationResult("This is not right!");

            return(errors);
        }
        public void Consume_MessageWithErrors_ErrorsReturned()
        {
            //Arrange
            var correlationId = Guid.NewGuid();

            sut.Consume(new ActuallyInitiatingSagaWithErrors(correlationId));
            var message = new GetSomeConsumedErrorsForSagaWithErrors(correlationId);

            // Act
            var result = sut.Consume(message);

            // Assert
            result.Errors.Should().HaveCount(1).And.Contain("This is not right!");
        }
        public void Consume_MessageWithErrors_SagaDataNotPersisted()
        {
            //Arrange
            var correlationId = Guid.NewGuid();

            sut.Consume(new ActuallyInitiatingSagaWithErrors(correlationId));
            var message = new GetSomeConsumedErrorsForSagaWithErrors(correlationId);

            // Act
            sut.Consume(message);

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

            saga.SagaData.IsConsumed.Should().BeFalse();
        }