-Modified project to support signed flag. Does not output InternalsVisibleTo attributes when present

-Improved error message on JObject and JArray Load method
-Added WriteRawValue
-Added missing XML documentation
-Added SerializeObject overload that takes a formatting flag
This commit is contained in:
JamesNK
2008-10-08 09:01:55 +00:00
parent 5bb0c17eec
commit 3038a8d79e
15 changed files with 144 additions and 207 deletions
@@ -1308,19 +1308,19 @@ keyword such as type of business.""
public void DefaultValueAttributeTest()
{
string json = JavaScriptConvert.SerializeObject(new DefaultValueAttributeTestClass(),
new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore });
Formatting.None, new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore });
Assert.AreEqual(@"{""TestField1"":0,""TestProperty1"":null}", json);
json = JavaScriptConvert.SerializeObject(new DefaultValueAttributeTestClass { TestField1 = int.MinValue, TestProperty1 = "NotDefault" },
new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore });
Formatting.None, new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore });
Assert.AreEqual(@"{""TestField1"":-2147483648,""TestProperty1"":""NotDefault""}", json);
json = JavaScriptConvert.SerializeObject(new DefaultValueAttributeTestClass { TestField1 = 21, TestProperty1 = "NotDefault" },
new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore });
Formatting.None, new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore });
Assert.AreEqual(@"{""TestProperty1"":""NotDefault""}", json);
json = JavaScriptConvert.SerializeObject(new DefaultValueAttributeTestClass { TestField1 = 21, TestProperty1 = "TestProperty1Value" },
new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore });
Formatting.None, new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore });
Assert.AreEqual(@"{}", json);
}