File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
src/FluentNHibernate.Testing/DomainModel/Mapping Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ using System . Collections . Generic ;
1
2
using NUnit . Framework ;
2
3
3
4
namespace FluentNHibernate . Testing . DomainModel . Mapping
@@ -19,5 +20,33 @@ public void CanIncludeParentReference()
19
20
. Element ( "class/bag/composite-element/parent" ) . Exists ( )
20
21
. HasAttribute ( "name" , "MyParent" ) ;
21
22
}
23
+
24
+ [ Test ]
25
+ public void CanCreateNestedCompositeElement ( )
26
+ {
27
+ new MappingTester < TopLevel > ( )
28
+ . ForMapping (
29
+ a => a . HasMany ( x => x . Items )
30
+ . AsList ( )
31
+ . Component ( item =>
32
+ {
33
+ item . Component ( i => i . Target , n => n . Map ( z => z . Name ) ) ;
34
+ item . Map ( x => x . SomeString ) ;
35
+ } )
36
+ )
37
+ . Element ( "class/list/composite-element/nested-composite-element" ) . Exists ( )
38
+ . HasAttribute ( "name" , "Target" ) ;
39
+ }
40
+
41
+ private class TopLevel
42
+ {
43
+ public IList < Item > Items { get ; set ; }
44
+ }
45
+
46
+ private class Item
47
+ {
48
+ public PropertyTarget Target { get ; set ; }
49
+ public string SomeString { get ; set ; }
50
+ }
22
51
}
23
52
}
You can’t perform that action at this time.
0 commit comments