@@ -1487,6 +1487,119 @@ public async Task Parent_child()
14871487 await RunQuery ( database , query , null , null , false , new object [ ] { entity1 , entity2 , entity3 , entity4 , entity5 } ) ;
14881488 }
14891489
1490+ [ Fact ]
1491+ public async Task Parent_child_with_id ( )
1492+ {
1493+ var parent = new ParentEntity
1494+ {
1495+ Property = "Value1"
1496+ } ;
1497+ var child1 = new ChildEntity
1498+ {
1499+ Property = "Child1" ,
1500+ Parent = parent
1501+ } ;
1502+ parent . Children . Add ( child1 ) ;
1503+ var child2 = new ChildEntity
1504+ {
1505+ Property = "Child2" ,
1506+ Parent = parent
1507+ } ;
1508+ parent . Children . Add ( child2 ) ;
1509+
1510+ var query = $@ "
1511+ {{
1512+ parentEntities
1513+ {{
1514+ property
1515+ children(id:'{ child1 . Id } ' )
1516+ {{
1517+ property
1518+ }}
1519+ }}
1520+ }}" ;
1521+ await using var database = await sqlInstance . Build ( ) ;
1522+ await RunQuery ( database , query , null , null , false , new object [ ] { parent , child1 , child2 } ) ;
1523+ }
1524+
1525+ [ Fact ( Skip = "fix order" ) ]
1526+ public async Task Parent_with_id_child ( )
1527+ {
1528+ var parent1 = new ParentEntity
1529+ {
1530+ Property = "Value1"
1531+ } ;
1532+ var parent2 = new ParentEntity
1533+ {
1534+ Property = "Value2"
1535+ } ;
1536+ var child1 = new ChildEntity
1537+ {
1538+ Property = "Child1" ,
1539+ Parent = parent1
1540+ } ;
1541+ parent1 . Children . Add ( child1 ) ;
1542+ var child2 = new ChildEntity
1543+ {
1544+ Property = "Child2" ,
1545+ Parent = parent1
1546+ } ;
1547+ parent1 . Children . Add ( child2 ) ;
1548+
1549+ var query = $@ "
1550+ {{
1551+ parentEntities(id:'{ parent1 . Id } ')
1552+ {{
1553+ property
1554+ children
1555+ {{
1556+ property
1557+ }}
1558+ }}
1559+ }}" ;
1560+ await using var database = await sqlInstance . Build ( ) ;
1561+ await RunQuery ( database , query , null , null , false , new object [ ] { parent1 , parent2 , child1 , child2 } ) ;
1562+ }
1563+
1564+ [ Fact ]
1565+ public async Task Parent_with_id_child_with_id ( )
1566+ {
1567+ var parent1 = new ParentEntity
1568+ {
1569+ Property = "Value1"
1570+ } ;
1571+ var parent2 = new ParentEntity
1572+ {
1573+ Property = "Value2"
1574+ } ;
1575+ var child1 = new ChildEntity
1576+ {
1577+ Property = "Child1" ,
1578+ Parent = parent1
1579+ } ;
1580+ parent1 . Children . Add ( child1 ) ;
1581+ var child2 = new ChildEntity
1582+ {
1583+ Property = "Child2" ,
1584+ Parent = parent1
1585+ } ;
1586+ parent1 . Children . Add ( child2 ) ;
1587+
1588+ var query = $@ "
1589+ {{
1590+ parentEntities(id:'{ parent1 . Id } ')
1591+ {{
1592+ property
1593+ children(id:'{ child1 . Id } ' )
1594+ {{
1595+ property
1596+ }}
1597+ }}
1598+ }}" ;
1599+ await using var database = await sqlInstance . Build ( ) ;
1600+ await RunQuery ( database , query , null , null , false , new object [ ] { parent1 , parent2 , child1 , child2 } ) ;
1601+ }
1602+
14901603 [ Fact ]
14911604 public async Task Many_children ( )
14921605 {
0 commit comments