added tests on ef.
This commit is contained in:
parent
cfa0faaf4f
commit
fc0510f614
@ -194,5 +194,21 @@ namespace PoweredSoft.DynamicLinq.Test
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -82,6 +82,8 @@ namespace PoweredSoft.DynamicLinq.Test
|
||||
context.SaveChanges();
|
||||
}
|
||||
|
||||
|
||||
|
||||
[TestMethod]
|
||||
public void TestSimpleWhere()
|
||||
{
|
||||
@ -190,5 +192,20 @@ namespace PoweredSoft.DynamicLinq.Test
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user