Exemplo n.º 1
0
        public async Task BuildPackageIndexTest()
        {
            string[] packageNames =
            {
                "base",
                "boot",
                "class",
                "cluster",
                "codetools",
                "compiler",
                "datasets",
                "foreign",
                "graphics",
                "grDevices",
                "grid",
                "KernSmooth",
                "lattice",
                "MASS",
                "Matrix",
                "methods",
                "mgcv",
                "nlme",
                "nnet",
                "parallel",
                "rpart",
                "spatial",
                "splines",
                "stats",
                "stats4",
                "survival",
                "tcltk",
                "tools",
                "translations",
                "utils",
            };

            IPackageIndex packageIndex;

            using (var host = new IntelliSenseRSession(_coreShell, _workflowProvider)) {
                await host.StartSessionAsync();

                var functionIndex = new FunctionIndex(_coreShell, null, host);
                packageIndex = new PackageIndex(_workflowProvider, _coreShell, host, functionIndex);
                await packageIndex.BuildIndexAsync();
            }

            foreach (var name in packageNames)
            {
                IPackageInfo pi = await packageIndex.GetPackageInfoAsync(name);

                pi.Should().NotBeNull();
                pi.Name.Should().Be(name);
            }
        }
Exemplo n.º 2
0
        public void BuildPackageIndexTest()
        {
            IEnumerable <IPackageInfo> basePackages = PackageIndex.BasePackages.AsList();

            string[] packageNames =
            {
                "base",
                "boot",
                "class",
                "cluster",
                "codetools",
                "compiler",
                "datasets",
                "foreign",
                "graphics",
                "grDevices",
                "grid",
                "KernSmooth",
                "lattice",
                "MASS",
                "Matrix",
                "methods",
                "mgcv",
                "nlme",
                "nnet",
                "parallel",
                "rpart",
                "spatial",
                "splines",
                "stats",
                "stats4",
                "survival",
                "tcltk",
                "tools",
                "translations",
                "utils",
            };

            string installPath = Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
                @"R\R-3.2.2\library");

            foreach (var name in packageNames)
            {
                IPackageInfo info = basePackages.FirstOrDefault(x => x.Name == name);
                info.Should().NotBeNull();

                IPackageInfo pi1 = PackageIndex.GetPackageByName(info.Name);
                pi1.Should().NotBeNull();

                pi1.Name.Should().Be(info.Name);
            }
        }