Skip to content

Instantly share code, notes, and snippets.

@MarcoDorantes
Last active November 1, 2021 13:22
Show Gist options
  • Save MarcoDorantes/3f7712c22a2247f76e80cf2fef59a775 to your computer and use it in GitHub Desktop.
Save MarcoDorantes/3f7712c22a2247f76e80cf2fef59a775 to your computer and use it in GitHub Desktop.
using System.Xml.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
public partial class ToXMLSpec
{
[TestMethod]
public void from_maplist1()
{
//Arrange
var yamltext = @"---
a:
id: 1
keys:
- A
- B
...";
var map = yaml.deserial(yamltext);
var expected_xmltext =
@"<yaml>
<map>
<entry>
<key>a</key>
<value>
<map>
<entry>
<key>id</key>
<value>1</value>
</entry>
<entry>
<key>keys</key>
<value>
<list>
<entry>A</entry>
<entry>B</entry>
</list>
</value>
</entry>
</map>
</value>
</entry>
</map>
</yaml>";
//Act
var xml = XDocument.Parse(yaml.AsXml_1dot0(map));
//Assert
Assert.AreEqual("yaml", xml.Root.Name);
Assert.AreEqual(expected_xmltext, $"{xml}");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment