public void CompileShouldReturnEnumerableOfCompiledChildExpressions()
        {
            var expression = new EnumerableExpression();
            expression.AddChild(new IntegerExpression("2"));
            expression.AddChild(new IntegerExpression("3"));
            var result = expression.Compile();

            Assert.IsInstanceOfType(result.Result, typeof(IEnumerable<object>));
            var resultList = (IEnumerable<object>)result.Result;
            Assert.AreEqual(2d, resultList.ElementAt(0));
            Assert.AreEqual(3d, resultList.ElementAt(1));
        }
 private void BuildEnumerableExpression(IEnumerable<Token> tokens, Expression parent)
 {
     if (parent == null)
     {
         _graph.Add(new EnumerableExpression());
         BuildUp(tokens, _graph.Current);
     }
     else
     {
         var enumerableExpression = new EnumerableExpression();
         parent.AddChild(enumerableExpression);
         BuildUp(tokens, enumerableExpression);
     }
 }
Example #3
0
 private void BuildEnumerableExpression(IEnumerable <Token> tokens, Expression parent)
 {
     if (parent == null)
     {
         _graph.Add(new EnumerableExpression());
         BuildUp(tokens, _graph.Current);
     }
     else
     {
         var enumerableExpression = new EnumerableExpression();
         parent.AddChild(enumerableExpression);
         BuildUp(tokens, enumerableExpression);
     }
 }