public async Task HandleErrorAsync_Whatever_FalseReturned()
        {
            var policy   = new StopConsumerErrorPolicy().Build(_serviceProvider);
            var envelope = new InboundEnvelope(
                "hey oh!",
                new MemoryStream(),
                null,
                new TestOffset(),
                TestConsumerEndpoint.GetDefault(),
                TestConsumerEndpoint.GetDefault().Name);

            var result = await policy.HandleErrorAsync(
                ConsumerPipelineContextHelper.CreateSubstitute(envelope, _serviceProvider),
                new InvalidOperationException("test"));

            result.Should().BeFalse();
        }
        public async Task HandleErrorAsync_Whatever_TransactionNotCommittedNorAborted()
        {
            /* The consumer will be stopped and the transaction aborted by the consumer/behavior */

            var policy   = new StopConsumerErrorPolicy().Build(_serviceProvider);
            var envelope = new InboundEnvelope(
                "hey oh!",
                new MemoryStream(Encoding.UTF8.GetBytes("hey oh!")),
                null,
                new TestOffset(),
                new TestConsumerEndpoint("source-endpoint"),
                "source-endpoint");

            var transactionManager = Substitute.For <IConsumerTransactionManager>();

            await policy.HandleErrorAsync(
                ConsumerPipelineContextHelper.CreateSubstitute(envelope, _serviceProvider, transactionManager),
                new InvalidOperationException("test"));

            await transactionManager.ReceivedWithAnyArgs(0).RollbackAsync(Arg.Any <InvalidOperationException>());
        }