public void Test_Accepted_By_OrderByApplicator_Apply() { // Act var results = OrderByExpressionBuilder.Build <TestType>("IntValue, StringValue desc, DecValue").ToList(); var query = new List <TestType>().AsQueryable(); // Assert query = OrderByApplicator.Apply(query, results); Assert.True(true); }
public void Test_Apply_Single_Descending() { // Arrange var orderBy = new[] { new OrderByItem { Expression = _intValueExpression, Descending = true } }; var query = FakeQuery <TestType>(); // Act var result = OrderByApplicator.Apply(query, orderBy); // Assert AssertProviderCalls(query, "OrderByDescending"); }
public void Test_Apply_Multiple_Mixed() { // Arrange var orderBy = new[] { new OrderByItem { Expression = _intValueExpression }, new OrderByItem { Expression = _stringValueExpression, Descending = true }, new OrderByItem { Expression = _decValueExpression } }; var query = FakeQuery <TestType>(); // Act var result = OrderByApplicator.Apply(query, orderBy); // Assert AssertProviderCalls(query, "OrderBy", "ThenByDescending", "ThenBy"); }
public static IQueryable <T> OrderByDefault <T>(this IQueryable <T> query) { var expressions = OrderByExpressionBuilder.BuildDefault <T>(); return(OrderByApplicator.Apply(query, expressions)); }
public static IQueryable <T> OrderBy <T>(this IQueryable <T> query, string orderBy) { var expressions = OrderByExpressionBuilder.Build <T>(orderBy); return(OrderByApplicator.Apply(query, expressions)); }