Пример #1
0
        public void IfTest()
        {
            AQuery query = _db.Query
                           .Let("x", AValue.If(
                                    AFilter.Eq(AValue <Dummy> .Field(x => x.Bar), AValue.Bind(2)),
                                    AValue <Dummy> .Field(x => x.Baz),
                                    AValue.Bind(0)
                                    ));

            Assert.AreEqual("LET x = (x.Bar == @var0 ? x.Baz : @var1)", query.GetExpression());
            Assert.AreEqual(2, query.GetBindedVars()[0]);
            Assert.AreEqual(0, query.GetBindedVars()[1]);
        }