@@ -6,6 +6,7 @@ namespace QueryKit.IntegrationTests.Tests;
66using Microsoft . EntityFrameworkCore ;
77using SharedTestingHelper . Fakes ;
88using SharedTestingHelper . Fakes . Author ;
9+ using SharedTestingHelper . Fakes . IngredientPreparations ;
910using SharedTestingHelper . Fakes . Ingredients ;
1011using SharedTestingHelper . Fakes . Recipes ;
1112using WebApiTestProject . Database ;
@@ -336,6 +337,44 @@ public async Task can_filter_by_string_for_collection_contains()
336337 recipes [ 0 ] . Id . Should ( ) . Be ( fakeRecipeOne . Id ) ;
337338 }
338339
340+ [ Fact ( Skip = "Can not handle nested collections yet." ) ]
341+ public async Task can_filter_by_string_for_nested_collection ( )
342+ {
343+ // Arrange
344+ var testingServiceScope = new TestingServiceScope ( ) ;
345+ var faker = new Faker ( ) ;
346+ var preparationOne = new FakeIngredientPreparation ( ) . Generate ( ) ;
347+ var preparationTwo = new FakeIngredientPreparation ( ) . Generate ( ) ;
348+ var fakeIngredientOne = new FakeIngredientBuilder ( )
349+ . WithPreparation ( preparationOne )
350+ . Build ( ) ;
351+ var fakeRecipeOne = new FakeRecipeBuilder ( ) . Build ( ) ;
352+ fakeRecipeOne . AddIngredient ( fakeIngredientOne ) ;
353+
354+ var fakeIngredientTwo = new FakeIngredientBuilder ( )
355+ . WithName ( faker . Lorem . Sentence ( ) )
356+ . WithPreparation ( preparationTwo )
357+ . Build ( ) ;
358+ var fakeRecipeTwo = new FakeRecipeBuilder ( ) . Build ( ) ;
359+ fakeRecipeTwo . AddIngredient ( fakeIngredientTwo ) ;
360+ await testingServiceScope . InsertAsync ( fakeRecipeOne , fakeRecipeTwo ) ;
361+
362+ var input = $ """ Ingredients.Preparations.Text == "{ preparationOne . Text } " """ ;
363+ var config = new QueryKitConfiguration ( settings =>
364+ {
365+ settings . Property < Recipe > ( x => x . Ingredients . SelectMany ( y => y . Preparations ) . Select ( y => y . Text ) ) ;
366+ } ) ;
367+
368+ // Act
369+ var queryableRecipes = testingServiceScope . DbContext ( ) . Recipes ;
370+ var appliedQueryable = queryableRecipes . ApplyQueryKitFilter ( input , config ) ;
371+ var recipes = await appliedQueryable . ToListAsync ( ) ;
372+
373+ // Assert
374+ recipes . Count . Should ( ) . Be ( 1 ) ;
375+ recipes [ 0 ] . Id . Should ( ) . Be ( fakeRecipeOne . Id ) ;
376+ }
377+
339378 [ Fact ]
340379 public async Task can_filter_by_string_for_collection_does_not_contain ( )
341380 {
0 commit comments