-Implemented INotifyCollectionChanged on JContainer in Silverlight

-Added StreamingContext to JsonSerializer
-Added CreateMemberValueProvider method to DefaultContractResolver
-Fixed not falling back the original class from the metadata class when attribute not found
This commit is contained in:
JamesNK
2010-01-19 08:22:35 +00:00
parent f9b34390f5
commit 621916f5a6
15 changed files with 233 additions and 41 deletions
@@ -28,6 +28,7 @@ using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text;
using Newtonsoft.Json.Tests;
using Newtonsoft.Json.Tests.TestObjects;
@@ -230,6 +231,37 @@ namespace Newtonsoft.Json.Tests.Serialization
Console.WriteLine(obj.Member4);
// This value was set after deserialization.
}
#if !SILVERLIGHT
public class SerializationEventContextTestObject
{
public string TestMember { get; set; }
[OnSerializing]
internal void OnSerializingMethod(StreamingContext context)
{
TestMember = context.State + " " + context.Context;
}
}
[Test]
public void SerializationEventContextTest()
{
SerializationEventContextTestObject value = new SerializationEventContextTestObject();
string json = JsonConvert.SerializeObject(value, Formatting.Indented, new JsonSerializerSettings
{
Context =
new StreamingContext(
StreamingContextStates.Remoting,
"ContextValue")
});
Assert.AreEqual(@"{
""TestMember"": ""Remoting ContextValue""
}", json);
}
#endif
}
}
#endif