-Added TypeNameAssemblyFormatHandling

-Added TypeNameAssemblyFormatHandling properties to JsonSerializer and JsonSerializerSettings
-Changed TypeNameAssemblyFormat properties on JsonSerializer and JsonSerializerSettings to obsolete
This commit is contained in:
James Newton-King
2016-09-17 15:57:03 +12:00
parent a0403492ad
commit ca27a0fc3a
17 changed files with 184 additions and 33 deletions
@@ -121,11 +121,13 @@ namespace Newtonsoft.Json.Tests.Serialization
string json = JsonConvert.SerializeObject(o, Formatting.Indented, new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.All,
#pragma warning disable 618
TypeNameAssemblyFormat = FormatterAssemblyStyle.Full
#pragma warning restore 618
});
string dynamicChildObjectTypeName = ReflectionUtils.GetTypeName(typeof(DynamicChildObject), FormatterAssemblyStyle.Full, null);
string expandoObjectTypeName = ReflectionUtils.GetTypeName(typeof(ExpandoObject), FormatterAssemblyStyle.Full, null);
string dynamicChildObjectTypeName = ReflectionUtils.GetTypeName(typeof(DynamicChildObject), TypeNameAssemblyFormatHandling.Full, null);
string expandoObjectTypeName = ReflectionUtils.GetTypeName(typeof(ExpandoObject), TypeNameAssemblyFormatHandling.Full, null);
StringAssert.AreEqual(@"{
""$type"": """ + expandoObjectTypeName + @""",
@@ -141,7 +143,9 @@ namespace Newtonsoft.Json.Tests.Serialization
dynamic n = JsonConvert.DeserializeObject(json, null, new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.All,
#pragma warning disable 618
TypeNameAssemblyFormat = FormatterAssemblyStyle.Full
#pragma warning restore 618
});
CustomAssert.IsInstanceOfType(typeof(ExpandoObject), n);