Ejemplo n.º 1
0
        public void Run()
        {
            Console.WriteLine("Running tests...");

            ActionEnvironment actenv = new ActionEnvironment (this);
            actenv.AddAction (new String2Numeric ());
            actenv.AddAction (new PlusHandler ());

            ArgumentTree sumargs = new ArgumentTree ();
            sumargs.Add("one", (double) 3);
            sumargs.Add("two", "5");

            object result = actenv.ImmediateConvertTo (sumargs, PlusHandler.SummationResultType, 10, 1000);
            Assert.AreEqual(result, 8.0);
        }
Ejemplo n.º 2
0
        public void Run(string[] argv)
        {
            ActionEnvironment actenv = new ActionEnvironment (this);
            actenv.AddAction (new String2Numeric ());
            actenv.AddAction (new String2Enumerable ());
            actenv.AddAction (new Summation ());
            actenv.AddAction (new Numeric2String ());
            actenv.AddAction (new Enumerable2NumericEnumerable ());

            object result = actenv.ImmediateConvertTo (argv, new StringArgumentType(1000, ".+", "result"), 10, 1000);
            if (result is Exception) {
                Console.WriteLine (((Exception)result).Message);
                Console.WriteLine (((Exception)result).StackTrace);
            } else {
                Console.WriteLine (result);
            }
        }