This commit is contained in:
James Newton-King
2015-04-07 17:36:41 +12:00
parent d2d097172e
commit 765bfbf1b4
102 changed files with 855 additions and 129 deletions
@@ -28,11 +28,14 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using NUnit.Framework;
namespace Newtonsoft.Json.Tests.Documentation.Samples.Xml
{
public class ConvertJsonToXml
[TestFixture]
public class ConvertJsonToXml : TestFixtureBase
{
[Test]
public void Example()
{
#region Usage
@@ -67,6 +70,18 @@ namespace Newtonsoft.Json.Tests.Documentation.Samples.Xml
// </Team>
// </Root>
#endregion
Assert.AreEqual(@"<Root Id=""1"">
<Email>james@example.com</Email>
<Active>true</Active>
<CreatedDate>2013-01-20T00:00:00Z</CreatedDate>
<Roles>User</Roles>
<Roles>Admin</Roles>
<Team Id=""2"">
<Name>Software Developers</Name>
<Description>Creators of fine software products and services.</Description>
</Team>
</Root>", node.ToString());
}
}
}
@@ -28,11 +28,14 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using NUnit.Framework;
namespace Newtonsoft.Json.Tests.Documentation.Samples.Xml
{
public class ConvertXmlToJson
[TestFixture]
public class ConvertXmlToJson : TestFixtureBase
{
[Test]
public void Example()
{
#region Usage
@@ -75,6 +78,8 @@ namespace Newtonsoft.Json.Tests.Documentation.Samples.Xml
// }
// }
#endregion
Assert.AreEqual(@"{""?xml"":{""@version"":""1.0"",""@standalone"":""no""},""root"":{""person"":[{""@id"":""1"",""name"":""Alan"",""url"":""http://www.google.com""},{""@id"":""2"",""name"":""Louis"",""url"":""http://www.yahoo.com""}]}}", json);
}
}
}
@@ -28,11 +28,14 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using NUnit.Framework;
namespace Newtonsoft.Json.Tests.Documentation.Samples.Xml
{
public class ConvertXmlToJsonForceArray
[TestFixture]
public class ConvertXmlToJsonForceArray : TestFixtureBase
{
[Test]
public void Example()
{
#region Usage
@@ -80,6 +83,8 @@ namespace Newtonsoft.Json.Tests.Documentation.Samples.Xml
// }
// }
#endregion
Assert.AreEqual(@"{""person"":{""@id"":""1"",""name"":""Alan"",""url"":""http://www.google.com"",""role"":[""Admin""]}}", json);
}
}
}