Ejemplo n.º 1
0
        public void ShouldCallAddedInterceptorsOnProduce()
        {
            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.OnProduce(sourceMessage)).Return(firstMessage);
            second.Expect(x => x.OnProduce(firstMessage)).Return(secondMessage);

            var compositeInterceptor = new CompositeInterceptor();
            compositeInterceptor.Add(first);
            compositeInterceptor.Add(second);
            Assert.AreEqual(secondMessage, compositeInterceptor.OnProduce(sourceMessage));
        }
Ejemplo n.º 2
0
 public InterceptorRegistrator(IServiceRegister serviceRegister)
 {
     this.serviceRegister = serviceRegister;
     compositeInterceptor = new CompositeInterceptor();
 }