예제 #1
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);
        }
예제 #2
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);
        }
예제 #3
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);
        }
예제 #4
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);
        }