-Added JsonPrimitiveContract and JsonLinqContract

-Removed JsonRaw and replaced with JRaw
-Fixed properties on existing derived values not being populated during deserialization
This commit is contained in:
JamesNK
2009-12-27 03:30:43 +00:00
parent 9144bc6c80
commit 961945657a
35 changed files with 835 additions and 436 deletions
@@ -243,7 +243,7 @@ Parameter name: arrayIndex")]
PersonRaw raw = new PersonRaw
{
FirstName = "FirstNameValue",
RawContent = new JsonRaw("[1,2,3,4,5]"),
RawContent = new JRaw("[1,2,3,4,5]"),
LastName = "LastNameValue"
};
@@ -261,7 +261,7 @@ Parameter name: arrayIndex")]
PersonRaw raw = new PersonRaw
{
FirstName = "FirstNameValue",
RawContent = new JsonRaw("[1,2,3,4,5]"),
RawContent = new JRaw("[1,2,3,4,5]"),
LastName = "LastNameValue"
};
@@ -302,7 +302,7 @@ Parameter name: arrayIndex")]
PersonRaw raw = new PersonRaw
{
FirstName = "FirstNameValue",
RawContent = new JsonRaw("[1,2,3,4,5]"),
RawContent = new JRaw("[1,2,3,4,5]"),
LastName = "LastNameValue"
};
@@ -314,7 +314,7 @@ Parameter name: arrayIndex")]
Assert.AreEqual("FirstNameValue", raw.FirstName);
Assert.AreEqual("LastNameValue", raw.LastName);
Assert.AreEqual("[1,2,3,4,5]", raw.RawContent.Content);
Assert.AreEqual("[1,2,3,4,5]", raw.RawContent.Value);
}
[Test]
@@ -366,8 +366,8 @@ Parameter name: arrayIndex")]
public void RawChildValues()
{
JObject o = new JObject();
o["val1"] = JValue.CreateRaw("1");
o["val2"] = JValue.CreateRaw("1");
o["val1"] = new JRaw("1");
o["val2"] = new JRaw("1");
string json = o.ToString();
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Newtonsoft.Json.Linq;
namespace Newtonsoft.Json.Tests.Linq
{
public class JRawTests : TestFixtureBase
{
[Test]
public void RawEquals()
{
JRaw r1 = new JRaw("raw1");
JRaw r2 = new JRaw("raw1");
JRaw r3 = new JRaw("raw2");
Assert.IsTrue(JToken.DeepEquals(r1, r2));
Assert.IsFalse(JToken.DeepEquals(r1, r3));
}
[Test]
public void RawClone()
{
JRaw r1 = new JRaw("raw1");
JToken r2 = r1.CloneToken();
Assert.IsInstanceOfType(typeof(JRaw), r2);
}
}
}