-add tests for base class object events
This commit is contained in:
@@ -96,4 +96,40 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
errorContext.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class DerivedSerializationEventTestObject : SerializationEventTestObject
|
||||
{
|
||||
// This field is set to null, but populated after deserialization, only
|
||||
// in the derived class
|
||||
[JsonIgnore]
|
||||
public string Member7 { get; set; }
|
||||
|
||||
// These empty methods exist to make sure we're not covering up the base
|
||||
// methods
|
||||
[OnSerializing]
|
||||
internal void OnDerivedSerializingMethod(StreamingContext context)
|
||||
{
|
||||
}
|
||||
|
||||
[OnSerialized]
|
||||
internal void OnDerivedSerializedMethod(StreamingContext context)
|
||||
{
|
||||
}
|
||||
|
||||
[OnDeserializing]
|
||||
internal void OnDerivedDeserializingMethod(StreamingContext context)
|
||||
{
|
||||
}
|
||||
|
||||
[OnDeserialized]
|
||||
internal void OnDerivedDeserializedMethod(StreamingContext context)
|
||||
{
|
||||
Member7 = "This value was set after deserialization.";
|
||||
}
|
||||
|
||||
[OnError]
|
||||
internal void OnDerivedErrorMethod(StreamingContext context, ErrorContext errorContext)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user