public void TestActivate_Interpreter_Exception() { AlgorithmActivator activator = new AlgorithmActivator(new InterpreterRegistrar()); AlgorithmDefinition d = new AlgorithmDefinition("Test", new Property[] { new Property("throw", typeof(double)) }); AlgorithmPlugin p = activator.Activate(d); }
public void TestActivate_NoProperties() { AlgorithmActivator activator = new AlgorithmActivator(new TestRegistrar()); AlgorithmDefinition d = new AlgorithmDefinition("Test", new Property[] {}); AlgorithmPlugin p = activator.Activate(d); Assert.IsNotNull(p); Assert.AreEqual(typeof(TestPlugin), p.GetType()); TestPlugin test = p as TestPlugin; Assert.AreEqual(1, test.Test); }
public void TestActivate_Interpreter_NoException() { AlgorithmActivator activator = new AlgorithmActivator(new InterpreterRegistrar()); AlgorithmDefinition d = new AlgorithmDefinition("Test", new Property[] { new Property("Test", typeof(double)) }); AlgorithmPlugin p = activator.Activate(d); Assert.IsNotNull(p); Assert.AreEqual(typeof(TestPluginInterpreter), p.GetType()); TestPluginInterpreter t = p as TestPluginInterpreter; Assert.IsTrue(t.DidInterpret); }
public void TestActivate_OneProperty_UnknownType() { AlgorithmActivator activator = new AlgorithmActivator(new TestRegistrar()); AlgorithmDefinition d = new AlgorithmDefinition("Test", new Property[] { new Property("Test", typeof(string)) }); AlgorithmPlugin p = activator.Activate(d); Assert.IsNotNull(p); Assert.AreEqual(typeof(TestPlugin), p.GetType()); TestPlugin t = p as TestPlugin; Assert.AreEqual(1, t.Test); }
public void TestActivate_OneProperty_KnownType() { double value = 0d; AlgorithmActivator activator = new AlgorithmActivator(new TestRegistrar()); AlgorithmDefinition d = new AlgorithmDefinition("Test", new Property[] { new Property("Test", typeof(double)) { Value = value } }); AlgorithmPlugin p = activator.Activate(d); Assert.IsNotNull(p); Assert.AreEqual(typeof(TestPlugin), p.GetType()); TestPlugin t = p as TestPlugin; Assert.AreEqual(value, t.Test); }
public void TestActivate_NullDefinition() { AlgorithmActivator activator = new AlgorithmActivator(new TestRegistrar()); activator.Activate(null); }