public void ChangingMethodRecreatesOnlyNeededPorts()
 {
     MethodWithOneParameterCreatesOnePortWhenDefinedTwice();
     ((FunctionCallNodeModel)m_Node).MethodInfo = GetType().GetMethod(nameof(M3));
     m_Node.DefineNode();
     Assert.That(m_Node.InputsById.Count, Is.EqualTo(3));
 }
        public void MethodWithOneParameterCreatesOnePortWhenDefinedTwice()
        {
            VSGraphAssetModel asset = ScriptableObject.CreateInstance <VSGraphAssetModel>();
            VSGraphModel      g     = asset.CreateVSGraph <ClassStencil>("asd");

            m_Node = g.CreateFunctionCallNode(GetType().GetMethod(nameof(M1)), Vector2.zero);
            Assert.That(m_Node.InputsById.Count, Is.EqualTo(2));

            m_Node.DefineNode();
            Assert.That(m_Node.InputsById.Count, Is.EqualTo(2));
        }
        public void CallingDefineTwiceCreatesOneEmbeddedConstant()
        {
            VSGraphAssetModel asset = ScriptableObject.CreateInstance <VSGraphAssetModel>();
            VSGraphModel      g     = asset.CreateVSGraph <ClassStencil>("asd");

            m_Node = g.CreateNode <TestNodeModel>("test", Vector2.zero);
            Assert.That(m_Node.InputConstantsById.Count, Is.EqualTo(1));

            m_Node.DefineNode();
            Assert.That(m_Node.InputConstantsById.Count, Is.EqualTo(1));
        }
        public void CallingDefineTwiceCreatesPortsOnce()
        {
            var asset = ScriptableObject.CreateInstance <TestGraphAssetModel>();

            asset.CreateGraph("asd");
            var g = asset.GraphModel;

            m_Node = g.CreateNode <TestNodeModel>("test", Vector2.zero);
            Assert.That(m_Node.InputsById.Count, Is.EqualTo(1));

            m_Node.DefineNode();
            Assert.That(m_Node.InputsById.Count, Is.EqualTo(1));
        }