-Rename SpecialPropertyHandling to MetadataPropertyHandling
This commit is contained in:
@@ -3407,7 +3407,7 @@ Path ''"));
|
||||
() => JsonConvert.DeserializeObject<DictionaryWithNoDefaultConstructor>(json, new JsonSerializerSettings
|
||||
{
|
||||
PreserveReferencesHandling = PreserveReferencesHandling.All,
|
||||
SpecialPropertyHandling = SpecialPropertyHandling.Default
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.Default
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -4978,7 +4978,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
{
|
||||
var data = new DecimalTest(decimal.MinValue);
|
||||
var json = JsonConvert.SerializeObject(data);
|
||||
var obj = JsonConvert.DeserializeObject<DecimalTest>(json, new JsonSerializerSettings { SpecialPropertyHandling = SpecialPropertyHandling.Default });
|
||||
var obj = JsonConvert.DeserializeObject<DecimalTest>(json, new JsonSerializerSettings { MetadataPropertyHandling = MetadataPropertyHandling.Default });
|
||||
|
||||
Assert.AreEqual(decimal.MinValue, obj.Value);
|
||||
}
|
||||
|
||||
+11
-11
@@ -41,7 +41,7 @@ using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAtt
|
||||
namespace Newtonsoft.Json.Tests.Serialization
|
||||
{
|
||||
[TestFixture]
|
||||
public class SpecialPropertyHandlingTests : TestFixtureBase
|
||||
public class MetadataPropertyHandlingTests : TestFixtureBase
|
||||
{
|
||||
[Test]
|
||||
public void DeserializeArraysWithPreserveObjectReferences()
|
||||
@@ -80,7 +80,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
new JsonSerializerSettings
|
||||
{
|
||||
PreserveReferencesHandling = PreserveReferencesHandling.All,
|
||||
SpecialPropertyHandling = SpecialPropertyHandling.ReadAhead
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -99,7 +99,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
{
|
||||
Formatting = Formatting.Indented,
|
||||
TypeNameHandling = TypeNameHandling.All,
|
||||
SpecialPropertyHandling = SpecialPropertyHandling.ReadAhead
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead
|
||||
};
|
||||
string serializedString = JsonConvert.SerializeObject(inputContext, jsonSerializerSettings);
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
Item actual = JsonConvert.DeserializeObject<Item>(jsonString, new JsonSerializerSettings
|
||||
{
|
||||
SpecialPropertyHandling = SpecialPropertyHandling.ReadAhead
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead
|
||||
});
|
||||
|
||||
Assert.AreEqual(new Guid("d8220a4b-75b1-4b7a-8112-b7bdae956a45"), actual.SourceTypeID);
|
||||
@@ -182,7 +182,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
new JsonSerializerSettings
|
||||
{
|
||||
PreserveReferencesHandling = PreserveReferencesHandling.All,
|
||||
SpecialPropertyHandling = SpecialPropertyHandling.ReadAhead
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead
|
||||
});
|
||||
|
||||
Assert.AreEqual(3, circularList.Count);
|
||||
@@ -210,7 +210,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
JsonConvert.DeserializeObject(json, null, new JsonSerializerSettings
|
||||
{
|
||||
TypeNameHandling = TypeNameHandling.Objects,
|
||||
SpecialPropertyHandling = SpecialPropertyHandling.ReadAhead
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -234,7 +234,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
Dictionary<string, object> result = JsonConvert.DeserializeObject<Dictionary<string, object>>(json, new JsonSerializerSettings
|
||||
{
|
||||
SpecialPropertyHandling = SpecialPropertyHandling.ReadAhead
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead
|
||||
});
|
||||
|
||||
Assert.AreEqual(3, result.Count);
|
||||
@@ -262,7 +262,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
List<EmployeeReference> employees = JsonConvert.DeserializeObject<List<EmployeeReference>>(json, new JsonSerializerSettings
|
||||
{
|
||||
SpecialPropertyHandling = SpecialPropertyHandling.ReadAhead
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead
|
||||
});
|
||||
|
||||
Assert.AreEqual(2, employees.Count);
|
||||
@@ -294,7 +294,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
List<EmployeeReference> employees = t1.ToObject<List<EmployeeReference>>(JsonSerializer.Create(new JsonSerializerSettings
|
||||
{
|
||||
SpecialPropertyHandling = SpecialPropertyHandling.ReadAhead
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead
|
||||
}));
|
||||
|
||||
Assert.AreEqual(2, employees.Count);
|
||||
@@ -338,7 +338,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
{
|
||||
TypeNameHandling = TypeNameHandling.Objects,
|
||||
TypeNameAssemblyFormat = FormatterAssemblyStyle.Full,
|
||||
SpecialPropertyHandling = SpecialPropertyHandling.ReadAhead
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead
|
||||
});
|
||||
|
||||
Assert.AreEqual(4, values.Count);
|
||||
@@ -386,7 +386,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
TypeNameHandlingTests.TypeNameProperty deserialized = JsonConvert.DeserializeObject<TypeNameHandlingTests.TypeNameProperty>(json, new JsonSerializerSettings
|
||||
{
|
||||
SpecialPropertyHandling = SpecialPropertyHandling.ReadAhead
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead
|
||||
});
|
||||
Assert.AreEqual("Name!", deserialized.Name);
|
||||
CustomAssert.IsInstanceOfType(typeof(List<int>), deserialized.Value);
|
||||
@@ -298,7 +298,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
new JsonSerializerSettings
|
||||
{
|
||||
PreserveReferencesHandling = PreserveReferencesHandling.All,
|
||||
SpecialPropertyHandling = SpecialPropertyHandling.Default
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.Default
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -1069,7 +1069,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
"Error reading object reference '1'. Path 'Data.Prop2.MyProperty', line 9, position 20.",
|
||||
() => JsonConvert.DeserializeObject<PropertyItemIsReferenceObject>(json, new JsonSerializerSettings
|
||||
{
|
||||
SpecialPropertyHandling = SpecialPropertyHandling.Default
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.Default
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,7 +407,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
string json = "{}";
|
||||
List<string> errors = new List<string>();
|
||||
JsonSerializer serializer = new JsonSerializer();
|
||||
serializer.SpecialPropertyHandling = SpecialPropertyHandling.Default;
|
||||
serializer.MetadataPropertyHandling = MetadataPropertyHandling.Default;
|
||||
serializer.Error += delegate(object sender, ErrorEventArgs args)
|
||||
{
|
||||
errors.Add(args.ErrorContext.Path + " - " + args.ErrorContext.Member + " - " + args.ErrorContext.Error.Message);
|
||||
@@ -540,7 +540,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
"{'badarray':[0,x,2],'goodarray':[0,1,2]}",
|
||||
new JsonSerializerSettings
|
||||
{
|
||||
SpecialPropertyHandling = SpecialPropertyHandling.Default,
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.Default,
|
||||
Error = (sender, arg) =>
|
||||
{
|
||||
errors.Add(arg.ErrorContext.Error.Message);
|
||||
@@ -570,7 +570,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
JsonSerializer jsonSerializer = JsonSerializer.Create(new JsonSerializerSettings
|
||||
{
|
||||
MaxDepth = maxDepth,
|
||||
SpecialPropertyHandling = SpecialPropertyHandling.Default
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.Default
|
||||
});
|
||||
jsonSerializer.Error += (sender, e) =>
|
||||
{
|
||||
@@ -601,7 +601,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
const int maxDepth = 256;
|
||||
using (var jsonTextReader = new JsonTextReader(new StringReader(input)) { MaxDepth = maxDepth })
|
||||
{
|
||||
JsonSerializer jsonSerializer = JsonSerializer.Create(new JsonSerializerSettings { MaxDepth = maxDepth, SpecialPropertyHandling = SpecialPropertyHandling.Default });
|
||||
JsonSerializer jsonSerializer = JsonSerializer.Create(new JsonSerializerSettings { MaxDepth = maxDepth, MetadataPropertyHandling = MetadataPropertyHandling.Default });
|
||||
jsonSerializer.Error += (sender, e) =>
|
||||
{
|
||||
errors.Add(e.ErrorContext.Error.Message);
|
||||
@@ -641,7 +641,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
errors.Add(e.ErrorContext.Error.Message);
|
||||
e.ErrorContext.Handled = true;
|
||||
},
|
||||
SpecialPropertyHandling = SpecialPropertyHandling.Default
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.Default
|
||||
});
|
||||
Assert.AreEqual(true, newDynamicObject.Explicit);
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ Newtonsoft.Json Error: 0 : Error!
|
||||
{
|
||||
TraceWriter = traceWriter,
|
||||
Converters = { new JavaScriptDateTimeConverter() },
|
||||
SpecialPropertyHandling = SpecialPropertyHandling.Default
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.Default
|
||||
});
|
||||
|
||||
Console.WriteLine(traceWriter);
|
||||
@@ -403,7 +403,7 @@ Newtonsoft.Json Error: 0 : Error!
|
||||
new JsonSerializerSettings
|
||||
{
|
||||
PreserveReferencesHandling = PreserveReferencesHandling.All,
|
||||
SpecialPropertyHandling = SpecialPropertyHandling.Default,
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.Default,
|
||||
TraceWriter = traceWriter
|
||||
});
|
||||
|
||||
@@ -523,7 +523,7 @@ Newtonsoft.Json Error: 0 : Error!
|
||||
JsonConvert.DeserializeObject(json, null, new JsonSerializerSettings
|
||||
{
|
||||
TypeNameHandling = TypeNameHandling.All,
|
||||
SpecialPropertyHandling = SpecialPropertyHandling.Default,
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.Default,
|
||||
TraceWriter = traceWriter
|
||||
});
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
{
|
||||
var reader = new JsonTextReader(new StringReader(sb.ToString()));
|
||||
var ser = new JsonSerializer();
|
||||
ser.SpecialPropertyHandling = SpecialPropertyHandling.Default;
|
||||
ser.MetadataPropertyHandling = MetadataPropertyHandling.Default;
|
||||
ser.Deserialize<bool>(reader);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user