public void CanDiscoverDependenciesForFunctionDefinitionOpenFromFile() { var vm = Controller.DynamoViewModel; var examplePath = Path.Combine(GetTestDirectory(), @"core\custom_node_dep_test\"); string openPath = Path.Combine(examplePath, "custom_node_dep_test.dyn"); Controller.DynamoModel.Open(openPath); var funcRootNode = vm.CurrentSpace.NodeFromWorkspace <Function>("333ed3ad-c786-4064-8203-e79ce7cb109f"); var dirDeps = funcRootNode.Definition.DirectDependencies; Assert.AreEqual(2, dirDeps.Count()); var allDeps = funcRootNode.Definition.Dependencies; Assert.AreEqual(7, allDeps.Count()); var packageRoot = new PackageItemRootViewModel(funcRootNode.Definition); packageRoot.BuildDependencies(new HashSet <object>()); Assert.AreEqual(2, packageRoot.Items.Count); Assert.AreEqual(2, packageRoot.Items[0].Items.Count); Assert.AreEqual(3, packageRoot.Items[1].Items.Count); }
public void CanDiscoverDependenciesForFunctionDefinitionOpenFromFile() { var vm = controller.DynamoViewModel; var examplePath = Path.Combine(ExecutingDirectory, @"..\..\test\dynamo_elements_samples\working\custom_node_dep_test\"); Assert.IsTrue(controller.CustomNodeManager.AddFileToPath(Path.Combine(examplePath, "RootNode.dyf")) != null); Assert.IsTrue(controller.CustomNodeManager.AddFileToPath(Path.Combine(examplePath, "SecondLevelNode1.dyf")) != null); Assert.IsTrue(controller.CustomNodeManager.AddFileToPath(Path.Combine(examplePath, "SecondLevelNode2.dyf")) != null); Assert.IsTrue(controller.CustomNodeManager.AddFileToPath(Path.Combine(examplePath, "ThirdLevelCustomNodeB1.dyf")) != null); Assert.IsTrue(controller.CustomNodeManager.AddFileToPath(Path.Combine(examplePath, "ThirdLevelCustomNodeB2.dyf")) != null); Assert.IsTrue(controller.CustomNodeManager.AddFileToPath(Path.Combine(examplePath, "ThirdLevelCustomNodeB3.dyf")) != null); Assert.IsTrue(controller.CustomNodeManager.AddFileToPath(Path.Combine(examplePath, "ThirdLevelCustomNodeA1.dyf")) != null); Assert.IsTrue(controller.CustomNodeManager.AddFileToPath(Path.Combine(examplePath, "ThirdLevelCustomNodeA2.dyf")) != null); string openPath = Path.Combine(examplePath, "custom_node_dep_test.dyn"); controller.RunCommand(vm.OpenCommand, openPath); var rootNode = NodeFromCurrentSpace(vm, "333ed3ad-c786-4064-8203-e79ce7cb109f"); Assert.NotNull(rootNode); Assert.IsAssignableFrom(typeof(dynFunction), rootNode); var funcRootNode = rootNode as dynFunction; var dirDeps = funcRootNode.Definition.DirectDependencies; Assert.AreEqual(2, dirDeps.Count()); var allDeps = funcRootNode.Definition.Dependencies; Assert.AreEqual(7, allDeps.Count()); var packageRoot = new PackageItemRootViewModel(funcRootNode.Definition); packageRoot.BuildDependencies(new HashSet <object>()); Assert.AreEqual(2, packageRoot.Items.Count); Assert.AreEqual(2, packageRoot.Items[0].Items.Count); Assert.AreEqual(3, packageRoot.Items[1].Items.Count); }
public void CanDiscoverDependenciesForFunctionDefinitionOpenFromFile() { Open <HomeWorkspaceModel>(TestDirectory, @"core\custom_node_dep_test\", "custom_node_dep_test.dyn"); var funcRootNode = this.CurrentDynamoModel.CurrentWorkspace.NodeFromWorkspace <Function>("333ed3ad-c786-4064-8203-e79ce7cb109f"); var dirDeps = funcRootNode.Definition.DirectDependencies; Assert.AreEqual(2, dirDeps.Count()); var allDeps = funcRootNode.Definition.Dependencies; Assert.AreEqual(7, allDeps.Count()); var packageRoot = new PackageItemRootViewModel(funcRootNode.Definition); packageRoot.BuildDependencies(new HashSet <object>()); Assert.AreEqual(2, packageRoot.Items.Count); Assert.AreEqual(2, packageRoot.Items[0].Items.Count); Assert.AreEqual(3, packageRoot.Items[1].Items.Count); }