Esempio n. 1
0
        public async Task ComputeChangeSetFromModList_WithConflictingMods_ThrowsInconsistentKraken()
        {
            using (var tidy = new DisposableKSP())
            {
                var registry = Registry.Empty();
                var module   = TestData.FireSpitterModule();
                module.conflicts = new List <RelationshipDescriptor> {
                    new RelationshipDescriptor {
                        name = "kOS"
                    }
                };
                registry.AddAvailable(module);
                registry.AddAvailable(TestData.kOS_014_module());
                registry.RegisterModule(module, Enumerable.Empty <string>(), tidy.KSP);

                var mainList = new MainModList(null, null, new GUIUser());
                var mod      = new GUIMod(module, registry, tidy.KSP.Version());
                var mod2     = new GUIMod(TestData.kOS_014_module(), registry, tidy.KSP.Version());
                var mods     = new List <GUIMod>()
                {
                    mod, mod2
                };
                mainList.ConstructModList(mods, true);
                mainList.Modules      = new ReadOnlyCollection <GUIMod>(mods);
                mod2.IsInstallChecked = true;
                var computeTask = mainList.ComputeChangeSetFromModList(registry, mainList.ComputeUserChangeSet(), null,
                                                                       tidy.KSP.Version());

                await UtilStatic.Throws <InconsistentKraken>(() => computeTask);
            }
        }
Esempio n. 2
0
        public async Task ComputeChangeSetFromModList_WithConflictingMods_ThrowsInconsistentKraken()
        {
            using (var tidy = new DisposableKSP())
            {
                KSPManager manager = new KSPManager(new NullUser(), new FakeWin32Registry(tidy.KSP))
                {
                    CurrentInstance = tidy.KSP
                };

                var registry = Registry.Empty();
                var module   = TestData.FireSpitterModule();
                module.conflicts = new List <RelationshipDescriptor> {
                    new RelationshipDescriptor {
                        name = "kOS"
                    }
                };
                registry.AddAvailable(TestData.FireSpitterModule());
                registry.AddAvailable(TestData.kOS_014_module());
                registry.RegisterModule(module, Enumerable.Empty <string>(), tidy.KSP);

                var main_mod_list = new MainModList(null, null);
                var mod           = new GUIMod(TestData.FireSpitterModule(), registry, manager.CurrentInstance.Version());
                var mod2          = new GUIMod(TestData.kOS_014_module(), registry, manager.CurrentInstance.Version());
                mod.IsInstallChecked  = true;
                mod2.IsInstallChecked = true;

                var compute_change_set_from_mod_list = main_mod_list.ComputeChangeSetFromModList(registry, main_mod_list.ComputeUserChangeSet(), null, tidy.KSP.Version());
                await UtilStatic.Throws <InconsistentKraken>(async() => { await compute_change_set_from_mod_list; });
            }
        }