public void TestCreateCustomNodeFrom() { //Arrange string documentDynPath = Path.Combine(TestDirectory, @"core\NodeStates.dyn"); XmlDocument xmlDoc = new XmlDocument(); XmlDocument xmlOldNodeDoc = new XmlDocument(); xmlOldNodeDoc.LoadXml("<Dynamo.Graph.Nodes.CodeBlockNodeModel type=\"Dynamo.Graph.Nodes.CodeBlockNodeModel\" x=\"203.6\" y=\"220\"/>"); XmlElement xmlOldNode = xmlOldNodeDoc.DocumentElement; XmlElement xmlResult = null; //Act if (File.Exists(documentDynPath)) { List<string> nodeInputs = new List<string>() { "input1", "input2" }; List<string> nodeOutputs = new List<string>() { "output1", "output2" }; xmlDoc.Load(documentDynPath); xmlResult = MigrationManager.CreateCustomNodeFrom(xmlDoc, xmlOldNode, "TestCodeBlock","CodeBlock1","Just creating a code block for testing functions", nodeInputs, nodeOutputs); } //Assert //Check that all the attibutes where generated correctly Assert.IsNotNull(xmlResult); Assert.AreEqual(xmlResult.ChildNodes.Item(0).Attributes.Item(0).Value, "TestCodeBlock"); Assert.AreEqual(xmlResult.ChildNodes.Item(1).Attributes.Item(0).Value, "CodeBlock1"); Assert.AreEqual(xmlResult.GetAttribute("type"), "Dynamo.Graph.Nodes.CustomNodes.Function"); }
public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data) { var migratedData = new NodeMigrationData(data.Document); XmlElement oldNode = data.MigratedNodes.ElementAt(0); var newNode = MigrationManager.CreateCustomNodeFrom(oldNode.OwnerDocument, oldNode, "1e10c22b-18f6-452c-8220-4b1407c80b7b", "BoundingBoxXYZ", "This node represents an upgrade of the 0.6.3 BoundingBoxXYZ node to 0.7.x", new List <string>() { "coordinate system", "width", "length", "height" }, new List <string>() { "bounding box" }); migratedData.AppendNode(newNode); return(migratedData); }
public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data) { var migratedData = new NodeMigrationData(data.Document); XmlElement oldNode = data.MigratedNodes.ElementAt(0); var newNode = MigrationManager.CreateCustomNodeFrom(oldNode.OwnerDocument, oldNode, "9a89dcea-3f52-48bc-ae41-b5a3ed1fd1bb", "TransformOriginVectors", "This node represents an upgrade of the 0.6.3 TransformOriginVectors node to 0.7.x", new List <string>() { "origin", "up", "forward" }, new List <string>() { "CoordinateSystem" }); migratedData.AppendNode(newNode); return(migratedData); }
public static NodeMigrationData Migrate_0630_to_0700(NodeMigrationData data) { var migratedData = new NodeMigrationData(data.Document); XmlElement oldNode = data.MigratedNodes.ElementAt(0); var newNode = MigrationManager.CreateCustomNodeFrom(oldNode.OwnerDocument, oldNode, "cc5f75c8-09a6-409c-b61d-2bf4b1b4091d", "ModelCurveFromCurveLoop", "This node represents an upgrade of the 0.6.3 ModelCurveFromCurveLoop node to 0.7.x", new List <string>() { "polyCurve" }, new List <string>() { "modelCurve" }); migratedData.AppendNode(newNode); return(migratedData); }