Esempio n. 1
0
        static void Main(string[] args)
        {
            List <int> A = new List <int>();

            A.Add(1); A.Add(3); A.Add(2); A.Add(4); A.Add(0); A.Add(6);
            Comparator compHelper = new Comparator1();
            Evaluator  evalHelper = new Evaluator1();
            MyQuery    query      = new MyQuery();

            List <object> res = query.Select(ConvertToObjectArray(A), evalHelper, compHelper);

            for (int i = 0; i < res.Count; i++)
            {
                Console.Write(res[i].ToString() + " ");
            }
        }
Esempio n. 2
0
        public void PartialExpressionEvaluator_NotSupported()
        {
            var eval = new Evaluator1();

            var es = new Expression[]
            {
                Expression.Block(Expression.Constant(1)),
                Expression.DebugInfo(Expression.SymbolDocument("foo.cs"), 1, 2, 3, 4),
                Expression.Dynamic(Microsoft.CSharp.RuntimeBinder.Binder.Convert(CSharpBinderFlags.None, typeof(int), typeof(Tests)), typeof(int), Expression.Constant("foo")),
                Expression.Goto(Expression.Label()),
                Expression.Label(Expression.Label()),
                Expression.Loop(Expression.Empty()),
                Expression.RuntimeVariables(Expression.Parameter(typeof(int))),
                Expression.Switch(Expression.Constant(1), Expression.SwitchCase(Expression.Empty(), Expression.Constant(1))),
                Expression.TryFinally(Expression.Empty(), Expression.Empty()),
                new MyNode(),
            };

            foreach (var e in es)
            {
                Assert.ThrowsException <NotSupportedException>(() => eval.Reduce(e));
            }
        }