예제 #1
0
        public void Setup()
        {
            m_workflowBuilder = new WorkflowBuilder();
            InitializeEventReceiver receiver = new InitializeEventReceiver();
            m_simpleNode1 = new SimpleNode();
            m_simpleNode2 = new SimpleNode();
            m_simpleNode3 = new SimpleNode();
            m_workflowBuilder.Add(receiver);
            m_workflowBuilder.Add(m_simpleNode1);
            m_workflowBuilder.Add(m_simpleNode2);
            m_workflowBuilder.Add(m_simpleNode3);

            m_workflowBuilder.Connect(receiver.Pin(x => x.Fired), m_simpleNode1);
            m_workflowBuilder.Connect(m_simpleNode1.Pin(x => x.Next), m_simpleNode2);
            m_workflowBuilder.Connect(m_simpleNode2.Pin(x => x.Next), m_simpleNode3);

            m_debuggerMock = new Mock<IDebugger>();
        }
        public void Setup()
        {
            m_workflowBuilder = new WorkflowBuilder();
            m_initEvent = new InitializeEventReceiver();
            m_executionNode = new MakeMessageNode();
            m_concatFunction = new ConcatFunction();
            m_getMessage1Function = new GetMessageFunction("Hello");
            m_getMessage2Function = new GetMessageFunction("World");

            m_workflowBuilder.Add(m_initEvent);
            m_workflowBuilder.Add(m_concatFunction);
            m_workflowBuilder.Add(m_getMessage1Function);
            m_workflowBuilder.Add(m_getMessage2Function);
            m_workflowBuilder.Add(m_executionNode);

            m_workflowBuilder.Connect(m_concatFunction.Pin(x => x.First), m_getMessage1Function.Pin(x => x.Message));
            m_workflowBuilder.Connect(m_concatFunction.Pin(x => x.Second), m_getMessage2Function.Pin(x => x.Message));
            m_workflowBuilder.Connect(m_executionNode.Pin(x => x.Input), m_concatFunction.Pin(x => x.Output));
            m_workflowBuilder.Connect(m_initEvent.Pin(x => x.Fired), m_executionNode);
        }
        public void Test_PublishEvent()
        {
            var initializer = new InitializeEventReceiver();
            var publisher = new EventPublisher();

            m_builder.Add(initializer);
            m_builder.Add(publisher);

            m_builder.Connect(initializer.Pin(x => x.Fired), publisher);

            var context = m_builder.Compile();
            context.PublishEvent(new WorkflowEventData());

            context.Run();
            Assert.That(publisher.ExecutionCount, Is.EqualTo(1));

            context.Run();
            Assert.That(publisher.ExecutionCount, Is.EqualTo(2));

            context.Run();
            Assert.That(publisher.ExecutionCount, Is.EqualTo(2));
        }