Beispiel #1
0
        public void ShouldCreateAndProcessTwoStepsPipeline()
        {
            PipelineProcessor        processor         = new PipelineProcessor();
            TestProcessor            testProcessor1    = new TestProcessor();
            TestProcessor            testProcessor2    = new TestProcessor();
            TestProcessor            receiverProcessor = new TestProcessor();
            ICollection <IProcessor> processors        = new List <IProcessor>();

            processors.Add(testProcessor1);
            processors.Add(testProcessor2);
            processor.RegisterProcessor(receiverProcessor);
            processor.Processors = processors;

            processor.ProcessMessage(new Message("foo"));

            testProcessor1.AutoEvent.WaitOne();
            testProcessor2.AutoEvent.WaitOne();
            receiverProcessor.AutoEvent.WaitOne();

            Assert.IsNotNull(testProcessor1.ProcessedMessage);
            Assert.AreEqual("foo", testProcessor1.ProcessedMessage.Payload);
            Assert.IsNotNull(testProcessor2.ProcessedMessage);
            Assert.AreEqual("foo", testProcessor2.ProcessedMessage.Payload);
            Assert.IsNotNull(receiverProcessor.ProcessedMessage);
            Assert.AreEqual("foo", receiverProcessor.ProcessedMessage.Payload);
        }