37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using PoweredSoft.DynamicLinq;
|
|||
|
using PoweredSoft.DynamicQuery.Core;
|
|||
|
using PoweredSoft.DynamicQuery.Test.Mock;
|
|||
|
using Xunit;
|
|||
|
|
|||
|
namespace PoweredSoft.DynamicQuery.Test
|
|||
|
{
|
|||
|
public class SortTests
|
|||
|
{
|
|||
|
[Fact]
|
|||
|
public void Simple()
|
|||
|
{
|
|||
|
MockContextFactory.SeedAndTestContextFor("SortTests_Simple", TestSeeders.SimpleSeedScenario, ctx =>
|
|||
|
{
|
|||
|
var shouldResult = ctx.Orders.OrderBy(t => t.OrderNum).ToList();
|
|||
|
|
|||
|
// query handler that is empty should be the same as running to list.
|
|||
|
var criteria = new QueryCriteria()
|
|||
|
{
|
|||
|
Sorts = new List<ISort>()
|
|||
|
{
|
|||
|
new Sort("OrderNum")
|
|||
|
}
|
|||
|
};
|
|||
|
|
|||
|
var queryHandler = new QueryHandler();
|
|||
|
var result = queryHandler.Execute(ctx.Orders, criteria);
|
|||
|
Assert.Equal(shouldResult, result.Data);
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
}
|