diff --git a/PoweredSoft.DynamicLinq.Test/EntityFrameworkCoreTests.cs b/PoweredSoft.DynamicLinq.Test/EntityFrameworkCoreTests.cs index ff215b4..c609cd8 100644 --- a/PoweredSoft.DynamicLinq.Test/EntityFrameworkCoreTests.cs +++ b/PoweredSoft.DynamicLinq.Test/EntityFrameworkCoreTests.cs @@ -194,5 +194,21 @@ public void TestContextTypeLessHelper() var first = result.FirstOrDefault() as Author; Assert.AreEqual(first?.FirstName, "David"); } + + [TestMethod] + public void TestLessAndGreaterThan() + { + var context = GetCoreContext(nameof(TestWhereAnd)); //EF Core + //or new BlogContext(testConnectionString); in EF + SeedForTests(context); + + var query = context.Authors.Query(q => q.LessThan("FirstName", "Mario")); + var first = query.FirstOrDefault(); + Assert.AreEqual(first?.FirstName, "David"); + + query = context.Authors.Query(q => q.GreaterThan("FirstName", "Mario")); + first = query.FirstOrDefault(); + Assert.AreEqual(first?.FirstName, "Some"); + } } } diff --git a/PoweredSoft.DynamicLinq.Test/EntityFrameworkTests.cs b/PoweredSoft.DynamicLinq.Test/EntityFrameworkTests.cs index 363c2d9..0a87f5f 100644 --- a/PoweredSoft.DynamicLinq.Test/EntityFrameworkTests.cs +++ b/PoweredSoft.DynamicLinq.Test/EntityFrameworkTests.cs @@ -82,6 +82,8 @@ public static void SeedForTests(BlogContext context) context.SaveChanges(); } + + [TestMethod] public void TestSimpleWhere() { @@ -190,5 +192,20 @@ public void TestContextTypeLessHelper() var first = result.FirstOrDefault() as Author; Assert.AreEqual(first?.FirstName, "David"); } + + [TestMethod] + public void TestLessAndGreaterThan() + { + var context = new BlogContext(testConnectionString); + SeedForTests(context); + + var query = context.Authors.Query(q => q.LessThan("FirstName", "Mario")); + var first = query.FirstOrDefault(); + Assert.AreEqual(first?.FirstName, "David"); + + query = context.Authors.Query(q => q.GreaterThan("FirstName", "Mario")); + first = query.FirstOrDefault(); + Assert.AreEqual(first?.FirstName, "Some"); + } } }