Skip to content

Commit f3a8467

Browse files
committed
Applied fix suggested by Mike Nichols to correctly write the Name attribute of a nested composite element to the xml.
1 parent f3e8419 commit f3a8467

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/FluentNHibernate.Testing/MappingModel/Output/XmlCompositeElementWriterTester.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,18 @@ public void ShouldWriteNestedCompositeElements()
6161
.Element("nested-composite-element").Exists();
6262
}
6363

64-
[Test, Ignore]
65-
public void ShouldWriteNestedCompositeElement()
64+
[Test]
65+
public void ShouldWriteNestedCompositeElementName()
6666
{
67-
Assert.Fail();
67+
var mapping = new CompositeElementMapping();
68+
mapping.AddCompositeElement(new NestedCompositeElementMapping { Name = "testName"});
69+
70+
writer.VerifyXml(mapping)
71+
.Element("nested-composite-element")
72+
.HasAttribute("name", "testName");
6873
}
6974

75+
7076
[Test]
7177
public void ShouldWriteParent()
7278
{

src/FluentNHibernate/MappingModel/Output/XmlCompositeElementWriter.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ public override void ProcessCompositeElement(CompositeElementMapping mapping)
3131

3232
if (mapping.HasValue(x => x.Class))
3333
element.WithAtt("class", mapping.Class);
34+
35+
if (mapping is NestedCompositeElementMapping)
36+
element.WithAtt("name", ((NestedCompositeElementMapping)mapping).Name);
3437
}
3538

3639
public override void Visit(CompositeElementMapping compositeElementMapping)

0 commit comments

Comments
 (0)