Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,12 @@ public async Task sort_direction_after_double_space_is_read()

[Theory]
[InlineData("""Tags ^$ "sweet" """, new[] { "pancakes" })]
[InlineData("""Tags !^$ "sweet" """, new[] { "stew", "bread", "water" })]
[InlineData("""Tags ^$* "WINNER" """, new[] { "bread" })]
[InlineData("""Tags !^$* "WINNER" """, new[] { "pancakes", "stew", "water" })]
[InlineData("""Tags %^$ "dinner" """, new[] { "stew", "water" })]
public async Task has_returns_matching_rows(string input, string[] expectedTitles)
[InlineData("""Tags %!^$ "dinner" """, new[] { "pancakes", "bread" })]
public async Task has_and_does_not_have_return_matching_rows(string input, string[] expectedTitles)
{
// Arrange
var testingServiceScope = new TestingServiceScope();
Expand Down
4 changes: 2 additions & 2 deletions QueryKit.UnitTests/FilterParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ public void primitive_collection_does_not_have()
var input = """Tags !^$ "winner" """;
var filterExpression = FilterParser.ParseFilter<Recipe>(input);
filterExpression.ToDisplayString().Should()
.Be(""""x => x.Tags.Any(z => (z != "winner"))"""");
.Be(""""x => Not(x.Tags.Any(z => (z == "winner")))"""");
}

[Fact]
Expand All @@ -767,7 +767,7 @@ public void primitive_collection_does_not_have_case_insensitive()
var input = """Tags !^$* "winner" """;
var filterExpression = FilterParser.ParseFilter<Recipe>(input);
filterExpression.ToDisplayString().Should()
.Be(""""x => x.Tags.Any(z => (z.ToLower() != "winner".ToLower()))"""");
.Be(""""x => Not(x.Tags.Any(z => (z.ToLower() == "winner".ToLower())))"""");
}

[Fact]
Expand Down
5 changes: 4 additions & 1 deletion QueryKit.UnitTests/FilterParsingRegressionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,12 @@ public void sort_direction_after_extra_white_space_is_read(string input)

[Theory]
[InlineData("""Tags ^$ "sweet" """, new[] { "pancakes" })]
[InlineData("""Tags !^$ "sweet" """, new[] { "stew", "bread", "water" })]
[InlineData("""Tags ^$* "WINNER" """, new[] { "bread" })]
[InlineData("""Tags !^$* "WINNER" """, new[] { "pancakes", "stew", "water" })]
[InlineData("""Tags %^$ "dinner" """, new[] { "stew", "water" })]
public void has_returns_matching_rows(string input, string[] expectedTitles)
[InlineData("""Tags %!^$ "dinner" """, new[] { "pancakes", "bread" })]
public void has_and_does_not_have_return_matching_rows(string input, string[] expectedTitles)
{
var recipes = new[]
{
Expand Down
2 changes: 1 addition & 1 deletion QueryKit/Operators/ComparisonOperator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ public override Expression GetExpression<T>(Expression left, Expression right, T
left.Type.GetGenericTypeDefinition() == typeof(IList<>) ||
typeof(IEnumerable<>).IsAssignableFrom(left.Type.GetGenericTypeDefinition())))
{
return GetCollectionExpression(left, right, Expression.NotEqual, UsesAll);
return Expression.Not(GetCollectionExpression(left, right, Expression.Equal, UsesAll));
}

throw new QueryKitParsingException("DoesNotHaveType is only supported for collections");
Expand Down
Loading