@@ -467,6 +467,35 @@ public async Task can_filter_nested_property_using_ownsone()
467467 people [ 0 ] . Id . Should ( ) . Be ( fakePersonOne . Id ) ;
468468 }
469469
470+ [ Fact ]
471+ public async Task can_filter_nested_property_using_ownsone_with_alias ( )
472+ {
473+ // Arrange
474+ var testingServiceScope = new TestingServiceScope ( ) ;
475+ var faker = new Faker ( ) ;
476+ var fakePersonOne = new FakeTestingPersonBuilder ( )
477+ . WithPhysicalAddress ( new Address ( faker . Address . StreetAddress ( )
478+ , faker . Address . SecondaryAddress ( )
479+ , faker . Address . City ( )
480+ , faker . Address . State ( )
481+ , faker . Address . ZipCode ( )
482+ , faker . Address . Country ( ) ) )
483+ . Build ( ) ;
484+ await testingServiceScope . InsertAsync ( fakePersonOne ) ;
485+ var input = $ """ state == "{ fakePersonOne . PhysicalAddress . State } " """ ;
486+
487+ // Act
488+ var config = new QueryKitConfiguration ( config =>
489+ {
490+ config . Property < TestingPerson > ( x => x . PhysicalAddress . State ) . HasQueryName ( "state" ) ;
491+ } ) ;
492+ var people = testingServiceScope . DbContext ( ) . People . ApplyQueryKitFilter ( input , config ) . ToList ( ) ;
493+
494+ // Assert
495+ people . Count . Should ( ) . Be ( 1 ) ;
496+ people [ 0 ] . Id . Should ( ) . Be ( fakePersonOne . Id ) ;
497+ }
498+
470499 [ Fact ]
471500 public async Task can_filter_by_decimal ( )
472501 {
@@ -727,4 +756,62 @@ public async Task can_filter_on_child_entity_with_config()
727756 people . FirstOrDefault ( x => x . Id == fakeRecipeOne . Id ) . Should ( ) . NotBeNull ( ) ;
728757 people . FirstOrDefault ( x => x . Id == fakeRecipeTwo . Id ) . Should ( ) . BeNull ( ) ;
729758 }
759+
760+ [ Fact ]
761+ public async Task can_filter_with_child_props_for_complex_property ( )
762+ {
763+ // Arrange
764+ var testingServiceScope = new TestingServiceScope ( ) ;
765+ var faker = new Faker ( ) ;
766+ var fakePersonOne = new FakeRecipeBuilder ( )
767+ . WithCollectionEmail ( faker . Internet . Email ( ) )
768+ . Build ( ) ;
769+ var fakePersonTwo = new FakeRecipeBuilder ( )
770+ . Build ( ) ;
771+ await testingServiceScope . InsertAsync ( fakePersonOne , fakePersonTwo ) ;
772+
773+ var input = $ """ CollectionEmail.Value == "{ fakePersonOne . CollectionEmail . Value } " """ ;
774+
775+ // Act
776+ var queryablePeople = testingServiceScope . DbContext ( ) . Recipes ;
777+ var config = new QueryKitConfiguration ( config =>
778+ {
779+ config . Property < Recipe > ( x => x . CollectionEmail . Value ) ; //.HasQueryName("email");
780+ } ) ;
781+ var appliedQueryable = queryablePeople . ApplyQueryKitFilter ( input , config ) ;
782+ var people = await appliedQueryable . ToListAsync ( ) ;
783+
784+ // Assert
785+ people . Count . Should ( ) . Be ( 1 ) ;
786+ people [ 0 ] . Id . Should ( ) . Be ( fakePersonOne . Id ) ;
787+ }
788+
789+ [ Fact ]
790+ public async Task can_filter_with_child_props_for_complex_property_with_alias ( )
791+ {
792+ // Arrange
793+ var testingServiceScope = new TestingServiceScope ( ) ;
794+ var faker = new Faker ( ) ;
795+ var fakePersonOne = new FakeRecipeBuilder ( )
796+ . WithCollectionEmail ( faker . Internet . Email ( ) )
797+ . Build ( ) ;
798+ var fakePersonTwo = new FakeRecipeBuilder ( )
799+ . Build ( ) ;
800+ await testingServiceScope . InsertAsync ( fakePersonOne , fakePersonTwo ) ;
801+
802+ var input = $ """ email == "{ fakePersonOne . CollectionEmail . Value } " """ ;
803+
804+ // Act
805+ var queryablePeople = testingServiceScope . DbContext ( ) . Recipes ;
806+ var config = new QueryKitConfiguration ( config =>
807+ {
808+ config . Property < Recipe > ( x => x . CollectionEmail . Value ) . HasQueryName ( "email" ) ;
809+ } ) ;
810+ var appliedQueryable = queryablePeople . ApplyQueryKitFilter ( input , config ) ;
811+ var people = await appliedQueryable . ToListAsync ( ) ;
812+
813+ // Assert
814+ people . Count . Should ( ) . Be ( 1 ) ;
815+ people [ 0 ] . Id . Should ( ) . Be ( fakePersonOne . Id ) ;
816+ }
730817}
0 commit comments