public void GetOwnerPackageReturnsPackageForValidFunctionDefinition() { var loader = new PackageLoader(PackagesDirectory); loader.RequestLoadCustomNodeDirectory += (dir, pkgInfo) => this.CurrentDynamoModel.CustomNodeManager.AddUninitializedCustomNodesInPath(dir, true, pkgInfo); loader.LoadAll(new LoadPackageParams { Preferences = this.CurrentDynamoModel.PreferenceSettings }); var pkg = loader.LocalPackages.FirstOrDefault(x => x.Name == "Custom Rounding"); Assert.AreEqual(3, pkg.LoadedCustomNodes.Count); foreach (var nodeInfo in pkg.LoadedCustomNodes) { CustomNodeDefinition funcDef; Assert.IsTrue(this.CurrentDynamoModel.CustomNodeManager.TryGetFunctionDefinition(nodeInfo.FunctionId, true, out funcDef)); Assert.IsNotNull(funcDef); var foundPkg = loader.GetOwnerPackage(nodeInfo); Assert.IsNotNull(foundPkg); Assert.AreEqual(pkg.Name, foundPkg.Name); Assert.IsTrue(pkg.Name == foundPkg.Name); } }
public void GetOwnerPackageReturnsPackageForValidFunctionDefinition() { //Assert.Inconclusive("Porting : Formula"); var loader = new PackageLoader(PackagesDirectory); loader.LoadPackagesIntoDynamo(new LoadPackageParams { Preferences = ViewModel.Model.PreferenceSettings, LibraryServices = ViewModel.Model.LibraryServices, Loader = ViewModel.Model.Loader, Context = ViewModel.Model.Context, IsTestMode = true, CustomNodeManager = ViewModel.Model.CustomNodeManager }); var pkg = loader.LocalPackages.FirstOrDefault(x => x.Name == "Custom Rounding"); Assert.AreEqual(3, pkg.LoadedCustomNodes.Count); foreach (var nodeInfo in pkg.LoadedCustomNodes) { CustomNodeDefinition funcDef; Assert.IsTrue(ViewModel.Model.CustomNodeManager.TryGetFunctionDefinition(nodeInfo.FunctionId, true, out funcDef)); Assert.IsNotNull(funcDef); var foundPkg = loader.GetOwnerPackage(nodeInfo); Assert.IsNotNull(foundPkg); Assert.AreEqual(pkg.Name, foundPkg.Name); Assert.IsTrue(pkg.Name == foundPkg.Name); } }
public void GetOwnerPackageReturnsNullForInvalidFunction() { var loader = new PackageLoader(PackagesDirectory); var info = dynSettings.CustomNodeManager.AddFileToPath( Path.Combine(new string[] { GetTestDirectory(), "core", "combine", "combine2.dyf" })); var funcDef = dynSettings.CustomNodeManager.GetFunctionDefinition(info.Guid); Assert.IsNotNull(funcDef); var foundPkg = loader.GetOwnerPackage(funcDef); Assert.IsNull(foundPkg); }
public void GetOwnerPackageReturnsNullForInvalidFunction() { var loader = new PackageLoader(PackagesDirectory); CustomNodeInfo info; Assert.IsTrue( this.CurrentDynamoModel.CustomNodeManager.AddUninitializedCustomNode( Path.Combine(new string[] { TestDirectory, "core", "combine", "combine2.dyf" }), true, out info)); CustomNodeDefinition funcDef; Assert.IsTrue(this.CurrentDynamoModel.CustomNodeManager.TryGetFunctionDefinition(info.FunctionId, true, out funcDef)); var foundPkg = loader.GetOwnerPackage(info); Assert.IsNull(foundPkg); }
public void GetOwnerPackageReturnsPackageForValidFunctionDefinition() { var loader = new PackageLoader(PackagesDirectory); loader.LoadPackages(); var pkg = loader.LocalPackages.FirstOrDefault(x => x.Name == "Custom Rounding"); Assert.AreEqual(3, pkg.LoadedCustomNodes.Count); foreach (var nodeInfo in pkg.LoadedCustomNodes) { var funcDef = dynSettings.CustomNodeManager.GetFunctionDefinition(nodeInfo.Guid); Assert.IsNotNull(funcDef); var foundPkg = loader.GetOwnerPackage(funcDef); Assert.IsNotNull(foundPkg); Assert.AreEqual(pkg.Name, foundPkg.Name); Assert.IsTrue(pkg.Name == foundPkg.Name); } }
public void GetOwnerPackageReturnsPackageForValidFunctionDefinition() { //Assert.Inconclusive("Porting : Formula"); var loader = new PackageLoader(ViewModel.Model.Loader, ViewModel.Model.Logger, PackagesDirectory); loader.LoadPackagesIntoDynamo(ViewModel.Model.PreferenceSettings, ViewModel.Model.EngineController.LibraryServices); var pkg = loader.LocalPackages.FirstOrDefault(x => x.Name == "Custom Rounding"); Assert.AreEqual(3, pkg.LoadedCustomNodes.Count); foreach (var nodeInfo in pkg.LoadedCustomNodes) { var funcDef = ViewModel.Model.CustomNodeManager.GetFunctionDefinition(nodeInfo.Guid); Assert.IsNotNull(funcDef); var foundPkg = loader.GetOwnerPackage(funcDef); Assert.IsNotNull(foundPkg); Assert.AreEqual(pkg.Name, foundPkg.Name); Assert.IsTrue(pkg.Name == foundPkg.Name); } }
public void GetOwnerPackageReturnsPackageForValidFunctionDefinition() { var loader = new PackageLoader(PackagesDirectory); loader.RequestLoadCustomNodeDirectory += (dir) => this.CurrentDynamoModel.CustomNodeManager.AddUninitializedCustomNodesInPath(dir, true); loader.LoadAll(new LoadPackageParams { Preferences = this.CurrentDynamoModel.PreferenceSettings }); var pkg = loader.LocalPackages.FirstOrDefault(x => x.Name == "Custom Rounding"); Assert.AreEqual(3, pkg.LoadedCustomNodes.Count); foreach (var nodeInfo in pkg.LoadedCustomNodes) { CustomNodeDefinition funcDef; Assert.IsTrue(this.CurrentDynamoModel.CustomNodeManager.TryGetFunctionDefinition(nodeInfo.FunctionId, true, out funcDef)); Assert.IsNotNull(funcDef); var foundPkg = loader.GetOwnerPackage(nodeInfo); Assert.IsNotNull(foundPkg); Assert.AreEqual(pkg.Name, foundPkg.Name); Assert.IsTrue(pkg.Name == foundPkg.Name); } }