Skip to content

Commit 0583714

Browse files
committed
Test case
1 parent 4529342 commit 0583714

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/NHibernate.Test/Async/Linq/ODataTests.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,17 @@ public async Task OrderGroupByAsync(string queryString, int expectedRows)
6565
Assert.That(results, Has.Count.EqualTo(expectedRows));
6666
}
6767

68+
[TestCase("$filter=CustomerId le 'ANATR'",2 )]
69+
[TestCase("$filter=startswith(CustomerId, 'ANATR')", 1)]
70+
[TestCase("$filter=endswith(CustomerId, 'ANATR')", 1)]
71+
[TestCase("$filter=indexof(CustomerId, 'ANATR') eq 0", 1)]
72+
public async Task StringFilterAsync(string queryString, int expectedCount)
73+
{
74+
Assert.That(
75+
await (ApplyFilter(session.Query<Customer>(), queryString).Cast<Customer>().ToListAsync()),
76+
Has.Count.EqualTo(expectedCount));
77+
}
78+
6879
private IQueryable ApplyFilter<T>(IQueryable<T> query, string queryString)
6980
{
7081
var context = new ODataQueryContext(CreatEdmModel(), typeof(T), null) { };

src/NHibernate.Test/Linq/ODataTests.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ public void OrderGroupBy(string queryString, int expectedRows)
5353
Assert.That(results, Has.Count.EqualTo(expectedRows));
5454
}
5555

56+
[TestCase("$filter=CustomerId le 'ANATR'",2 )]
57+
[TestCase("$filter=startswith(CustomerId, 'ANATR')", 1)]
58+
[TestCase("$filter=endswith(CustomerId, 'ANATR')", 1)]
59+
[TestCase("$filter=indexof(CustomerId, 'ANATR') eq 0", 1)]
60+
public void StringFilter(string queryString, int expectedCount)
61+
{
62+
Assert.That(
63+
ApplyFilter(session.Query<Customer>(), queryString).Cast<Customer>().ToList(),
64+
Has.Count.EqualTo(expectedCount));
65+
}
66+
5667
private IQueryable ApplyFilter<T>(IQueryable<T> query, string queryString)
5768
{
5869
var context = new ODataQueryContext(CreatEdmModel(), typeof(T), null) { };

0 commit comments

Comments
 (0)