Esempio n. 1
0
 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);
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        public void TestActivate_NullDefinition()
        {
            AlgorithmActivator activator = new AlgorithmActivator(new TestRegistrar());

            activator.Activate(null);
        }