Skip to content

Commit da83265

Browse files
committed
made contains case insensitive
1 parent 444f8c0 commit da83265

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/GoatQuery/src/Evaluator/FilterEvaluator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ public static Result<Expression> Evaluate(QueryExpression expression, ParameterE
6464
case Keywords.Contains:
6565
var identifier = (Identifier)exp.Left;
6666

67-
var method = identifier.Value.GetType().GetMethod("Contains", new[] { value?.Value.GetType() });
67+
var method = identifier.Value.GetType().GetMethod("Contains", new[] { value?.Value.GetType(), typeof(StringComparison) });
6868

69-
return Expression.Call(property, method, value);
69+
return Expression.Call(property, method, value, Expression.Constant(StringComparison.OrdinalIgnoreCase));
7070
case Keywords.Lt:
7171
return Expression.LessThan(property, value);
7272
case Keywords.Lte:

src/GoatQuery/tests/Filter/FilterTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ public static IEnumerable<object[]> Parameters()
6161

6262
yield return new object[] {
6363
"firstName contains 'a'",
64-
new[] { _users["Jane"], _users["Harry"] }
64+
new[] { _users["Jane"], _users["Apple"], _users["Harry"] }
6565
};
6666

6767
yield return new object[] {
6868
"Age ne 1 and firstName contains 'a'",
69-
Array.Empty<User>()
69+
new[] { _users["Apple"] }
7070
};
7171

7272
yield return new object[] {

src/GoatQuery/tests/Top/TopTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public void Test_TopWithMaxTop(int top, int expectedCount)
7070
[InlineData(5)]
7171
[InlineData(100)]
7272
[InlineData(100_000)]
73-
public void Test_TopWithMaxTopThrowsException(int top)
73+
public void Test_TopWithMaxTopReturnsError(int top)
7474
{
7575
var users = new List<User>{
7676
new User { Age = 1, Firstname = "Jane" },

0 commit comments

Comments
 (0)