Exemplo n.º 1
0
        public void EventDispatcher_Publish()
        {
            var handler = new Mock <IInputHandler <Message> >();

            handler.Setup(exp => exp.ProcessInput(It.IsAny <Message>())).Returns(() => new Event("pipeline", SimpleData.From("test")));

            var server = new Mock <IProcessingServer>();

            server.Setup(exp => exp.GetHandler <Message>("pipeline")).Returns(handler.Object);

            var dispatcher = new EventDispatcher(server.Object);

            dispatcher.Process("pipeline", new Message());

            server.Verify(exp => exp.Publish(It.Is <Event>(e => e.PipelineId == "pipeline")), Times.Once);
        }