예제 #1
0
 // makes copy of searched
 public ActionConversion(ActionEnvironment actenv, IArgumentType resultType, Dictionary<IAction, int> searched, Aborter aborter)
 {
     this.actenv = actenv;
     this.resultType = resultType;
     this.searched = new Dictionary<IAction, int>(searched);
     this.aborter = aborter;
 }
예제 #2
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);
        }
예제 #3
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);
            }
        }