コード例 #1
0
        public void ReturnPartialTest()
        {
            AQuery query = _db.Query
                           .Return(AReturn.Partial <Dummy>(x => x.Key, x => x.Foo));

            Assert.AreEqual("RETURN {_key:x._key, Foo:x.Foo}", query.GetExpression());
        }
コード例 #2
0
        public void ReturnTest()
        {
            AQuery query = _db.Query
                           .Return(AReturn.Variable("x"));

            Assert.AreEqual("RETURN x", query.GetExpression());
        }
コード例 #3
0
        public void PartialTest()
        {
            var returns = AReturn.Partial <Dummy>(x => x.Bar, x => x.Foo);

            AQuery query = _db.Query
                           .Return(returns);

            Assert.AreEqual("RETURN {Bar:x.Bar, Foo:x.Foo}", query.GetExpression());
        }
コード例 #4
0
        public void SimpleTest()
        {
            var returns = AReturn.Variable("Foo");

            AQuery query = _db.Query
                           .Return(returns);

            Assert.AreEqual("RETURN Foo", query.GetExpression());
        }
コード例 #5
0
        public void ReturnPartial2Test()
        {
            AQuery query = _db.Query
                           .Return(
                AReturn.Partial <Dummy>(
                    Expression.Property(Expression.Parameter(typeof(Dummy), "x"), "Key"),
                    Expression.Property(Expression.Parameter(typeof(Dummy), "x"), "Foo")
                    )
                );

            Assert.AreEqual("RETURN {_key:x._key, Foo:x.Foo}", query.GetExpression());
        }
コード例 #6
0
        public void LetSubQueryTest()
        {
            AQuery subquery = _db.Query
                              .For("y", AValue.Field(TestDocumentCollectionName))
                              .Collect()
                              .Aggregate("max", ANumeric.Max(AValue.Field("y.value")))
                              .Return(AReturn.Variable("max"));

            AQuery query = _db.Query
                           .Let("x", AValue.Subquery <int>(subquery));

            Assert.AreEqual("LET x = (FOR y IN " + TestDocumentCollectionName + " COLLECT AGGREGATE max = MAX(y.value) RETURN max)", query.GetExpression());
        }