Exemplo n.º 1
0
        public void FakeInstance_ValidArgumentsWithDLCs_ManagerHasValidInstance()
        {
            string     name      = "testname";
            KspVersion mhVersion = KspVersion.Parse("1.1.0");
            KspVersion bgVersion = KspVersion.Parse("1.0.0");
            string     tempdir   = TestData.NewTempDir();
            KspVersion version   = KspVersion.Parse("1.7.1");

            Dictionary <CKAN.DLC.IDlcDetector, KspVersion> dlcs = new Dictionary <CKAN.DLC.IDlcDetector, KspVersion>()
            {
                { new CKAN.DLC.MakingHistoryDlcDetector(), mhVersion },
                { new CKAN.DLC.BreakingGroundDlcDetector(), bgVersion }
            };

            manager.FakeInstance(name, tempdir, version, dlcs);
            CKAN.KSP newKSP = new CKAN.KSP(tempdir, name, new NullUser());
            CKAN.DLC.MakingHistoryDlcDetector  mhDetector = new CKAN.DLC.MakingHistoryDlcDetector();
            CKAN.DLC.BreakingGroundDlcDetector bgDetector = new CKAN.DLC.BreakingGroundDlcDetector();

            Assert.IsTrue(manager.HasInstance(name));
            Assert.IsTrue(mhDetector.IsInstalled(newKSP, out string _, out UnmanagedModuleVersion detectedMhVersion));
            Assert.IsTrue(bgDetector.IsInstalled(newKSP, out string _, out UnmanagedModuleVersion detectedBgVersion));
            Assert.IsTrue(detectedMhVersion == new UnmanagedModuleVersion(mhVersion.ToString()));
            Assert.IsTrue(detectedBgVersion == new UnmanagedModuleVersion(bgVersion.ToString()));

            // Tidy up.
            CKAN.RegistryManager.Instance(newKSP).ReleaseLock();
            System.IO.Directory.Delete(tempdir, true);
        }
Exemplo n.º 2
0
        public void FakeInstance_ValidArgumentsWithDLC_ManagerHasValidInstance()
        {
            string name       = "testname";
            string dlcVersion = "1.1.0";
            string tempdir    = TestData.NewTempDir();

            CKAN.Versioning.KspVersion version = CKAN.Versioning.KspVersion.Parse("1.6.0");

            manager.FakeInstance(name, tempdir, version, dlcVersion);
            CKAN.KSP newKSP = new CKAN.KSP(tempdir, name, new NullUser());
            CKAN.DLC.MakingHistoryDlcDetector detector = new CKAN.DLC.MakingHistoryDlcDetector();

            Assert.IsTrue(manager.HasInstance(name));
            Assert.IsTrue(detector.IsInstalled(newKSP, out string _dump, out CKAN.Versioning.UnmanagedModuleVersion dlcVersionObject));
            Assert.IsTrue(dlcVersionObject.ToString().Contains(dlcVersion));

            // Tidy up.
            System.IO.Directory.Delete(tempdir, true);
        }