예제 #1
0
        public void TestForNonArray()
        {
            var          gc = new GeneratedCode();
            var          cc = new CodeContext();
            IQuerySource s  = new DummyQueryReference()
            {
                ItemName = "q", ItemType = typeof(int)
            };

            ArrayExpressionParser.ParseArrayExpression(s, Expression.Variable(typeof(int), "d"), gc, cc, MEFUtilities.MEFContainer);
        }
예제 #2
0
        public void TestRunForNormalArray()
        {
            var          gc = new GeneratedCode();
            var          cc = new CodeContext();
            IQuerySource s  = new DummyQueryReference()
            {
                ItemName = "q", ItemType = typeof(int)
            };

            ArrayExpressionParser.ParseArrayExpression(s, Expression.Variable(typeof(int[]), "d"), gc, cc, MEFUtilities.MEFContainer);
            Assert.IsNotNull(cc.LoopVariable, "loop variable");
        }
예제 #3
0
 public void IEnumerableWithNothingBehindItCheck()
 {
     // We can't loop over a random ienumerable - that isn't enough infomration
     // about where the loop came from (so we can't build the loop unless we know what we
     // are looping over!).
     var          gc = new GeneratedCode();
     var          cc = new CodeContext();
     IQuerySource s  = new DummyQueryReference()
     {
         ItemName = "q", ItemType = typeof(int)
     };
     var arr = Expression.Variable(typeof(IEnumerable <int>), "d");
     var r   = ArrayExpressionParser.ParseArrayExpression(s, arr, gc, cc, MEFUtilities.MEFContainer);
 }
예제 #4
0
        /// <summary>
        /// Reset all the counters, etc., in the LINQ library
        /// </summary>
        public static void ResetLINQLibrary()
        {
            var a = ROOTNET.NTROOT.gROOT.GetApplication();

            MEFUtilities.MyClassInit();
            DummyQueryExectuor.GlobalInitalized = false;
            ArrayExpressionParser.ResetParser();
            TypeUtils._variableNameCounter = 0;
            LINQToTTreeLib.TypeHandlers.ReplacementMethodCalls.TypeHandlerReplacementCall.ClearTypeList();
            var eng = new VelocityEngine();

            eng.Init();
            TTreeQueryExecutor.Reset();
            ResetCacheDir();
        }
예제 #5
0
        /// <summary>
        /// Do the work of executing the array parse
        /// </summary>
        /// <param name="e"></param>
        private static GeneratedCode ExecuteArrayParseOnExpression(Expression e)
        {
            var          gc = new GeneratedCode();
            var          cc = new CodeContext();
            IQuerySource s  = new DummyQueryReference()
            {
                ItemName = "q", ItemType = typeof(int)
            };
            var r = ArrayExpressionParser.ParseArrayExpression(s, e, gc, cc, MEFUtilities.MEFContainer);

            gc.DumpCodeToConsole();
            Assert.IsNotNull(cc.LoopVariable, "loop variable");

            return(gc);
        }
예제 #6
0
        public void TestRunForConvertedArray()
        {
            var          gc = new GeneratedCode();
            var          cc = new CodeContext();
            IQuerySource s  = new DummyQueryReference()
            {
                ItemName = "q", ItemType = typeof(int)
            };
            var arr = Expression.Variable(typeof(int[]), "d");
            var cvt = Expression.Convert(arr, typeof(IEnumerable <int>));
            var r   = ArrayExpressionParser.ParseArrayExpression(s, cvt, gc, cc, MEFUtilities.MEFContainer);

            Assert.IsNotNull(r);
            Assert.IsNotNull(cc.LoopVariable, "loop variable");
        }