public void ConfigurationLoading() { using (PA.Plugin.Components.Controls.PluginLoader loader = new PA.Plugin.Components.Controls.PluginLoader()) { loader.BeginInit(); loader.Configuration = new IniConfigurationSource(); loader.Parent = this; loader.EndInit(); Assert.AreEqual("Correct", this.ValueToTest, "String", "String Parsing"); Assert.AreEqual(new Uri("http://www.google.fr"), this.UrlToTest, "Url Parsing"); Assert.AreEqual(typeof(PluginForUriHttp), this.PluginForUri.GetType(), "Object selection & init"); Assert.AreEqual(new Uri("http://www.google.fr"), this.PluginForUri.Value, "plugin selection Parsing"); Assert.AreEqual(1, this.ManyPluginToLoad1.Count(), "TestSection/Many Plugin Loading"); Assert.IsInstanceOf<PluginForSpecificArrayTest>(this.ManyPluginToLoad1.ElementAt(0).Value); Assert.AreEqual("OKMANY1", (this.ManyPluginToLoad1.ElementAt(0).Value as PluginForSpecificArrayTest).Parameter); Assert.AreEqual(1, this.ManyPluginToLoad2.Count(), "TestLoader/ManyPluginToLoad Plugin Loading"); Assert.IsInstanceOf<IPlugin>(this.ManyPluginToLoad2.ElementAt(0).Value); Assert.AreEqual(0, this.ManyPluginToLoad3.Count(), "TestSection/Many {PluginForGenericArrayTest} Plugin Loading"); Assert.AreEqual(1, this.ManyPluginToLoad4.Count(), "TestSection/Many {PluginForSpecificArrayTest} Plugin Loading"); Assert.IsInstanceOf<PluginForSpecificArrayTest>(this.ManyPluginToLoad4.ElementAt(0).Value); Assert.AreEqual("OKMANY1", (this.ManyPluginToLoad4.ElementAt(0).Value as PluginForSpecificArrayTest).Parameter); Assert.AreEqual(2, this.ManyPluginToLoad5.Count(), "Default Plugin Loading with Interface"); Assert.IsInstanceOf<IPlugin>(this.ManyPluginToLoad5.ElementAt(0)); Assert.AreEqual(1, this.ManyPluginToLoad6.Count(), "Default Plugin Loading with Class"); Assert.IsInstanceOf<PluginForSpecificImportTest>(this.ManyPluginToLoad6.ElementAt(0)); Assert.AreEqual(3, this.ManyPluginToLoad6.ElementAt(0).Parameter.Length); Assert.IsInstanceOf<PluginForSpecificImportTest>(this.GenericPluginToTest); Assert.IsInstanceOf<PluginForSpecificImportTest>(this.SpecificPluginToTest); Assert.IsInstanceOf<IPlugin>(this.GenericArrayToTest); Assert.IsInstanceOf<PluginForSpecificArrayTest>(this.SpecificArrayToTest); Assert.AreEqual("OKSINGLE", this.SpecificArrayToTest.Parameter); } }
public void Attributes() { Assert.AreEqual("DESC", PluginManager.GetAttribute<PluginDescriptionAttribute>(typeof(PluginForSpecificImportTest)).Description); using (PA.Plugin.Components.Controls.PluginLoader loader = new PA.Plugin.Components.Controls.PluginLoader()) { loader.BeginInit(); loader.Configuration = new IniConfigurationSource(); loader.Parent = this; loader.EndInit(); Assert.AreEqual("DESC", PluginManager.GetAttribute<PluginDescriptionAttribute>(this.SpecificPluginToTest).Description); Assert.AreEqual("DESC", this.SpecificPluginToTest.GetDescription()); } }
//[TestMethod] public void LoadingUnloading() { using (PA.Plugin.Components.Controls.PluginLoader loader = new PA.Plugin.Components.Controls.PluginLoader()) { loader.BeginInit(); loader.Configuration = new IniConfigurationSource(); loader.Parent = this; loader.EndInit(); Assert.AreEqual(1, this.ManyPluginToLoad2.Count(), "TestLoader/ManyPluginToLoad Plugin Loading"); Assert.IsInstanceOf<IPlugin>(this.ManyPluginToLoad2.ElementAt(0).Value); loader.BeginEdit(); Assert.AreEqual(1, this.ManyPluginToLoad2.Count(), "TestLoader/ManyPluginToLoad Plugin Loading"); Assert.IsInstanceOf<IPlugin>(this.ManyPluginToLoad2.ElementAt(0).Value); loader.Location = @"c:\"; try { loader.EndEdit(); Assert.Fail(); } catch { //Assert.AreEqual(1, this.ManyPluginToLoad2.Count(), "TestLoader/ManyPluginToLoad Plugin Loading"); } loader.Location = null; loader.EndEdit(); } }