-Fixes to XML documentation

-Sandcastle Help File Builder project added
-Quickstart guides added
This commit is contained in:
JamesNK
2008-05-04 01:26:44 +00:00
parent 3209f09f0f
commit d88e2cf2ca
22 changed files with 1045 additions and 25 deletions
@@ -38,6 +38,7 @@ using System.Net.Mail;
using System.Web.Script.Serialization;
using Newtonsoft.Json.Linq;
using System.Linq;
using Newtonsoft.Json.Converters;
namespace Newtonsoft.Json.Tests
{
@@ -231,7 +232,7 @@ namespace Newtonsoft.Json.Tests
string output = JavaScriptConvert.SerializeObject(product);
//{
// "Name": "Apple",
// "Expiry": new Date(1230422400000),
// "Expiry": "\/Date(1230375600000+1300)\/",
// "Price": 3.99,
// "Sizes": [
// "Small",
@@ -250,6 +251,24 @@ namespace Newtonsoft.Json.Tests
Assert.AreEqual("Large", deserializedProduct.Sizes[2]);
}
//[Test]
//public void Advanced()
//{
// Product product = new Product();
// product.Expiry = new DateTime(2008, 12, 28);
// JsonSerializer serializer = new JsonSerializer();
// serializer.Converters.Add(new JavaScriptDateTimeConverter());
// serializer.NullValueHandling = NullValueHandling.Ignore;
// using (StreamWriter sw = new StreamWriter(@"c:\json.txt"))
// using (JsonWriter writer = new JsonTextWriter(sw))
// {
// serializer.Serialize(writer, product);
// // {"Expiry":new Date(1230375600000),"Price":0}
// }
//}
[Test]
public void JavaScriptConvertSerializer()
{
@@ -119,6 +119,17 @@ namespace Newtonsoft.Json.Tests
jsonWriter.WriteEndObject();
}
// {
// "CPU": "Intel",
// "PSU": "500W",
// "Drives": [
// "DVD read/writer"
// /*(broken)*/,
// "500 gigabyte hard drive",
// "200 gigabype hard drive"
// ]
// }
string expected = @"{
""CPU"": ""Intel"",
""PSU"": ""500W"",
@@ -37,16 +37,48 @@ namespace Newtonsoft.Json.Tests.Linq
{
public class LinqToJsonTest : TestFixtureBase
{
[Test]
public void Manual()
{
JArray array = new JArray();
JValue text = new JValue("Manual text");
JValue date = new JValue(new DateTime(2000, 5, 23));
array.Add(text);
array.Add(date);
string json = array.ToString();
// [
// "Manual text",
// "\/Date(958996800000+1200)\/"
// ]
}
[Test]
public void LinqToJsonDeserialize()
{
JObject o = new JObject(
new JProperty("Name", "John Smith"),
new JProperty("BirthDate", new DateTime(1983, 3, 20))
);
JsonSerializer serializer = new JsonSerializer();
Person p = (Person)serializer.Deserialize(new JsonTokenReader(o), typeof(Person));
// John Smith
Console.WriteLine(p.Name);
}
[Test]
public void ObjectParse()
{
string json = @"{
CPU: 'Intel',
Drives: [
'DVD read/writer',
""500 gigabyte hard drive""
]
}";
CPU: 'Intel',
Drives: [
'DVD read/writer',
""500 gigabyte hard drive""
]
}";
JObject o = JObject.Parse(json);
IList<JProperty> properties = o.Properties().ToList();