Permalink
Browse files

Applied fix suggested by Mike Nichols to correctly write the Name att…

…ribute of a nested composite element to the xml.
  • Loading branch information...
1 parent f3e8419 commit f3a84670c8e593659136b8222dc53c49887cc5e8 @paulbatum paulbatum committed May 30, 2010
@@ -61,12 +61,18 @@ public void ShouldWriteNestedCompositeElements()
.Element("nested-composite-element").Exists();
}
- [Test, Ignore]
- public void ShouldWriteNestedCompositeElement()
+ [Test]
+ public void ShouldWriteNestedCompositeElementName()
{
- Assert.Fail();
+ var mapping = new CompositeElementMapping();
+ mapping.AddCompositeElement(new NestedCompositeElementMapping { Name = "testName"});
+
+ writer.VerifyXml(mapping)
+ .Element("nested-composite-element")
+ .HasAttribute("name", "testName");
}
+
[Test]
public void ShouldWriteParent()
{
@@ -31,6 +31,9 @@ public override void ProcessCompositeElement(CompositeElementMapping mapping)
if (mapping.HasValue(x => x.Class))
element.WithAtt("class", mapping.Class);
+
+ if (mapping is NestedCompositeElementMapping)
+ element.WithAtt("name", ((NestedCompositeElementMapping)mapping).Name);
}
public override void Visit(CompositeElementMapping compositeElementMapping)

0 comments on commit f3a8467

Please sign in to comment.