diff --git a/PoweredSoft.DynamicQuery.Test/FilterTests.cs b/PoweredSoft.DynamicQuery.Test/FilterTests.cs index 3700da3..d865dbf 100644 --- a/PoweredSoft.DynamicQuery.Test/FilterTests.cs +++ b/PoweredSoft.DynamicQuery.Test/FilterTests.cs @@ -5,6 +5,7 @@ using System.Text; using PoweredSoft.DynamicQuery.Core; using PoweredSoft.DynamicQuery.Test.Mock; using Xunit; +using Xunit.Sdk; namespace PoweredSoft.DynamicQuery.Test { diff --git a/PoweredSoft.DynamicQuery.Test/Mock/MockContextFactory.cs b/PoweredSoft.DynamicQuery.Test/Mock/MockContextFactory.cs index 95c490c..a760bec 100644 --- a/PoweredSoft.DynamicQuery.Test/Mock/MockContextFactory.cs +++ b/PoweredSoft.DynamicQuery.Test/Mock/MockContextFactory.cs @@ -2,6 +2,8 @@ using System.Collections.Generic; using System.Text; using Microsoft.EntityFrameworkCore; +using Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine.ClientProtocol; +using Xunit.Sdk; namespace PoweredSoft.DynamicQuery.Test.Mock { diff --git a/PoweredSoft.DynamicQuery.Test/SortTests.cs b/PoweredSoft.DynamicQuery.Test/SortTests.cs new file mode 100644 index 0000000..39494f6 --- /dev/null +++ b/PoweredSoft.DynamicQuery.Test/SortTests.cs @@ -0,0 +1,36 @@ +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() + { + new Sort("OrderNum") + } + }; + + var queryHandler = new QueryHandler(); + var result = queryHandler.Execute(ctx.Orders, criteria); + Assert.Equal(shouldResult, result.Data); + }); + } + } +} diff --git a/README.md b/README.md index fda7485..8bfbe12 100644 --- a/README.md +++ b/README.md @@ -17,15 +17,15 @@ PoweredSoft.DynamicQuery.Core |