Example #1
0
        public void Test03()
        {
            var tr = new RegistryMock(SimulateRegistry03());

            RInstallation.Registry = tr;

            string dir   = @"C:\Program Files\MRO\R-3.2.3";
            string dir64 = dir + @"\bin\x64\";
            var    fs    = Substitute.For <IFileSystem>();

            PretendRFilesAvailable(fs, dir);

            var fvi = Substitute.For <IFileVersionInfo>();

            fvi.FileMajorPart.Returns(3);
            fvi.FileMinorPart.Returns(23);
            fs.GetVersionInfo(dir64 + "R.dll").Returns(fvi);

            RInstallation.FileSystem = fs;
            var          svl  = new SupportedRVersionRange(3, 2, 3, 2);
            RInstallData data = RInstallation.GetInstallationData(null, svl);

            data.Status.Should().Be(RInstallStatus.OK);
            data.Version.Major.Should().BeGreaterOrEqualTo(3);
            data.Version.Minor.Should().BeGreaterOrEqualTo(2);
            data.Path.Should().StartWithEquivalent(@"C:\Program Files");
            data.Path.Should().Contain("R-");
            data.Version.Should().Be(new Version(3, 2, 3));
        }
Example #2
0
        public void Test04()
        {
            var tr = new RegistryMock(SimulateRegistry04());

            RInstallation.Registry = tr;
            var svl = new SupportedRVersionRange(3, 2, 3, 9);

            RInstallation.GetCompatibleEnginePathFromRegistry(svl).Should().BeNullOrEmpty();

            string dir = @"C:\Program Files\RRO\R-3.1.3";
            var    fs  = Substitute.For <IFileSystem>();
            var    fsi = Substitute.For <IFileSystemInfo>();

            fsi.Attributes.Returns(System.IO.FileAttributes.Directory);
            fsi.FullName.Returns(dir);
            fs.GetDirectoryInfo(@"C:\Program Files\RRO").EnumerateFileSystemInfos().Returns(new IFileSystemInfo[] { fsi });
            RInstallation.FileSystem = fs;

            RInstallData data = RInstallation.GetInstallationData(null, svl);

            data.Status.Should().Be(RInstallStatus.PathNotSpecified);

            PretendRFilesAvailable(fs, dir);
            data = RInstallation.GetInstallationData(dir, svl);
            data.Status.Should().Be(RInstallStatus.UnsupportedVersion);
        }
Example #3
0
        public void MsRClient()
        {
            var rClientInstallPath = @"C:\Program Files\Microsoft\R Client\";
            var rClientRPath       = @"C:\Program Files\Microsoft\R Client\R_SERVER\";
            var tr = new RegistryMock(SimulateRegistryMsRClient(rClientInstallPath, rClientRPath));

            RInstallation.Registry = tr;

            RInstallation.GetRClientPath().Should().Be(rClientRPath);

            var shell = Substitute.For <ICoreShell>();

            shell.ShowMessage(Arg.Any <string>(), Arg.Any <MessageButtons>()).Returns(MessageButtons.Yes);

            RInstallation.GetRInstallPath(null, null, shell).Should().Be(rClientRPath);
            shell.Received(1).ShowMessage(Arg.Any <string>(), Arg.Any <MessageButtons>());

            RInstallation.GetRInstallPath(null, null, shell).Should().Be(rClientRPath);
            shell.Received(1).ShowMessage(Arg.Any <string>(), Arg.Any <MessageButtons>());
        }
Example #4
0
        public void Test05()
        {
            var tr = new RegistryMock(SimulateRegistry04());

            RInstallation.Registry = tr;

            string dir = @"C:\Program Files\RRO\R-3.1.3";
            var    fs  = Substitute.For <IFileSystem>();

            PretendRFilesAvailable(fs, dir);

            var fvi = Substitute.For <IFileVersionInfo>();

            fvi.FileMajorPart.Returns(3);
            fvi.FileMinorPart.Returns(13);
            fs.GetVersionInfo(dir + "R.dll").Returns(fvi);

            RInstallation.FileSystem = fs;
            var          svl  = new SupportedRVersionRange(3, 2, 3, 2);
            RInstallData data = RInstallation.GetInstallationData(dir, svl);

            data.Status.Should().Be(RInstallStatus.UnsupportedVersion);
        }