-Fixed JToken.ReadFrom creating a string value for a comment

This commit is contained in:
James Newton-King
2014-04-28 17:11:02 +12:00
parent 2039a29d91
commit 7458cefe95
3 changed files with 127 additions and 15 deletions
@@ -57,6 +57,23 @@ namespace Newtonsoft.Json.Tests.Linq
[TestFixture]
public class JObjectTests : TestFixtureBase
{
[Test]
public void EmbedJValueStringInNewJObject()
{
string s = null;
var v = new JValue(s);
dynamic o = JObject.FromObject(new { title = v });
string output = o.ToString();
Assert.AreEqual(@"{
""title"": null
}", output);
Assert.AreEqual(null, v.Value);
Assert.IsNull((string)o.title);
}
[Test]
public void JObjectWithComments()
{