-Added JSON Schema implementation
-Move test serialization objects to TestObjects namespace -Fixed JsonConvert to always write a floating point number with a decimal place -Changed Type values to serialize and deserialize to type name string -Fixed JsonWriter to allow objects and arrays to be written in a constructor -Added JsonContainerAttribute with Id, Title and Description members. JsonObject and JsonArray inherit from this attribute -Added JsonArrayAttribute. Has flag to control whether array can contain null items. -Added IsRequired to JsonProperty -Replaced protected method GetSerializableMembers with GetMemberMappings on JsonSerializer -Fixed QuoteChar not getting set when parsing property name -Added Load(JsonReader) to JProperty, JConstructor -Fixed error when populating JProperty with content from collection -Added the ability for JsonTokenWriter to write individual values as well as arrays and objects -Added CreateReader to JToken -Added FromObject to JToken -Added ReadFrom to JToken
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
using NUnit.Framework;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Converters;
|
||||
@@ -235,7 +236,7 @@ Parameter name: arrayIndex")]
|
||||
[Test]
|
||||
public void FromObjectRaw()
|
||||
{
|
||||
JsonSerializerTest.PersonRaw raw = new JsonSerializerTest.PersonRaw
|
||||
PersonRaw raw = new PersonRaw
|
||||
{
|
||||
FirstName = "FirstNameValue",
|
||||
RawContent = new JsonRaw("[1,2,3,4,5]"),
|
||||
@@ -253,7 +254,7 @@ Parameter name: arrayIndex")]
|
||||
[Test]
|
||||
public void JsonTokenReader()
|
||||
{
|
||||
JsonSerializerTest.PersonRaw raw = new JsonSerializerTest.PersonRaw
|
||||
PersonRaw raw = new PersonRaw
|
||||
{
|
||||
FirstName = "FirstNameValue",
|
||||
RawContent = new JsonRaw("[1,2,3,4,5]"),
|
||||
@@ -294,7 +295,7 @@ Parameter name: arrayIndex")]
|
||||
[Test]
|
||||
public void DeserializeFromRaw()
|
||||
{
|
||||
JsonSerializerTest.PersonRaw raw = new JsonSerializerTest.PersonRaw
|
||||
PersonRaw raw = new PersonRaw
|
||||
{
|
||||
FirstName = "FirstNameValue",
|
||||
RawContent = new JsonRaw("[1,2,3,4,5]"),
|
||||
@@ -305,7 +306,7 @@ Parameter name: arrayIndex")]
|
||||
|
||||
JsonReader reader = new JsonTokenReader(o);
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
raw = (JsonSerializerTest.PersonRaw)serializer.Deserialize(reader, typeof(JsonSerializerTest.PersonRaw));
|
||||
raw = (PersonRaw)serializer.Deserialize(reader, typeof(PersonRaw));
|
||||
|
||||
Assert.AreEqual("FirstNameValue", raw.FirstName);
|
||||
Assert.AreEqual("LastNameValue", raw.LastName);
|
||||
|
||||
Reference in New Issue
Block a user