-Updated source code to VS2010

-Updated main project to .NET 4.0
-Updated to psake 4.0
-Changed assembly version to 4.0.0.0
-Added ICustomTypeDescriptor implementation to JObject, removed JTypeDescriptionProvider and JTypeDescriptor
-Changed serialization of collections to use iterator rather than indexer
-Removed Compact Framework project
-Fixed XML documentation warnings
This commit is contained in:
JamesNK
2010-08-31 02:19:41 +00:00
parent 97d9cf82ef
commit 12a91cce9e
37 changed files with 1686 additions and 1932 deletions
@@ -60,55 +60,6 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual("Error message for member 1 = An item with the same key has already been added.", c.Messages[0]);
}
[Test]
public void ErrorSerializingListHandled()
{
VersionKeyedCollection c = new VersionKeyedCollection();
c.Add(new Person
{
Name = "Jim",
BirthDate = new DateTime(2000, 12, 29, 0, 0, 0, DateTimeKind.Utc),
LastModified = new DateTime(2000, 12, 29, 0, 0, 0, DateTimeKind.Utc)
});
c.Add(new Person
{
Name = "Jimbo",
BirthDate = new DateTime(2000, 12, 29, 0, 0, 0, DateTimeKind.Utc),
LastModified = new DateTime(2000, 12, 29, 0, 0, 0, DateTimeKind.Utc)
});
c.Add(new Person
{
Name = "Jimmy",
BirthDate = new DateTime(2000, 12, 29, 0, 0, 0, DateTimeKind.Utc),
LastModified = new DateTime(2000, 12, 29, 0, 0, 0, DateTimeKind.Utc)
});
c.Add(new Person
{
Name = "Jim Bean",
BirthDate = new DateTime(2000, 12, 29, 0, 0, 0, DateTimeKind.Utc),
LastModified = new DateTime(2000, 12, 29, 0, 0, 0, DateTimeKind.Utc)
});
string json = JsonConvert.SerializeObject(c, Formatting.Indented);
Assert.AreEqual(@"[
{
""Name"": ""Jimbo"",
""BirthDate"": ""\/Date(978048000000)\/"",
""LastModified"": ""\/Date(978048000000)\/""
},
{
""Name"": ""Jim Bean"",
""BirthDate"": ""\/Date(978048000000)\/"",
""LastModified"": ""\/Date(978048000000)\/""
}
]", json);
Assert.AreEqual(2, c.Messages.Count);
Assert.AreEqual("Error message for member 0 = Index even: 0", c.Messages[0]);
Assert.AreEqual("Error message for member 2 = Index even: 2", c.Messages[1]);
}
[Test]
public void DeserializingErrorInChildObject()
{
@@ -244,7 +195,11 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual(new DateTime(2000, 12, 1, 0, 0, 0, DateTimeKind.Utc), c[2]);
Assert.AreEqual(3, errors.Count);
#if !(NET20 || SILVERLIGHT)
Assert.AreEqual("The string was not recognized as a valid DateTime. There is an unknown word starting at index 0.", errors[0]);
#else
Assert.AreEqual("The string was not recognized as a valid DateTime. There is a unknown word starting at index 0.", errors[0]);
#endif
Assert.AreEqual("Unexpected token parsing date. Expected String, got StartArray.", errors[1]);
Assert.AreEqual("Cannot convert null value to System.DateTime.", errors[2]);
}
@@ -319,7 +319,7 @@ namespace Newtonsoft.Json.Tests.Serialization
public void SerializeObjectWithMultipleGenericLists()
{
string containerTypeName = typeof(Container).AssemblyQualifiedName;
string productTypeName = typeof(Product).AssemblyQualifiedName;
string productListTypeName = typeof(List<Product>).AssemblyQualifiedName;
Container container = new Container
{
@@ -338,11 +338,11 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual(@"{
""$type"": """ + containerTypeName + @""",
""In"": {
""$type"": ""System.Collections.Generic.List`1[[" + productTypeName + @"]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"",
""$type"": """ + productListTypeName + @""",
""$values"": []
},
""Out"": {
""$type"": ""System.Collections.Generic.List`1[[" + productTypeName + @"]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"",
""$type"": """ + productListTypeName + @""",
""$values"": []
}
}", json);