public void Build_CountQuery()
        {
            var builder = new DataSourceExpressionBuilder <int>(new SampleLoadOptions {
                Skip   = 111,
                Take   = 222,
                Filter = new object[] { "this", 123 },
                Sort   = new[] {
                    new SortingInfo {
                        Selector = "this"
                    }
                },
            });

            var expr = builder.BuildCountExpr();
            var text = expr.ToString();

            Assert.Contains("Where", text);
            Assert.DoesNotContain("Skip", text);
            Assert.DoesNotContain("Take", text);
            Assert.DoesNotContain("OrderBy", text);
            Assert.Contains(".Count()", text);
        }
예제 #2
0
 public static Expression BuildCountExpr <T>(this DataSourceExpressionBuilder <T> builder)
 {
     return(builder.BuildCountExpr(CreateSourceExpr <T>()));
 }