Skip to content

Commit 9c9185f

Browse files
committed
fix: nullable guid is null
fixes #37
1 parent 3c88bdf commit 9c9185f

File tree

3 files changed

+104
-73
lines changed

3 files changed

+104
-73
lines changed

QueryKit.IntegrationTests/Tests/DatabaseFilteringTests.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,32 @@ public async Task can_filter_by_nullable_guid_is_something()
740740
people.Count.Should().Be(1);
741741
people[0].Id.Should().Be(fakeRecipeTwo.Id);
742742
}
743+
744+
[Fact]
745+
public async Task can_filter_by_nullable_guid_is_null()
746+
{
747+
// Arrange
748+
var testingServiceScope = new TestingServiceScope();
749+
var fakeRecipeOne = new FakeRecipeBuilder()
750+
.WithSecondaryId(null)
751+
.Build();
752+
var fakeRecipeTwo = new FakeRecipeBuilder().Build();
753+
await testingServiceScope.InsertAsync(fakeRecipeOne, fakeRecipeTwo);
754+
755+
var input = $"""(secondaryId == null)""";
756+
757+
// Act
758+
var queryableRecipe = testingServiceScope.DbContext().Recipes;
759+
var appliedQueryable = queryableRecipe.ApplyQueryKitFilter(input);
760+
var people = await appliedQueryable.ToListAsync();
761+
// var people = testingServiceScope.DbContext().Recipes
762+
// .Where(x => x.SecondaryId == null)
763+
// .ToList();
764+
765+
// Assert
766+
people.Count.Should().Be(1);
767+
people[0].Id.Should().Be(fakeRecipeOne.Id);
768+
}
743769

744770
[Fact]
745771
public async Task return_no_records_when_no_match()

0 commit comments

Comments
 (0)