-Tests
This commit is contained in:
@@ -41,7 +41,9 @@ using System.Linq;
|
||||
#endif
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
@@ -1561,7 +1563,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
});
|
||||
|
||||
StringAssert.AreEqual(@"{
|
||||
""$type"": ""System.Collections.Generic.List`1[[Newtonsoft.Json.Tests.TestObjects.Event1[,], Newtonsoft.Json.Tests]], mscorlib"",
|
||||
""$type"": """ + ReflectionUtils.GetTypeName(typeof(List<Event1[,]>), 0, DefaultSerializationBinder.Instance) + @""",
|
||||
""$values"": [
|
||||
{
|
||||
""$type"": ""Newtonsoft.Json.Tests.TestObjects.Event1[,], Newtonsoft.Json.Tests"",
|
||||
|
||||
@@ -7234,7 +7234,7 @@ Path '', line 1, position 1.");
|
||||
""Longitude"": -117.766684,
|
||||
""TimeStamp"": ""2000-03-01T23:59:59Z"",
|
||||
""Payload"": {
|
||||
""$type"": ""System.Byte[], mscorlib"",
|
||||
""$type"": """ + ReflectionUtils.GetTypeName(typeof(byte[]), 0, DefaultSerializationBinder.Instance) + @""",
|
||||
""$value"": ""AAECAwQFBgcICQ==""
|
||||
}
|
||||
}", jsonString);
|
||||
|
||||
@@ -28,6 +28,7 @@ using System.Collections.Generic;
|
||||
using System.Runtime.Serialization.Formatters;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
#if NETFX_CORE
|
||||
@@ -133,7 +134,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
string serializedString = JsonConvert.SerializeObject(inputContext, jsonSerializerSettings);
|
||||
|
||||
StringAssert.AreEqual(@"{
|
||||
""$type"": ""System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[System.Guid, mscorlib]], mscorlib"",
|
||||
""$type"": """ + ReflectionUtils.GetTypeName(typeof(Dictionary<string, Guid>), 0, DefaultSerializationBinder.Instance) + @""",
|
||||
""k1"": ""5dd2dba0-20c0-49f8-a054-1fa3b0a8d774""
|
||||
}", serializedString);
|
||||
|
||||
@@ -165,7 +166,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
""Longitude"": -117.766684,
|
||||
""TimeStamp"": ""2000-03-01T23:59:59Z"",
|
||||
""Payload"": {
|
||||
""$type"": ""System.Byte[], mscorlib"",
|
||||
""$type"": """ + ReflectionUtils.GetTypeName(typeof(byte[]), 0, DefaultSerializationBinder.Instance) + @""",
|
||||
""$value"": ""AAECAwQFBgcICQ==""
|
||||
}
|
||||
}", jsonString);
|
||||
|
||||
@@ -29,7 +29,9 @@ using System.IO;
|
||||
using System.Runtime.Serialization.Formatters;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
@@ -116,7 +118,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
""$type"": ""Newtonsoft.Json.Tests.Serialization.PreserveReferencesHandlingTests+Container, Newtonsoft.Json.Tests"",
|
||||
""ListA"": {
|
||||
""$id"": ""2"",
|
||||
""$type"": ""System.Collections.Generic.List`1[[Newtonsoft.Json.Tests.Serialization.PreserveReferencesHandlingTests+ContentA, Newtonsoft.Json.Tests]], mscorlib"",
|
||||
""$type"": """ + ReflectionUtils.GetTypeName(typeof(List<ContentA>), 0, DefaultSerializationBinder.Instance) + @""",
|
||||
""$values"": [
|
||||
{
|
||||
""$id"": ""3"",
|
||||
@@ -127,7 +129,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
},
|
||||
""ListB"": {
|
||||
""$id"": ""4"",
|
||||
""$type"": ""System.Collections.Generic.List`1[[Newtonsoft.Json.Tests.Serialization.PreserveReferencesHandlingTests+ContentA, Newtonsoft.Json.Tests]], mscorlib"",
|
||||
""$type"": """ + ReflectionUtils.GetTypeName(typeof(List<ContentA>), 0, DefaultSerializationBinder.Instance) + @""",
|
||||
""$values"": [
|
||||
{
|
||||
""$ref"": ""3""
|
||||
|
||||
@@ -24,6 +24,7 @@ using NUnit.Framework;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
#if NET20
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
@@ -551,12 +552,12 @@ Newtonsoft.Json Error: 0 : Error!
|
||||
});
|
||||
|
||||
Assert.AreEqual("Started serializing System.Collections.Generic.List`1[System.Object]. Path ''.", traceWriter.TraceRecords[0].Message);
|
||||
Assert.AreEqual("Writing type name 'System.Collections.Generic.List`1[[System.Object, mscorlib]], mscorlib' for System.Collections.Generic.List`1[System.Object]. Path ''.", traceWriter.TraceRecords[1].Message);
|
||||
Assert.AreEqual("Writing type name '" + ReflectionUtils.GetTypeName(typeof(List<object>), 0, DefaultSerializationBinder.Instance) + "' for System.Collections.Generic.List`1[System.Object]. Path ''.", traceWriter.TraceRecords[1].Message);
|
||||
Assert.AreEqual("Started serializing System.Collections.Generic.Dictionary`2[System.String,System.String]. Path '$values'.", traceWriter.TraceRecords[2].Message);
|
||||
Assert.AreEqual("Writing type name 'System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[System.String, mscorlib]], mscorlib' for System.Collections.Generic.Dictionary`2[System.String,System.String]. Path '$values[0]'.", traceWriter.TraceRecords[3].Message);
|
||||
Assert.AreEqual("Writing type name '" + ReflectionUtils.GetTypeName(typeof(Dictionary<string, string>), 0, DefaultSerializationBinder.Instance) + "' for System.Collections.Generic.Dictionary`2[System.String,System.String]. Path '$values[0]'.", traceWriter.TraceRecords[3].Message);
|
||||
Assert.AreEqual("Finished serializing System.Collections.Generic.Dictionary`2[System.String,System.String]. Path '$values[0]'.", traceWriter.TraceRecords[4].Message);
|
||||
Assert.AreEqual("Started serializing System.Version. Path '$values[0]'.", traceWriter.TraceRecords[5].Message);
|
||||
Assert.AreEqual("Writing type name 'System.Version, mscorlib' for System.Version. Path '$values[1]'.", traceWriter.TraceRecords[6].Message);
|
||||
Assert.AreEqual("Writing type name '" + ReflectionUtils.GetTypeName(typeof(Version), 0, DefaultSerializationBinder.Instance) + "' for System.Version. Path '$values[1]'.", traceWriter.TraceRecords[6].Message);
|
||||
Assert.AreEqual("Finished serializing System.Version. Path '$values[1]'.", traceWriter.TraceRecords[7].Message);
|
||||
Assert.AreEqual("Finished serializing System.Collections.Generic.List`1[System.Object]. Path ''.", traceWriter.TraceRecords[8].Message);
|
||||
}
|
||||
|
||||
@@ -89,14 +89,14 @@
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"type": "platform",
|
||||
"version": "1.0.0-rc2-3002702"
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"System.Runtime.Serialization.Primitives": "4.1.1",
|
||||
"System.Xml.XmlSerializer": "4.0.11",
|
||||
"System.Runtime.Serialization.Json": "4.0.2",
|
||||
"System.Runtime.Serialization.Xml": "4.1.1",
|
||||
"xunit": "2.1.0",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-build10025"
|
||||
"dotnet-test-xunit": "2.2.0-preview2-build1029"
|
||||
},
|
||||
"imports": [
|
||||
"dnxcore50",
|
||||
|
||||
Reference in New Issue
Block a user