-Fixed MetadataTypeAttribute reflection bug by using CustomAttributeData

-Fixed immutable collections bug by getting type from known assembly
-Added support from running tests on aspnetcore50
This commit is contained in:
James Newton-King
2014-10-18 00:00:26 +13:00
parent 4d09aca2c1
commit 88eeb8ba92
111 changed files with 1193 additions and 573 deletions
@@ -26,12 +26,16 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json.Serialization;
#if !NETFX_CORE
using NUnit.Framework;
#else
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
using Newtonsoft.Json.Tests.TestObjects;
using Newtonsoft.Json.Linq;
@@ -101,7 +105,7 @@ namespace Newtonsoft.Json.Tests.Serialization
string json = o.ToString();
}
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
#pragma warning disable 618
[Test]
public void MemberSearchFlags()
@@ -26,13 +26,16 @@
using System;
using System.Reflection;
using Newtonsoft.Json.Tests.TestObjects;
#if !NETFX_CORE
using NUnit.Framework;
#else
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
namespace Newtonsoft.Json.Tests.Serialization
@@ -27,12 +27,16 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization;
#if !NETFX_CORE
using NUnit.Framework;
#else
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
#if NET20
using Newtonsoft.Json.Utilities.LinqBridge;
@@ -547,7 +551,7 @@ namespace Newtonsoft.Json.Tests.Serialization
}", startingWithB);
}
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
#pragma warning disable 618
[Test]
public void SerializeCompilerGeneratedMembers()
@@ -32,12 +32,16 @@ using System.Runtime.Serialization.Json;
#endif
using System.Text;
using Newtonsoft.Json.Tests.TestObjects;
#if !NETFX_CORE
using NUnit.Framework;
#else
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
using Newtonsoft.Json.Utilities;
@@ -23,17 +23,27 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NET35 || NET20 || ASPNETCORE50)
using Autofac;
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json.Tests.TestObjects;
#if !(NET35 || NET20)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.FSharp.Collections;
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
namespace Newtonsoft.Json.Tests.Serialization
{
@@ -23,6 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50)
using System.Reflection;
using System.Reflection.Emit;
using Newtonsoft.Json.Serialization;
@@ -30,12 +31,16 @@ using Newtonsoft.Json.Tests.TestObjects;
using System;
using System.Linq;
#if !NETFX_CORE
using NUnit.Framework;
#else
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
namespace Newtonsoft.Json.Tests.Serialization
@@ -280,4 +285,5 @@ namespace Newtonsoft.Json.Tests.Serialization
propertyBuilder.SetSetMethod(backingSet);
}
}
}
}
#endif
@@ -37,13 +37,16 @@ using System.Text;
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json.Tests.TestObjects;
using Newtonsoft.Json.Utilities;
#if !NETFX_CORE
using NUnit.Framework;
#else
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
namespace Newtonsoft.Json.Tests.Serialization
@@ -23,21 +23,24 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NET35 || NET20 || NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
using Newtonsoft.Json.Serialization;
#if !(NET35 || NET20 || NETFX_CORE || PORTABLE || PORTABLE40)
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Newtonsoft.Json.Converters;
#if !NETFX_CORE
using NUnit.Framework;
#else
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
namespace Newtonsoft.Json.Tests.Serialization
@@ -28,12 +28,16 @@ using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Tests.TestObjects;
#if !NETFX_CORE
using NUnit.Framework;
#else
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
namespace Newtonsoft.Json.Tests.Serialization
@@ -23,14 +23,14 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NET35 || NET20 || NETFX_CORE)
#if !(NET35 || NET20 || NETFX_CORE || ASPNETCORE50)
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.FSharp.Collections;
using NUnit.Framework;
namespace Newtonsoft.Json.Tests.Serialization
{
@@ -30,12 +30,16 @@ using System.Collections.Immutable;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#if !NETFX_CORE
using NUnit.Framework;
#else
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
using Newtonsoft.Json.Linq;
@@ -61,6 +65,9 @@ namespace Newtonsoft.Json.Tests.Serialization
""II"",
""3""
]", json);
Console.WriteLine("Serialized immutable list:");
Console.WriteLine(json);
}
[Test]
@@ -99,6 +106,10 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual("Volibear", champions[0]);
Assert.AreEqual("Teemo", champions[1]);
Assert.AreEqual("Katarina", champions[2]);
Console.WriteLine("Deserialized immutable list:");
Console.WriteLine(string.Join(", ", champions));
}
#endregion
@@ -23,12 +23,16 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !NETFX_CORE
using NUnit.Framework;
#else
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json.Tests.TestObjects;
@@ -25,7 +25,7 @@
using System;
using System.Collections;
#if !(NET35 || NET20 || PORTABLE || PORTABLE40)
#if !(NET35 || NET20 || PORTABLE || ASPNETCORE50 || PORTABLE40)
using System.Collections.Concurrent;
#endif
using System.Collections.Generic;
@@ -40,12 +40,16 @@ using System.Linq;
using System.Text;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Tests.TestObjects;
#if !NETFX_CORE
using NUnit.Framework;
#else
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
namespace Newtonsoft.Json.Tests.Serialization
@@ -541,7 +545,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual(3, v2["Third"]);
}
#if !(NET35 || NET20 || PORTABLE || PORTABLE40)
#if !(NET35 || NET20 || PORTABLE || ASPNETCORE50 || PORTABLE40)
[Test]
public void DeserializeConcurrentDictionary()
{
@@ -1255,7 +1259,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual(1, (int)((JObject)o.Data[2])["one"]);
}
#if !NETFX_CORE
#if !(NETFX_CORE || ASPNETCORE50)
[Test]
public void SerializeArrayAsArrayList()
{
@@ -29,10 +29,10 @@ using System.ComponentModel;
using System.Collections.Concurrent;
#endif
using System.Collections.Generic;
#if !(NET20 || NET35 || PORTABLE)
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50)
using System.Numerics;
#endif
#if !NET20 && !NETFX_CORE
#if !(NET20 || NETFX_CORE || ASPNETCORE50)
using System.ComponentModel.DataAnnotations;
using System.Configuration;
using System.Runtime.CompilerServices;
@@ -42,12 +42,16 @@ using System.Web.Script.Serialization;
#endif
using System.Text;
using System.Text.RegularExpressions;
#if !NETFX_CORE
using NUnit.Framework;
#else
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
using Newtonsoft.Json;
using System.IO;
@@ -81,7 +85,7 @@ using Newtonsoft.Json.Utilities.LinqBridge;
#else
using System.Linq;
#endif
#if !(NETFX_CORE)
#if !(NETFX_CORE || ASPNETCORE50)
using System.Drawing;
using System.Diagnostics;
#endif
@@ -109,7 +113,7 @@ namespace Newtonsoft.Json.Tests.Serialization
public int ChildId;
}
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE || ASPNETCORE50)
[Test]
public void ReadIntegerWithError()
{
@@ -365,7 +369,7 @@ namespace Newtonsoft.Json.Tests.Serialization
serializer.ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor;
Assert.AreEqual(ConstructorHandling.AllowNonPublicDefaultConstructor, serializer.ConstructorHandling);
#if !NETFX_CORE
#if !(NETFX_CORE || ASPNETCORE50)
serializer.Context = new StreamingContext(StreamingContextStates.Other);
Assert.AreEqual(new StreamingContext(StreamingContextStates.Other), serializer.Context);
#endif
@@ -433,7 +437,7 @@ namespace Newtonsoft.Json.Tests.Serialization
serializer.TraceWriter = traceWriter;
Assert.AreEqual(traceWriter, serializer.TraceWriter);
#if !(PORTABLE || PORTABLE40 || NETFX_CORE || NET20)
#if !(PORTABLE || PORTABLE40 || NETFX_CORE || NET20 || ASPNETCORE50)
serializer.TypeNameAssemblyFormat = FormatterAssemblyStyle.Full;
Assert.AreEqual(FormatterAssemblyStyle.Full, serializer.TypeNameAssemblyFormat);
#endif
@@ -457,7 +461,7 @@ namespace Newtonsoft.Json.Tests.Serialization
settings.ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor;
Assert.AreEqual(ConstructorHandling.AllowNonPublicDefaultConstructor, settings.ConstructorHandling);
#if !NETFX_CORE
#if !(NETFX_CORE || ASPNETCORE50)
settings.Context = new StreamingContext(StreamingContextStates.Other);
Assert.AreEqual(new StreamingContext(StreamingContextStates.Other), settings.Context);
#endif
@@ -525,7 +529,7 @@ namespace Newtonsoft.Json.Tests.Serialization
settings.TraceWriter = traceWriter;
Assert.AreEqual(traceWriter, settings.TraceWriter);
#if !(PORTABLE || PORTABLE40 || NETFX_CORE || NET20)
#if !(PORTABLE || PORTABLE40 || NETFX_CORE || NET20 || ASPNETCORE50)
settings.TypeNameAssemblyFormat = FormatterAssemblyStyle.Full;
Assert.AreEqual(FormatterAssemblyStyle.Full, settings.TypeNameAssemblyFormat);
#endif
@@ -549,7 +553,7 @@ namespace Newtonsoft.Json.Tests.Serialization
serializerProxy.ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor;
Assert.AreEqual(ConstructorHandling.AllowNonPublicDefaultConstructor, serializerProxy.ConstructorHandling);
#if !NETFX_CORE
#if !(NETFX_CORE || ASPNETCORE50)
serializerProxy.Context = new StreamingContext(StreamingContextStates.Other);
Assert.AreEqual(new StreamingContext(StreamingContextStates.Other), serializerProxy.Context);
#endif
@@ -617,7 +621,7 @@ namespace Newtonsoft.Json.Tests.Serialization
serializerProxy.TraceWriter = traceWriter;
Assert.AreEqual(traceWriter, serializerProxy.TraceWriter);
#if !(PORTABLE || PORTABLE40 || NETFX_CORE || NET20)
#if !(PORTABLE || PORTABLE40 || NETFX_CORE || NET20 || ASPNETCORE50)
serializerProxy.TypeNameAssemblyFormat = FormatterAssemblyStyle.Full;
Assert.AreEqual(FormatterAssemblyStyle.Full, serializerProxy.TypeNameAssemblyFormat);
#endif
@@ -626,7 +630,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual(TypeNameHandling.All, serializerProxy.TypeNameHandling);
}
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(NETFX_CORE || PORTABLE || PORTABLE40 || ASPNETCORE50)
[Test]
public void DeserializeISerializableIConvertible()
{
@@ -768,7 +772,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual("value", deserialized.foo.bar);
}
#if !NETFX_CORE
#if !(NETFX_CORE || ASPNETCORE50)
[Test]
public void ConversionOperator()
{
@@ -1196,7 +1200,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual(executorObject2.clientGetResultFunction, "ClientBanSubsCB");
}
#if !NETFX_CORE
#if !(NETFX_CORE || ASPNETCORE50)
[Test]
public void HashtableDeserialization()
{
@@ -1405,7 +1409,7 @@ keyword such as type of business.""
{
string json = @"[""vvv\/vvv\tvvv\""vvv\bvvv\nvvv\rvvv\\vvv\fvvv""]";
#if !NETFX_CORE
#if !(NETFX_CORE || ASPNETCORE50)
JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
List<string> javaScriptSerializerResult = javaScriptSerializer.Deserialize<List<string>>(json);
#endif
@@ -1417,7 +1421,7 @@ keyword such as type of business.""
Assert.AreEqual(1, jsonNetResult.Count);
Assert.AreEqual(dataContractResult[0], jsonNetResult[0]);
#if !NETFX_CORE
#if !(NETFX_CORE || ASPNETCORE50)
Assert.AreEqual(javaScriptSerializerResult[0], jsonNetResult[0]);
#endif
}
@@ -1636,7 +1640,7 @@ keyword such as type of business.""
string json = JsonConvert.SerializeObject(new ConverableMembers(), Formatting.Indented);
string expected = null;
#if !(NETFX_CORE || PORTABLE)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50)
expected = @"{
""String"": ""string"",
""Int32"": 2147483647,
@@ -1676,7 +1680,7 @@ keyword such as type of business.""
ConverableMembers c = JsonConvert.DeserializeObject<ConverableMembers>(json);
Assert.AreEqual("string", c.String);
Assert.AreEqual(double.MaxValue, c.Double);
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
Assert.AreEqual(DBNull.Value, c.DBNull);
#endif
}
@@ -2523,7 +2527,7 @@ keyword such as type of business.""
Assert.AreEqual("titleId", n.FidOrder[n.FidOrder.Count - 1]);
}
#if !(NET20 || NETFX_CORE)
#if !(NET20 || NETFX_CORE || ASPNETCORE50 || PORTABLE40)
[MetadataType(typeof(OptInClassMetadata))]
public class OptInClass
{
@@ -2911,7 +2915,7 @@ To fix this error either change the JSON to a JSON object (e.g. {""name"":""valu
Path '', line 1, position 1.");
}
#if !(NETFX_CORE || PORTABLE)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50)
[Test]
public void CannotDeserializeArrayIntoSerializable()
{
@@ -3028,7 +3032,7 @@ Path '', line 1, position 1.");
{
ContractResolver = new DefaultContractResolver
{
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
IgnoreSerializableAttribute = true
#endif
}
@@ -3045,7 +3049,7 @@ Path '', line 1, position 1.");
{
ContractResolver = new DefaultContractResolver
{
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
IgnoreSerializableAttribute = true
#endif
}
@@ -3062,7 +3066,7 @@ Path '', line 1, position 1.");
{
ContractResolver = new DefaultContractResolver
{
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
IgnoreSerializableAttribute = true
#endif
}
@@ -3079,7 +3083,7 @@ Path '', line 1, position 1.");
{
ContractResolver = new DefaultContractResolver
{
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
IgnoreSerializableAttribute = true
#endif
}
@@ -3587,19 +3591,15 @@ Path '', line 1, position 1.");
public TimeSpan TimeSpanProperty { get; set; }
public Guid GuidProperty { get; set; }
public Animal AnimalProperty { get; set; }
public Exception ExceptionProperty { get; set; }
}
[Test]
public void DataContractJsonSerializerTest()
{
Exception ex = new Exception("Blah blah blah");
DataContractJsonSerializerTestClass c = new DataContractJsonSerializerTestClass();
c.TimeSpanProperty = new TimeSpan(200, 20, 59, 30, 900);
c.GuidProperty = new Guid("66143115-BE2A-4a59-AF0A-348E1EA15B1E");
c.AnimalProperty = new Human() { Ethnicity = "European" };
c.ExceptionProperty = ex;
MemoryStream ms = new MemoryStream();
DataContractJsonSerializer serializer = new DataContractJsonSerializer(
@@ -3756,7 +3756,7 @@ Path '', line 1, position 1.");
Assert.AreEqual("value", newModelStateDictionary["key"]);
}
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
public class ISerializableTestObject : ISerializable
{
internal string _stringValue;
@@ -4081,7 +4081,7 @@ To fix this error either change the environment to be fully trusted, change the
}", json);
}
#if !PORTABLE
#if !(PORTABLE || ASPNETCORE50)
[Test]
public void DeserializeClassWithInheritedProtectedMember()
{
@@ -4282,7 +4282,7 @@ To fix this error either change the environment to be fully trusted, change the
}
#endif
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
[Test]
public void SerializeDeserializeXmlNodeProperties()
{
@@ -4354,7 +4354,7 @@ To fix this error either change the environment to be fully trusted, change the
public override bool CanConvert(Type objectType)
{
return objectType.IsAssignableFrom(typeof(Pos));
return objectType == typeof(Pos);
}
}
@@ -4377,7 +4377,7 @@ To fix this error either change the environment to be fully trusted, change the
public override bool CanConvert(Type objectType)
{
return objectType.IsAssignableFrom(typeof(PosDouble));
return objectType == typeof(PosDouble);
}
}
@@ -4604,7 +4604,7 @@ To fix this error either change the environment to be fully trusted, change the
Assert.AreEqual(0, z[1].Prop1.Length);
}
#if !NET20 && !NETFX_CORE
#if !(NET20 || NETFX_CORE || ASPNETCORE50)
public class StringDictionaryTestClass
{
public StringDictionary StringDictionaryProperty { get; set; }
@@ -4918,7 +4918,7 @@ To fix this error either change the environment to be fully trusted, change the
Assert.AreEqual(meh.IDontWork, "meh");
}
#if !(NET20 || NETFX_CORE)
#if !(NET20 || NETFX_CORE || ASPNETCORE50)
[DataContract]
public struct StructISerializable : ISerializable
{
@@ -5660,7 +5660,7 @@ To fix this error either change the environment to be fully trusted, change the
}
}
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
[Test]
public void SerializeException1()
{
@@ -5887,7 +5887,7 @@ To fix this error either change the environment to be fully trusted, change the
Assert.AreEqual(-3, StaticTestClass.z);
}
#if !(NET20 || NETFX_CORE)
#if !(NET20 || NETFX_CORE || ASPNETCORE50)
[Test]
public void DeserializeDecimalsWithCulture()
{
@@ -5984,7 +5984,7 @@ To fix this error either change the environment to be fully trusted, change the
ExceptionAssert.Throws<JsonSerializationException>(() => { List<int> numbers = JsonConvert.DeserializeObject<List<int>>(json); }, "Error converting value {null} to type 'System.Int32'. Path '[3]', line 5, position 7.");
}
#if !(PORTABLE || NETFX_CORE)
#if !(PORTABLE || ASPNETCORE50 || NETFX_CORE)
public class ConvertableIntTestClass
{
public ConvertibleInt Integer { get; set; }
@@ -6341,7 +6341,7 @@ To fix this error either change the environment to be fully trusted, change the
}
#endif
#if !(NETFX_CORE)
#if !(NETFX_CORE || ASPNETCORE50)
[Test]
public void MetroBlogPost()
{
@@ -6702,7 +6702,7 @@ To fix this error either change the environment to be fully trusted, change the
Assert.AreEqual("", s);
}
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
[Test]
public void SerializeAndDeserializeWithAttributes()
{
@@ -6863,7 +6863,7 @@ To fix this error either change the environment to be fully trusted, change the
ExceptionAssert.Throws<JsonReaderException>(() => { s.Deserialize<Dictionary<string, int>>(new JsonTextReader(new StringReader(json))); }, "Additional text encountered after finished reading JSON content: {. Path '', line 1, position 7.");
}
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
[Test]
public void DeserializeException()
{
@@ -7047,7 +7047,7 @@ To fix this error either change the environment to be fully trusted, change the
}
#if !(NET20 || NET35 || NET40 || PORTABLE40)
#if !PORTABLE
#if !(PORTABLE || ASPNETCORE50)
[Test]
public void DeserializeReadOnlyListWithBigInteger()
{
@@ -7105,7 +7105,7 @@ To fix this error either change the environment to be fully trusted, change the
Action doStuff = () => { obj = JsonConvert.DeserializeObject<MyTuple<int>>(json); };
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
doStuff();
Assert.AreEqual(500, obj.Item1);
#else
@@ -7115,7 +7115,7 @@ To fix this error either change the environment to be fully trusted, change the
#endif
}
#if DEBUG
#if DEBUG && !NOINTERNALS
[Test]
public void SerializeCustomTupleWithSerializableAttributeInPartialTrust()
{
@@ -7136,7 +7136,7 @@ To fix this error either change the environment to be fully trusted, change the
}
#endif
#if !(NETFX_CORE || PORTABLE || NET35 || NET20 || PORTABLE40)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || NET35 || NET20 || PORTABLE40)
[Test]
public void SerializeTupleWithSerializableAttribute()
{
@@ -7382,7 +7382,7 @@ To fix this error either change the environment to be fully trusted, change the
}
#endif
#if !(PORTABLE || NET35 || NET20 || PORTABLE40)
#if !(PORTABLE || ASPNETCORE50 || NET35 || NET20 || PORTABLE40)
[Test]
public void ReadTooLargeInteger()
{
@@ -7396,7 +7396,7 @@ To fix this error either change the environment to be fully trusted, change the
}
#endif
#if !NETFX_CORE
#if !(NETFX_CORE || ASPNETCORE50)
[Serializable]
#endif
[DataContract]
@@ -7425,7 +7425,7 @@ To fix this error either change the environment to be fully trusted, change the
Assert.AreEqual(@"{""First"":""One"",""Second"":2}", json);
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
DefaultContractResolver r = new DefaultContractResolver();
r.IgnoreSerializableAttribute = false;
@@ -7545,7 +7545,7 @@ To fix this error either change the environment to be fully trusted, change the
Assert.AreEqual(1234567890.123456m, d);
}
#if !(PORTABLE || NETFX_CORE || PORTABLE40)
#if !(PORTABLE || ASPNETCORE50 || NETFX_CORE || PORTABLE40)
[Test]
public void DontSerializeStaticFields()
{
@@ -7569,7 +7569,7 @@ To fix this error either change the environment to be fully trusted, change the
}
#endif
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50 || PORTABLE40)
[Test]
public void SerializeBigInteger()
{
@@ -7654,7 +7654,7 @@ To fix this error either change the environment to be fully trusted, change the
]", json);
}
#if !(PORTABLE || PORTABLE40 || NETFX_CORE)
#if !(PORTABLE || PORTABLE40 || NETFX_CORE || ASPNETCORE50)
[Test]
public void SerializeDictionaryWithStructKey()
{
@@ -7707,7 +7707,7 @@ To fix this error either change the environment to be fully trusted, change the
Assert.AreEqual(jane, john.Spouse);
}
#if !(NETFX_CORE || NET35 || NET20 || PORTABLE || PORTABLE40)
#if !(NETFX_CORE || NET35 || NET20 || PORTABLE || ASPNETCORE50 || PORTABLE40)
[Test]
public void TypeConverterOnInterface()
{
@@ -7772,7 +7772,7 @@ To fix this error either change the environment to be fully trusted, change the
ParticipantEntity deserializedProduct = JsonConvert.DeserializeObject<ParticipantEntity>(json);
}
#if !(PORTABLE || NETFX_CORE)
#if !(PORTABLE || ASPNETCORE50 || NETFX_CORE)
public class ConvertibleId : IConvertible
{
public int Value;
@@ -30,12 +30,16 @@ using System.Text;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Tests.TestObjects;
using Newtonsoft.Json.Utilities;
#if !NETFX_CORE
using NUnit.Framework;
#else
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
namespace Newtonsoft.Json.Tests.Serialization
@@ -328,7 +332,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.IsTrue(JToken.DeepEquals(t1, t2));
}
#if !(PORTABLE || PORTABLE40)
#if !(PORTABLE || ASPNETCORE50 || PORTABLE40)
[Test]
public void DeserializeGenericObjectListWithTypeName()
{
@@ -27,13 +27,16 @@ using System;
using System.IO;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Tests.TestObjects;
#if !NETFX_CORE
using NUnit.Framework;
#else
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
namespace Newtonsoft.Json.Tests.Serialization
@@ -26,13 +26,16 @@
using System;
using System.IO;
using Newtonsoft.Json.Tests.TestObjects;
#if !NETFX_CORE
using NUnit.Framework;
#else
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
namespace Newtonsoft.Json.Tests.Serialization
@@ -27,13 +27,16 @@ using System;
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json.Tests.TestObjects;
#if !NETFX_CORE
using NUnit.Framework;
#else
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
namespace Newtonsoft.Json.Tests.Serialization
@@ -30,13 +30,16 @@ using System.Runtime.Serialization.Formatters;
using System.Text;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Tests.TestObjects;
#if !NETFX_CORE
using NUnit.Framework;
#else
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
namespace Newtonsoft.Json.Tests.Serialization
@@ -88,7 +91,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual(2, circularDictionary.Count);
Assert.AreEqual(1, circularDictionary["other"].Count);
Assert.AreEqual(circularDictionary, circularDictionary["self"]);
Assert.IsTrue(ReferenceEquals(circularDictionary, circularDictionary["self"]));
}
public class CircularList : List<CircularList>
@@ -25,12 +25,16 @@
using System;
using System.Collections.Generic;
#if !NETFX_CORE
using NUnit.Framework;
#else
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
#if !(NET20 || NET35)
using System.Dynamic;
@@ -149,7 +153,7 @@ namespace Newtonsoft.Json.Tests.Serialization
}", json);
}
#if !(PORTABLE || NETFX_CORE || PORTABLE40)
#if !(PORTABLE || ASPNETCORE50 || NETFX_CORE || PORTABLE40)
public class MainClass : ISerializable
{
public ChildClass Child { get; set; }
@@ -35,12 +35,16 @@ using Newtonsoft.Json.Utilities.LinqBridge;
#else
using System.Linq;
#endif
#if !NETFX_CORE
using NUnit.Framework;
#else
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
using System.IO;
using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs;
@@ -37,12 +37,16 @@ using System.Runtime.Serialization;
using System.Text;
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json.Tests.TestObjects;
#if !NETFX_CORE
using NUnit.Framework;
#else
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Utilities;
@@ -282,7 +286,7 @@ namespace Newtonsoft.Json.Tests.Serialization
}", json);
}
#if !(NETFX_CORE || PORTABLE)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50)
public class SerializationEventContextTestObject
{
public string TestMember { get; set; }
@@ -313,7 +317,7 @@ namespace Newtonsoft.Json.Tests.Serialization
}
#endif
#if !PORTABLE
#if !(PORTABLE || ASPNETCORE50)
public void WhenSerializationErrorDetectedBySerializer_ThenCallbackIsCalled()
{
// Verify contract is properly finding our callback
@@ -29,12 +29,16 @@ using System.Globalization;
using System.IO;
using System.Text;
using Newtonsoft.Json.Serialization;
#if !NETFX_CORE
using NUnit.Framework;
#else
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
namespace Newtonsoft.Json.Tests.Serialization
@@ -4,18 +4,22 @@ using System.Diagnostics;
using System.Globalization;
using System.IO;
using Newtonsoft.Json.Linq;
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50 || PORTABLE40)
using System.Numerics;
#endif
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters;
using System.Text;
#if !NETFX_CORE
using NUnit.Framework;
#else
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
@@ -39,7 +43,7 @@ namespace Newtonsoft.Json.Tests.Serialization
[TestFixture]
public class TraceWriterTests : TestFixtureBase
{
#if !(PORTABLE || NETFX_CORE || PORTABLE40)
#if !(PORTABLE || ASPNETCORE50 || NETFX_CORE || PORTABLE40)
[Test]
public void DiagnosticsTraceWriterTest()
{
@@ -602,7 +606,7 @@ Newtonsoft.Json Error: 0 : Error!
Assert.IsTrue(traceWriter.TraceRecords[9].Message.StartsWith("Finished deserializing System.Collections.Generic.List`1[System.Object]. Path '$values'"));
}
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
[Test]
public void DeserializeISerializable()
{
@@ -808,7 +812,7 @@ Newtonsoft.Json Error: 0 : Error!
Assert.AreEqual(23, deserialized.FavoriteNumber);
}
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50 || PORTABLE40)
[Test]
public void TraceJsonWriterTest()
{
@@ -23,31 +23,35 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(PORTABLE || PORTABLE40)
#if !(NET35 || NET20 || PORTABLE)
#if !(PORTABLE || ASPNETCORE50 || PORTABLE40)
#if !(NET35 || NET20 || PORTABLE || ASPNETCORE50)
using System.Dynamic;
#endif
using System.Text;
using Newtonsoft.Json.Tests.Linq;
using global::System;
using global::System.Collections;
using global::System.Collections.Generic;
using global::System.Globalization;
using global::System.Runtime.Serialization.Formatters;
using global::Newtonsoft.Json.Linq;
using global::Newtonsoft.Json.Serialization;
using global::Newtonsoft.Json.Tests.TestObjects;
#if !NETFX_CORE
using global::NUnit.Framework;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.Serialization.Formatters;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json.Tests.TestObjects;
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using global::Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = global::Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = global::Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
using NUnit.Framework;
#endif
using global::Newtonsoft.Json.Utilities;
using global::System.Net;
using global::System.Runtime.Serialization;
using global::System.IO;
using Newtonsoft.Json.Utilities;
using System.Net;
using System.Runtime.Serialization;
using System.IO;
namespace Newtonsoft.Json.Tests.Serialization
{
@@ -259,7 +263,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual("Name!", ((EmployeeReference)employee).Name);
}
#if !(NETFX_CORE || PORTABLE)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50)
[Test]
public void DeserializeTypeNameFromGacAssembly()
{
@@ -1097,7 +1101,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Binder = new MetroBinder(),
ContractResolver = new DefaultContractResolver
{
#if !(NETFX_CORE || PORTABLE)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50)
IgnoreSerializableAttribute = true
#endif
}
@@ -30,12 +30,16 @@ using System.IO;
using System.Linq;
#endif
using System.Text;
#if !NETFX_CORE
using NUnit.Framework;
#else
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif ASPNETCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
#if !(NETFX_CORE || NET20)
using System.Runtime.Serialization.Json;
@@ -59,7 +63,7 @@ namespace Newtonsoft.Json.Tests.Serialization
nonSerializedField = "Error"
};
#if !(NETFX_CORE || NET20 || PORTABLE || PORTABLE40)
#if !(NETFX_CORE || NET20 || PORTABLE || ASPNETCORE50 || PORTABLE40)
MemoryStream ms = new MemoryStream();
DataContractJsonSerializer dataContractJsonSerializer = new DataContractJsonSerializer(typeof(SerializableType));
dataContractJsonSerializer.WriteObject(ms, serializableType);
@@ -75,7 +79,7 @@ namespace Newtonsoft.Json.Tests.Serialization
{
ContractResolver = new DefaultContractResolver
{
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
IgnoreSerializableAttribute = false
#endif
}
@@ -84,7 +88,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual(expected, json);
}
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
[Test]
public void SerializeInheritedType()
{
@@ -114,7 +118,7 @@ namespace Newtonsoft.Json.Tests.Serialization
}
}
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
[Serializable]
#else
[JsonObject(MemberSerialization.Fields)]
@@ -138,7 +142,7 @@ namespace Newtonsoft.Json.Tests.Serialization
set { privateField = value; }
}
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
[NonSerialized]
#else
[JsonIgnore]