示例#1
0
 public override string ToString()
 {
     StringWriter sw = new StringWriter();
     SoqlPrettyPrinter pp = new SoqlPrettyPrinter(sw);
     pp.IndentOutput = false;
     this.Accept(pp);
     return sw.ToString();
 }
示例#2
0
        public override string ToString()
        {
            StringWriter      sw = new StringWriter();
            SoqlPrettyPrinter pp = new SoqlPrettyPrinter(sw);

            pp.IndentOutput = false;
            this.Accept(pp);
            return(sw.ToString());
        }
        static void AssertSimplifies(string input, string expectedResult)
        {
            StringWriter sw0 = new StringWriter();
            StringWriter sw1 = new StringWriter();

            SoqlPrettyPrinter pp0 = new SoqlPrettyPrinter(sw0);
            SoqlPrettyPrinter pp1 = new SoqlPrettyPrinter(sw1);

            pp0.PrintExpression(Sooda.QL.SoqlParser.ParseExpression(input).Simplify());
            pp1.PrintExpression(Sooda.QL.SoqlParser.ParseExpression(expectedResult));

            Console.WriteLine("Test: |{0}| => |{1}| => |{2}|", input, sw0.ToString(), sw1.ToString());
            Assert.AreEqual(input + " simplifies to " + expectedResult, sw1.ToString(), sw0.ToString());
        }
示例#4
0
        public static string GetCollectionKey(string className, SoodaWhereClause wc)
        {
            if (wc == null || wc.WhereExpression == null)
                return className + " where True";

            StringWriter sw = new StringWriter();
            SoqlPrettyPrinter pp = new SoqlPrettyPrinter(sw, wc.Parameters);
            pp.PrintExpression(wc.WhereExpression);
            string canonicalWhereClause = sw.ToString();
            return className + " where " + canonicalWhereClause;
        }
示例#5
0
 private void AssertExpression(string s, object expectedValue)
 {
     SoqlExpression expr = SoqlParser.ParseExpression(s);
     SoqlPrettyPrinter pp = new SoqlPrettyPrinter(Console.Out);
     pp.PrintExpression(expr);
     object val = expr.Evaluate(null);
     Console.WriteLine(" = {0} (expected {1})", val, expectedValue);
     Assert.AreEqual(expectedValue, val);
 }