Skip to content

Commit 3af7302

Browse files
committed
Added a test for checking xml generation of nested composite elements
1 parent f4bc4d7 commit 3af7302

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/FluentNHibernate.Testing/DomainModel/Mapping/ComponentElementPartTester.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Collections.Generic;
12
using NUnit.Framework;
23

34
namespace FluentNHibernate.Testing.DomainModel.Mapping
@@ -19,5 +20,33 @@ public void CanIncludeParentReference()
1920
.Element("class/bag/composite-element/parent").Exists()
2021
.HasAttribute("name", "MyParent");
2122
}
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+
}
2251
}
2352
}

0 commit comments

Comments
 (0)