Beispiel #1
0
        public void ScanPackageDirectoryWithCheckingCertificatesEnabledWillNotLoadPackageWithAlteredCertificate()
        {
            var loader        = new PackageLoader(new[] { PackagesDirectory }, new[] { PackagesDirectorySigned });
            var libraryLoader = new ExtensionLibraryLoader(CurrentDynamoModel);

            loader.PackagesLoaded         += libraryLoader.LoadPackages;
            loader.RequestLoadNodeLibrary += libraryLoader.LoadNodeLibrary;

            var pkgDir = Path.Combine(PackagesDirectorySigned, "Modfied Signed Package");
            var pkg    = loader.ScanPackageDirectory(pkgDir, true);

            // Assert that ScanPackageDirectory returns no packages
            Assert.IsNull(pkg);
        }
Beispiel #2
0
        public void ScanPackageDirectoryReturnsPackageForValidDirectory()
        {
            var pkgDir = Path.Combine(PackagesDirectory, "Custom Rounding");
            var loader = new PackageLoader();
            var pkg    = loader.ScanPackageDirectory(pkgDir);

            Assert.IsNotNull(pkg);
            Assert.AreEqual("CAAD_RWTH", pkg.Group);
            Assert.AreEqual("Custom Rounding", pkg.Name);
            Assert.AreEqual("0.1.4", pkg.VersionName);
            Assert.AreEqual("This collection of nodes allows rounding, rounding up and rounding down to a specified precision.", pkg.Description);
            Assert.AreEqual("Round Up To Precision - Rounds a number *up* to a specified precision, Round Down To Precision - "
                            + "Rounds a number *down* to a specified precision, Round To Precision - Rounds a number to a specified precision", pkg.Contents);
            Assert.AreEqual("0.5.2.10107", pkg.EngineVersion);
            pkg.Load();
            Assert.AreEqual(3, pkg.LoadedCustomNodes.Count);
        }
Beispiel #3
0
        public void LocalizedPackageLocalizedCorrectly()
        {
            var esculture = CultureInfo.CreateSpecificCulture("es-ES");

            // Save current culture - usually "en-US"
            var currentCulture   = Thread.CurrentThread.CurrentCulture;
            var currentUICulture = Thread.CurrentThread.CurrentUICulture;

            // Set "es-ES"
            Thread.CurrentThread.CurrentCulture   = esculture;
            Thread.CurrentThread.CurrentUICulture = esculture;

            var loader        = new PackageLoader(new[] { PackagesDirectory }, new[] { string.Empty });
            var libraryLoader = new ExtensionLibraryLoader(CurrentDynamoModel);

            loader.PackagesLoaded         += libraryLoader.LoadPackages;
            loader.RequestLoadNodeLibrary += libraryLoader.LoadNodeLibrary;

            var pkgDir = Path.Combine(PackagesDirectory, "Dynamo Samples");
            var pkg    = loader.ScanPackageDirectory(pkgDir, false);

            // Assert that ScanPackageDirectory returns a package
            Assert.IsNotNull(pkg);
            loader.LoadPackages(new List <Package> {
                pkg
            });

            // Verify that the package are imported successfully
            var entries = CurrentDynamoModel.SearchModel.SearchEntries.ToList();
            var nse     = entries.Where(x => x.FullName == "SampleLibraryUI.Examples.LocalizedNode").FirstOrDefault();

            Assert.IsNotNull(nse);

            //verify that the node has the correctly localized description
            Assert.AreEqual("Un nodo de interfaz de usuario de muestra que muestra una interfaz de usuario personalizada."
                            , nse.Description);
            var node = nse.CreateNode();

            Assert.AreEqual("Un nodo de interfaz de usuario de muestra que muestra una interfaz de usuario personalizada."
                            , nse.Description);

            // Restore "en-US"
            Thread.CurrentThread.CurrentCulture   = currentCulture;
            Thread.CurrentThread.CurrentUICulture = currentUICulture;
        }
Beispiel #4
0
 public void ScanPackageDirectoryReturnsNullForInvalidDirectory()
 {
     var pkgDir = "";
     var loader = new PackageLoader();
     var pkg    = loader.ScanPackageDirectory(pkgDir);
 }