public void TestGenericConfiguratorParams1() { IPluginConfigurator plugin1 = new GenericPluginConfigurator <TestPlugin1>(); Assert.AreEqual(0, plugin1.GetParameters().Count()); plugin1.SetParameterValues(plugin1.GetParameters()); Assert.IsInstanceOf <TestPlugin1>(plugin1.CreatePlugin()); }
public void TestGenericConfiguratorParams2() { IPluginConfigurator plugin2 = new GenericPluginConfigurator <TestPlugin2>(); var parameters = plugin2.GetParameters(); Assert.AreEqual(5, parameters.Count()); //string one, int two, decimal three, bool four, double five TestParam(parameters.ElementAt(0), "one", "String", false); TestParam(parameters.ElementAt(1), "two", "Int32", false); TestParam(parameters.ElementAt(2), "three", "Decimal", false); TestParam(parameters.ElementAt(3), "four", "Boolean", false); TestParam(parameters.ElementAt(4), "five", "Double", false); plugin2.SetParameterValues(null); Assert.IsInstanceOf <TestPlugin2>(plugin2.CreatePlugin()); }
public void TestGenericConfiguratorParams3() { IPluginConfigurator plugin2 = new GenericPluginConfigurator <TestPlugin2>(); var parameters = plugin2.GetParameters(); //string one, int two, decimal three, bool four, double five parameters.ElementAt(0).SetValue("string"); parameters.ElementAt(1).SetValue("2"); parameters.ElementAt(2).SetValue("3.45"); parameters.ElementAt(3).SetValue("true"); parameters.ElementAt(4).SetValue("4.567"); plugin2.SetParameterValues(parameters); Assert.IsInstanceOf <TestPlugin2>(plugin2.CreatePlugin()); TestPlugin2 plugin = plugin2.CreatePlugin() as TestPlugin2; Assert.AreEqual("string", plugin.One); Assert.AreEqual(2, plugin.Two); Assert.AreEqual(3.45m, plugin.Three); Assert.AreEqual(true, plugin.Four); Assert.AreEqual(4.567d, plugin.Five); }