public void ShouldCallAddedInterceptorsOnConsume()
        {
            var sourceMessage = new ConsumedMessage(null, new MessageProperties(), new byte[0]);
            var firstMessage  = new ConsumedMessage(null, new MessageProperties(), new byte[0]);
            var secondMessage = new ConsumedMessage(null, new MessageProperties(), new byte[0]);

            var first  = Substitute.For <IProduceConsumeInterceptor>();
            var second = Substitute.For <IProduceConsumeInterceptor>();

            first.OnConsume(secondMessage).Returns(firstMessage);
            second.OnConsume(sourceMessage).Returns(secondMessage);

            var compositeInterceptor = new CompositeInterceptor();

            compositeInterceptor.Add(first);
            compositeInterceptor.Add(second);
            Assert.Equal(firstMessage, compositeInterceptor.OnConsume(sourceMessage));
        }
        public void ShouldCallAddedInterceptorsOnConsume()
        {
            var sourceMessage = new RawMessage(new MessageProperties(), new byte[0]);
            var firstMessage  = new RawMessage(new MessageProperties(), new byte[0]);
            var secondMessage = new RawMessage(new MessageProperties(), new byte[0]);


            var first = NewMock <IProduceConsumeInterceptor>();

            var second = NewMock <IProduceConsumeInterceptor>();

            first.Expect(x => x.OnConsume(secondMessage)).Return(firstMessage);
            second.Expect(x => x.OnConsume(sourceMessage)).Return(secondMessage);

            var compositeInterceptor = new CompositeInterceptor();

            compositeInterceptor.Add(first);
            compositeInterceptor.Add(second);
            Assert.AreEqual(firstMessage, compositeInterceptor.OnConsume(sourceMessage));
        }