Skip to content

Commit

Permalink
Explore the parameter space
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveGilham committed Jan 21, 2021
1 parent dd6cf49 commit b9866eb
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Manatee.Json.Tests/XmlExtensionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -525,11 +525,23 @@ public void RoundTrip_StartingWithXml()
Assert.AreEqual(expected.ToString(), actual.ToString());
}
[Test]
public void RoundTrip_StartingWithRepeatingXml()
{
var expected = XElement.Parse(@"<Items><Item>1</Item><Item>2</Item><Item>3</Item></Items>");
var expectedJson = JsonValue.Parse(@"{""Items"":{""Item"":[1,2,3]}}");

var toJson = expected.ToJson();
Assert.AreEqual(expectedJson, toJson);

var actual = toJson.ToXElement(null);

Assert.AreEqual(expected.ToString(), actual.ToString());
}
[Test]
public void RoundTrip_StartingWithMoreComplexXml()
{
var expected = XElement.Parse(@"<Items><Item k=""1"" v=""a"" /><Item k=""2"" v=""b"" /><Item k=""3"" v=""c"" /></Items>");
var expectedJson = JsonValue.Parse(@"{""Items"":{""Item"":[{""-k"":1,""-v"":""a""},null,[{""-k"":2,""-v"":""b""},null],[{""-k"":3,""-v"":""c""},null]]}}
");
var expectedJson = JsonValue.Parse(@"{""Items"":{""Item"":[{""-k"":1,""-v"":""a""},null,[{""-k"":2,""-v"":""b""},null],[{""-k"":3,""-v"":""c""},null]]}}");

var toJson = expected.ToJson();
Assert.AreEqual(expectedJson, toJson);
Expand Down

0 comments on commit b9866eb

Please sign in to comment.