Esempio n. 1
0
        public void RequirementLayerOptionals()
        {
            Guid id_plugin1 = new Guid("{12A9FCC0-ECDC-4049-8DBF-8961E49A9EDE}");
            Guid id_plugin2 = new Guid("{E64F17D5-DCAB-4A07-8CEE-901A87D8295E}");

            TestBase.CopyPluginToTestDir("ServiceA.dll");
            TestBase.CopyPluginToTestDir("ServiceB.dll");

            PluginRunner.Discoverer.Discover(TestBase.TestFolderDir, true);

            RequirementLayer layer = new RequirementLayer("MyLayer");

            PluginRunner.Add(layer);

            Assert.That(!PluginRunner.IsDirty, "Not dirty because the layer is empty");

            layer.PluginRequirements.AddOrSet(id_plugin1, RunningRequirement.Optional);
            layer.PluginRequirements.AddOrSet(id_plugin2, RunningRequirement.Optional);
            Assert.That(!PluginRunner.IsDirty, "Not dirty because plugin's are optional ... so we have nothing to change.");

            Assert.IsTrue(PluginRunner.Remove(layer));
            Assert.That(PluginRunner.RunnerRequirements.Count, Is.EqualTo(0));

            Assert.That(!PluginRunner.IsDirty, "Not dirty because the PluginRunner doesn't contains any requirement");
        }
Esempio n. 2
0
        public void LiveUserConfigOptional()
        {
            Guid id_plugin1 = new Guid("{12A9FCC0-ECDC-4049-8DBF-8961E49A9EDE}");
            Guid id_plugin2 = new Guid("{E64F17D5-DCAB-4A07-8CEE-901A87D8295E}");

            TestBase.CopyPluginToTestDir("ServiceA.dll");
            TestBase.CopyPluginToTestDir("ServiceB.dll");

            PluginRunner.Discoverer.Discover(TestBase.TestFolderDir, true);

            RequirementLayer layer = new RequirementLayer("MyLayer");

            PluginRunner.Add(layer);

            Assert.That(!PluginRunner.IsDirty, "Not dirty because the layer is empty");

            layer.PluginRequirements.AddOrSet(id_plugin1, RunningRequirement.Optional);
            Assert.That(!PluginRunner.IsDirty, "Still not dirty because plugin's are optional ... so we have nothing to change.");

            ConfigManager.UserConfiguration.LiveUserConfiguration.SetAction(id_plugin2, ConfigUserAction.None);
            Assert.That(!PluginRunner.IsDirty);

            Assert.IsTrue(PluginRunner.Remove(layer));
            Assert.That(PluginRunner.RunnerRequirements.Count, Is.EqualTo(0));

            Assert.That(!PluginRunner.IsDirty, "Not dirty because of the live user");
        }
Esempio n. 3
0
        public void SimpleWithoutDiscoverer()
        {
            Guid id = Guid.NewGuid();

            RequirementLayer layer = new RequirementLayer("MyLayer");

            PluginRunner.Add(layer);

            Assert.That(!PluginRunner.IsDirty, "Not dirty because the layer is empty");

            layer.PluginRequirements.AddOrSet(id, RunningRequirement.MustExistAndRun);
            Assert.That(!PluginRunner.IsDirty, "Not dirty since the plugin is not found in the discoverer: it is Disabled.");
            PluginRunner.Remove(layer);
            Assert.That(!PluginRunner.IsDirty, "Not dirty because the PluginRunner doesn't contains any requirement");
        }
Esempio n. 4
0
        public void SimpleRequirementLayer()
        {
            Guid id = new Guid("{12A9FCC0-ECDC-4049-8DBF-8961E49A9EDE}");

            TestBase.CopyPluginToTestDir("ServiceA.dll");

            PluginRunner.Discoverer.Discover(TestBase.TestFolderDir, true);

            RequirementLayer layer = new RequirementLayer("MyLayer");

            PluginRunner.Add(layer);

            Assert.That(!PluginRunner.IsDirty, "Not dirty because the layer is empty");

            layer.PluginRequirements.AddOrSet(id, RunningRequirement.MustExistAndRun);
            Assert.That(PluginRunner.IsDirty, "Dirty because the plugin has been found in the discoverer.");

            Assert.IsTrue(PluginRunner.Remove(layer));
            Assert.That(PluginRunner.RunnerRequirements.Count, Is.EqualTo(0));

            Assert.That(!PluginRunner.IsDirty, "Not dirty because the PluginRunner doesn't contains any requirement");
        }