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_Connect_AddsNode()
 {
     var node = new MakeMessageNode();
     m_workflowBuilder.Connect(node.Pin(x => x.Input), node.Pin(x => x.Input));
     Assert.That(m_workflowBuilder.Nodes.Contains(node));
 }
        public void Test_Add_SetsGuidIfEmpty()
        {
            MakeMessageNode makeMessageNode = new MakeMessageNode();
            m_workflowBuilder.Add(makeMessageNode);

            Assert.That(makeMessageNode.Guid, Is.Not.EqualTo(Guid.Empty));
        }
        public void Test_Add_ThrowsIfGuidIsAlreadyAdded()
        {
            MakeMessageNode makeMessageNode1 = new MakeMessageNode();
            MakeMessageNode makeMessageNode2 = new MakeMessageNode();
            var newGuid = Guid.NewGuid();
            makeMessageNode1.Guid = newGuid;
            makeMessageNode2.Guid = newGuid;

            m_workflowBuilder.Add(makeMessageNode1);
            Assert.That(() => m_workflowBuilder.Add(makeMessageNode2), Throws.Exception);
        }