Clean up NETFX_CORE directive usage

This commit is contained in:
Pyit Phyo Aung
2016-10-11 14:14:13 +13:00
parent e74d6c5a4b
commit f50f276b76
121 changed files with 218 additions and 1441 deletions
@@ -26,11 +26,7 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json.Serialization;
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -26,11 +26,7 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json.Serialization;
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -105,7 +101,7 @@ namespace Newtonsoft.Json.Tests.Serialization
string json = o.ToString();
}
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(PORTABLE || PORTABLE40)
#pragma warning disable 618
[Test]
public void MemberSearchFlags()
@@ -29,11 +29,7 @@ using System.ComponentModel;
using System.Reflection;
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 DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -28,11 +28,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Runtime.Serialization;
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -568,7 +564,7 @@ namespace Newtonsoft.Json.Tests.Serialization
}", startingWithB);
}
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
#if !(PORTABLE || PORTABLE40)
#pragma warning disable 618
[Test]
public void SerializeCompilerGeneratedMembers()
@@ -27,16 +27,12 @@ using System;
using System.ComponentModel;
using System.IO;
using System.Runtime.Serialization;
#if !(NET20 || NET35 || NETFX_CORE || PORTABLE || DNXCORE50)
#if !(NET20 || NET35 || PORTABLE || DNXCORE50)
using System.Runtime.Serialization.Json;
#endif
using System.Text;
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 DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -278,7 +274,7 @@ namespace Newtonsoft.Json.Tests.Serialization
{
EmitDefaultValueClass c = new EmitDefaultValueClass();
#if !(NET20 || NET35 || NETFX_CORE || PORTABLE)
#if !(NET20 || NET35 || PORTABLE)
DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(EmitDefaultValueClass));
MemoryStream ms = new MemoryStream();
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NET40 || NET35 || NET20 || DNXCORE50 || PORTABLE || PORTABLE40 || NETFX_CORE)
#if !(NET40 || NET35 || NET20 || DNXCORE50 || PORTABLE || PORTABLE40)
using Autofac;
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json.Tests.TestObjects;
@@ -36,11 +36,7 @@ using System.Threading.Tasks;
using Autofac.Core;
using Autofac.Core.Activators.Reflection;
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 DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NETFX_CORE || PORTABLE || DNXCORE50)
#if !(PORTABLE || DNXCORE50)
using System.Reflection;
using System.Reflection.Emit;
using Newtonsoft.Json.Serialization;
@@ -34,11 +34,7 @@ using Newtonsoft.Json.Utilities.LinqBridge;
#else
using System.Linq;
#endif
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -37,11 +37,7 @@ using System.Text;
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;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NET35 || NET20 || NETFX_CORE || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(NET35 || NET20 || PORTABLE || DNXCORE50 || PORTABLE40)
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;
@@ -31,11 +31,7 @@ using System.Data;
using System.Linq;
using System.Text;
using Newtonsoft.Json.Converters;
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -29,11 +29,7 @@ using System.IO;
using System.Text;
using Newtonsoft.Json.Linq;
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 DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if !(NET35 || NET20 || NETFX_CORE || DNXCORE50)
#if !(NET35 || NET20 || DNXCORE50)
using NUnit.Framework;
using System;
using System.Collections.Generic;
@@ -30,11 +30,7 @@ using System.Collections.Immutable;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -23,11 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -44,11 +44,7 @@ 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;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -304,7 +300,7 @@ namespace Newtonsoft.Json.Tests.Serialization
}
#endif
#if !(NETFX_CORE || DNXCORE50)
#if !(DNXCORE50)
public class NameValueCollectionTestClass
{
public NameValueCollection Collection { get; set; }
@@ -1675,7 +1671,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual(1, (int)((JObject)o.Data[2])["one"]);
}
#if !(NETFX_CORE || DNXCORE50)
#if !(DNXCORE50)
[Test]
public void SerializeArrayAsArrayList()
{
@@ -32,7 +32,7 @@ using System.Collections.Generic;
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_1
using System.Numerics;
#endif
#if !(NET20 || NETFX_CORE || DNXCORE50)
#if !(NET20 || DNXCORE50)
using System.ComponentModel.DataAnnotations;
using System.Configuration;
using System.Runtime.CompilerServices;
@@ -42,11 +42,7 @@ using System.Web.Script.Serialization;
#endif
using System.Text;
using System.Text.RegularExpressions;
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -86,7 +82,7 @@ using Newtonsoft.Json.Utilities.LinqBridge;
#else
using System.Linq;
#endif
#if !(NETFX_CORE || DNXCORE50)
#if !(DNXCORE50)
using System.Drawing;
#endif
@@ -736,7 +732,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual("Name!", c2.Name);
}
#if !(NETFX_CORE || DNXCORE50 || NET20)
#if !(DNXCORE50 || NET20)
[MetadataType(typeof(CustomerValidation))]
public partial class CustomerWithMetadataType
{
@@ -1202,7 +1198,7 @@ namespace Newtonsoft.Json.Tests.Serialization
serializer.ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor;
Assert.AreEqual(ConstructorHandling.AllowNonPublicDefaultConstructor, serializer.ConstructorHandling);
#if !(NETFX_CORE || DNXCORE50)
#if !(DNXCORE50)
serializer.Context = new StreamingContext(StreamingContextStates.Other);
Assert.AreEqual(new StreamingContext(StreamingContextStates.Other), serializer.Context);
#endif
@@ -1273,7 +1269,7 @@ namespace Newtonsoft.Json.Tests.Serialization
serializer.TraceWriter = traceWriter;
Assert.AreEqual(traceWriter, serializer.TraceWriter);
#if !(PORTABLE || PORTABLE40 || NETFX_CORE || NET20 || DNXCORE50)
#if !(PORTABLE || PORTABLE40 || NET20 || DNXCORE50)
#pragma warning disable 618
serializer.TypeNameAssemblyFormat = FormatterAssemblyStyle.Full;
Assert.AreEqual(FormatterAssemblyStyle.Full, serializer.TypeNameAssemblyFormat);
@@ -1311,7 +1307,7 @@ namespace Newtonsoft.Json.Tests.Serialization
settings.ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor;
Assert.AreEqual(ConstructorHandling.AllowNonPublicDefaultConstructor, settings.ConstructorHandling);
#if !(NETFX_CORE || DNXCORE50)
#if !(DNXCORE50)
settings.Context = new StreamingContext(StreamingContextStates.Other);
Assert.AreEqual(new StreamingContext(StreamingContextStates.Other), settings.Context);
#endif
@@ -1388,7 +1384,7 @@ namespace Newtonsoft.Json.Tests.Serialization
settings.TraceWriter = traceWriter;
Assert.AreEqual(traceWriter, settings.TraceWriter);
#if !(PORTABLE || PORTABLE40 || NETFX_CORE || NET20 || DNXCORE50)
#if !(PORTABLE || PORTABLE40 || NET20 || DNXCORE50)
#pragma warning disable 618
settings.TypeNameAssemblyFormat = FormatterAssemblyStyle.Full;
Assert.AreEqual(FormatterAssemblyStyle.Full, settings.TypeNameAssemblyFormat);
@@ -1439,7 +1435,7 @@ namespace Newtonsoft.Json.Tests.Serialization
serializerProxy.ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor;
Assert.AreEqual(ConstructorHandling.AllowNonPublicDefaultConstructor, serializerProxy.ConstructorHandling);
#if !(NETFX_CORE || DNXCORE50)
#if !(DNXCORE50)
serializerProxy.Context = new StreamingContext(StreamingContextStates.Other);
Assert.AreEqual(new StreamingContext(StreamingContextStates.Other), serializerProxy.Context);
#endif
@@ -1510,7 +1506,7 @@ namespace Newtonsoft.Json.Tests.Serialization
serializerProxy.TraceWriter = traceWriter;
Assert.AreEqual(traceWriter, serializerProxy.TraceWriter);
#if !(PORTABLE || PORTABLE40 || NETFX_CORE || NET20 || DNXCORE50)
#if !(PORTABLE || PORTABLE40 || NET20 || DNXCORE50)
#pragma warning disable 618
serializerProxy.TypeNameAssemblyFormat = FormatterAssemblyStyle.Full;
Assert.AreEqual(FormatterAssemblyStyle.Full, serializerProxy.TypeNameAssemblyFormat);
@@ -1531,7 +1527,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual(TypeNameHandling.All, serializerProxy.TypeNameHandling);
}
#if !(NETFX_CORE || PORTABLE || PORTABLE40 || DNXCORE50)
#if !(PORTABLE || PORTABLE40 || DNXCORE50)
[Test]
public void DeserializeISerializableIConvertible()
{
@@ -1790,8 +1786,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.IsNotNull(deserialized.foo);
Assert.AreEqual("value", deserialized.foo.bar);
}
#if !(NETFX_CORE)
[Test]
public void ConversionOperator()
{
@@ -1815,7 +1810,6 @@ namespace Newtonsoft.Json.Tests.Serialization
var deserialize = jsonSerializer.Deserialize(new StreamReader(ms), typeof(Dictionary<DictionaryKeyCast, int>));
stopWatch.Stop();
}
#endif
internal class DictionaryKeyCast
{
@@ -2215,7 +2209,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual(executorObject2.clientGetResultFunction, "ClientBanSubsCB");
}
#if !(NETFX_CORE || DNXCORE50)
#if !(DNXCORE50)
[Test]
public void HashtableDeserialization()
{
@@ -2433,7 +2427,7 @@ keyword such as type of business.""
{
string json = @"[""vvv\/vvv\tvvv\""vvv\bvvv\nvvv\rvvv\\vvv\fvvv""]";
#if !(NETFX_CORE || DNXCORE50)
#if !(DNXCORE50)
JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
List<string> javaScriptSerializerResult = javaScriptSerializer.Deserialize<List<string>>(json);
#endif
@@ -2445,7 +2439,7 @@ keyword such as type of business.""
Assert.AreEqual(1, jsonNetResult.Count);
Assert.AreEqual(dataContractResult[0], jsonNetResult[0]);
#if !(NETFX_CORE || DNXCORE50)
#if !(DNXCORE50)
Assert.AreEqual(javaScriptSerializerResult[0], jsonNetResult[0]);
#endif
}
@@ -2656,7 +2650,7 @@ keyword such as type of business.""
string json = JsonConvert.SerializeObject(new ConverableMembers(), Formatting.Indented);
string expected = null;
#if !(NETFX_CORE || PORTABLE || DNXCORE50)
#if !(PORTABLE || DNXCORE50)
expected = @"{
""String"": ""string"",
""Int32"": 2147483647,
@@ -2696,7 +2690,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 || DNXCORE50 || PORTABLE40)
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
Assert.AreEqual(DBNull.Value, c.DBNull);
#endif
}
@@ -3540,7 +3534,7 @@ keyword such as type of business.""
Assert.AreEqual("titleId", n.FidOrder[n.FidOrder.Count - 1]);
}
#if !(NET20 || NETFX_CORE || DNXCORE50)
#if !(NET20 || DNXCORE50)
[MetadataType(typeof(OptInClassMetadata))]
public class OptInClass
{
@@ -3922,7 +3916,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 || DNXCORE50)
#if !(PORTABLE || DNXCORE50)
[Test]
public void CannotDeserializeArrayIntoSerializable()
{
@@ -4040,7 +4034,7 @@ Path '', line 1, position 1.");
{
ContractResolver = new DefaultContractResolver
{
#if !(NETFX_CORE || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
IgnoreSerializableAttribute = true
#endif
}
@@ -4057,7 +4051,7 @@ Path '', line 1, position 1.");
{
ContractResolver = new DefaultContractResolver
{
#if !(NETFX_CORE || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
IgnoreSerializableAttribute = true
#endif
}
@@ -4074,7 +4068,7 @@ Path '', line 1, position 1.");
{
ContractResolver = new DefaultContractResolver
{
#if !(NETFX_CORE || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
IgnoreSerializableAttribute = true
#endif
}
@@ -4091,7 +4085,7 @@ Path '', line 1, position 1.");
{
ContractResolver = new DefaultContractResolver
{
#if !(NETFX_CORE || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
IgnoreSerializableAttribute = true
#endif
}
@@ -4865,7 +4859,7 @@ Path '', line 1, position 1.");
Assert.AreEqual("value", newModelStateDictionary["key"]);
}
#if !(NETFX_CORE || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
public class ISerializableTestObject : ISerializable
{
internal string _stringValue;
@@ -5354,7 +5348,7 @@ Path '', line 1, position 1.");
}
#endif
#if !(NETFX_CORE || DNXCORE50)
#if !(DNXCORE50)
public class XmlNodeTestObject
{
public XmlDocument Document { get; set; }
@@ -5392,7 +5386,7 @@ Path '', line 1, position 1.");
}
#endif
#if !(NETFX_CORE || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
[Test]
public void SerializeDeserializeXmlNodeProperties()
{
@@ -5720,7 +5714,7 @@ Path '', line 1, position 1.");
Assert.AreEqual(0, z[1].Prop1.Length);
}
#if !(NET20 || NETFX_CORE || DNXCORE50)
#if !(NET20 || DNXCORE50)
public class StringDictionaryTestClass
{
public StringDictionary StringDictionaryProperty { get; set; }
@@ -6047,7 +6041,7 @@ Path '', line 1, position 1.");
Assert.AreEqual(meh.IDontWork, "meh");
}
#if !(NET20 || NETFX_CORE || DNXCORE50)
#if !(NET20 || DNXCORE50)
[DataContract]
public struct StructISerializable : ISerializable
{
@@ -6790,7 +6784,7 @@ Path '', line 1, position 1.");
}
}
#if !(NETFX_CORE || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
[Test]
public void SerializeException1()
{
@@ -7017,7 +7011,7 @@ Path '', line 1, position 1.");
Assert.AreEqual(-3, StaticTestClass.z);
}
#if !(NET20 || NETFX_CORE || DNXCORE50)
#if !(NET20 || DNXCORE50)
[Test]
public void DeserializeDecimalsWithCulture()
{
@@ -7178,7 +7172,7 @@ Path '', line 1, position 1.");
ExceptionAssert.Throws<JsonSerializationException>(() => { List<int> numbers = JsonConvert.DeserializeObject<List<int>>(json); }, "Error converting value {null} to type 'System.Int32'. Path '[3]', line 5, position 6.");
}
#if !(PORTABLE || NETFX_CORE)
#if !(PORTABLE)
public class ConvertableIntTestClass
{
public ConvertibleInt Integer { get; set; }
@@ -7537,7 +7531,7 @@ Path '', line 1, position 1.");
}
#endif
#if !(NETFX_CORE || DNXCORE50)
#if !(DNXCORE50)
[Test]
public void MetroBlogPost()
{
@@ -7931,7 +7925,7 @@ Path '', line 1, position 1.");
Assert.AreEqual("", s);
}
#if !(NETFX_CORE || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
[Test]
public void SerializeAndDeserializeWithAttributes()
{
@@ -8092,7 +8086,7 @@ Path '', line 1, position 1.");
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 || DNXCORE50 || PORTABLE40)
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
[Test]
public void DeserializeException()
{
@@ -8334,7 +8328,7 @@ Path '', line 1, position 1.");
Action doStuff = () => { obj = JsonConvert.DeserializeObject<MyTuple<int>>(json); };
#if !(NETFX_CORE || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
doStuff();
Assert.AreEqual(500, obj.Item1);
#else
@@ -8365,7 +8359,7 @@ Path '', line 1, position 1.");
}
#endif
#if !(NETFX_CORE || PORTABLE || NET35 || NET20 || PORTABLE40 || DNXCORE50)
#if !(PORTABLE || NET35 || NET20 || PORTABLE40 || DNXCORE50)
[Test]
public void SerializeTupleWithSerializableAttribute()
{
@@ -8392,29 +8386,6 @@ Path '', line 1, position 1.");
}
#endif
#if NETFX_CORE
[Test]
public void SerializeWinRTJsonObject()
{
var o = Windows.Data.Json.JsonObject.Parse(@"{
""CPU"": ""Intel"",
""Drives"": [
""DVD read/writer"",
""500 gigabyte hard drive""
]
}");
string json = JsonConvert.SerializeObject(o, Formatting.Indented);
Assert.AreEqual(@"{
""Drives"": [
""DVD read/writer"",
""500 gigabyte hard drive""
],
""CPU"": ""Intel""
}", json);
}
#endif
#if !NET20
[Test]
public void RoundtripOfDateTimeOffset()
@@ -8633,7 +8604,7 @@ Path '', line 1, position 1.");
}
#endif
#if !(NETFX_CORE || DNXCORE50)
#if !(DNXCORE50)
[Serializable]
#endif
[DataContract]
@@ -8662,7 +8633,7 @@ Path '', line 1, position 1.");
Assert.AreEqual(@"{""First"":""One"",""Second"":2}", json);
#if !(NETFX_CORE || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
DefaultContractResolver r = new DefaultContractResolver();
r.IgnoreSerializableAttribute = false;
@@ -8778,7 +8749,7 @@ Path '', line 1, position 1.");
Assert.AreEqual(1234567890.123456m, d);
}
#if !(PORTABLE || DNXCORE50 || NETFX_CORE || PORTABLE40)
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
[Test]
public void DontSerializeStaticFields()
{
@@ -8942,7 +8913,7 @@ Path '', line 1, position 1.");
]", json);
}
#if !(PORTABLE || PORTABLE40 || NETFX_CORE || DNXCORE50)
#if !(PORTABLE || PORTABLE40 || DNXCORE50)
[Test]
public void SerializeDictionaryWithStructKey()
{
@@ -9033,7 +9004,7 @@ Path '', line 1, position 1.");
Assert.AreEqual(jane, john.Spouse);
}
#if !(NETFX_CORE || NET35 || NET20 || PORTABLE || PORTABLE40)
#if !(NET35 || NET20 || PORTABLE || PORTABLE40)
[Test]
public void TypeConverterOnInterface()
{
@@ -9099,7 +9070,7 @@ Path '', line 1, position 1.");
ParticipantEntity deserializedProduct = JsonConvert.DeserializeObject<ParticipantEntity>(json);
}
#if !(PORTABLE || NETFX_CORE)
#if !(PORTABLE)
public class ConvertibleId : IConvertible
{
public int Value;
@@ -9631,7 +9602,7 @@ Path '', line 1, position 1.");
}
#endif
#if !(NETFX_CORE || DNXCORE50)
#if !(DNXCORE50)
[Test]
public void MailMessageConverterTest()
{
@@ -31,11 +31,7 @@ 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;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -115,7 +111,6 @@ namespace Newtonsoft.Json.Tests.Serialization
}, @"Cannot preserve reference to array or readonly list, or list created from a non-default constructor: System.String[][]. Path '$values', line 3, position 14.");
}
#if !NETFX_CORE
[Test]
public void SerializeDeserialize_DictionaryContextContainsGuid_DeserializesItemAsGuid()
{
@@ -142,7 +137,6 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual(someValue, deserializedObject[contextKey]);
}
#endif
[Test]
public void DeserializeGuid()
@@ -28,11 +28,7 @@ using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json.Converters;
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 DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -26,11 +26,7 @@
using System;
using System.IO;
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 DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -27,11 +27,7 @@ using System;
using System.Collections.Generic;
using System.IO;
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 DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -32,11 +32,7 @@ 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;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -27,11 +27,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -155,7 +151,7 @@ namespace Newtonsoft.Json.Tests.Serialization
}", json);
}
#if !(PORTABLE || DNXCORE50 || NETFX_CORE || PORTABLE40)
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
public class MainClass : ISerializable
{
public ChildClass Child { get; set; }
@@ -313,13 +309,8 @@ namespace Newtonsoft.Json.Tests.Serialization
int IEqualityComparer.GetHashCode(object obj)
{
#if !(NETFX_CORE)
// put objects in a bucket based on their reference
return RuntimeHelpers.GetHashCode(obj);
#else
// put all objects in the same bucket so ReferenceEquals is called on all
return -1;
#endif
}
}
@@ -32,11 +32,7 @@ using System.Text;
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;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -35,11 +35,7 @@ using Newtonsoft.Json.Utilities.LinqBridge;
#else
using System.Linq;
#endif
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -37,11 +37,7 @@ using System.Runtime.Serialization;
using System.Text;
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 DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -276,7 +272,7 @@ namespace Newtonsoft.Json.Tests.Serialization
}", json);
}
#if !(NETFX_CORE || PORTABLE || DNXCORE50)
#if !(PORTABLE || DNXCORE50)
public class SerializationEventContextTestObject
{
public string TestMember { get; set; }
@@ -36,11 +36,7 @@ using System.Reflection;
using System.Text;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -26,11 +26,7 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json.Serialization;
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -10,11 +10,7 @@ using System.Numerics;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters;
using System.Text;
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -44,7 +40,7 @@ namespace Newtonsoft.Json.Tests.Serialization
[TestFixture]
public class TraceWriterTests : TestFixtureBase
{
#if !(PORTABLE || DNXCORE50 || NETFX_CORE || PORTABLE40)
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
[Test]
public void DiagnosticsTraceWriterTest()
{
@@ -673,7 +669,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 || DNXCORE50 || PORTABLE40)
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
[Test]
public void DeserializeISerializable()
{
@@ -43,11 +43,7 @@ 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 DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
@@ -360,7 +356,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual("Name!", ((EmployeeReference)employee).Name);
}
#if !(NETFX_CORE || PORTABLE || DNXCORE50)
#if !(PORTABLE || DNXCORE50)
[Test]
public void DeserializeTypeNameFromGacAssembly()
{
@@ -1242,7 +1238,7 @@ namespace Newtonsoft.Json.Tests.Serialization
CollectionAssert.AreEquivalent(data, d);
}
#if !(NETFX_CORE || DNXCORE50)
#if !(DNXCORE50)
[Test]
public void ISerializableTypeNameHandlingTest()
{
@@ -1307,7 +1303,7 @@ namespace Newtonsoft.Json.Tests.Serialization
#pragma warning restore CS0618 // Type or member is obsolete
ContractResolver = new DefaultContractResolver
{
#if !(NETFX_CORE || PORTABLE || DNXCORE50)
#if !(PORTABLE || DNXCORE50)
IgnoreSerializableAttribute = true
#endif
}
@@ -1338,7 +1334,7 @@ namespace Newtonsoft.Json.Tests.Serialization
public override void BindToName(Type serializedType, out string assemblyName, out string typeName)
{
assemblyName = "AssemblyName";
#if !(NETFX_CORE || DNXCORE50)
#if !(DNXCORE50)
typeName = ":::" + serializedType.Name.ToUpper(CultureInfo.InvariantCulture) + ":::";
#else
typeName = ":::" + serializedType.Name.ToUpper() + ":::";
@@ -1783,7 +1779,7 @@ namespace Newtonsoft.Json.Tests.Serialization
}
#endif
#if !(NETFX_CORE || DNXCORE50)
#if !(DNXCORE50)
[Test]
public void SerializeDeserialize_DictionaryContextContainsGuid_DeserializesItemAsGuid()
{
@@ -2078,7 +2074,7 @@ namespace Newtonsoft.Json.Tests.Serialization
public string SomeProperty { get; set; }
}
#if !(NETFX_CORE || DNXCORE50)
#if !(DNXCORE50)
public class ParentParent
{
[JsonProperty(ItemTypeNameHandling = TypeNameHandling.Auto)]
@@ -2146,7 +2142,7 @@ namespace Newtonsoft.Json.Tests.Serialization
public int Quantity { get; set; }
}
#if !(NETFX_CORE || DNXCORE50)
#if !(DNXCORE50)
public class SerializableWrapper
{
public object Content { get; set; }
@@ -30,18 +30,14 @@ using System.IO;
using System.Linq;
#endif
using System.Text;
#if NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
#elif DNXCORE50
#if DNXCORE50
using Xunit;
using Test = Xunit.FactAttribute;
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
#else
using NUnit.Framework;
#endif
#if !(NETFX_CORE || NET20 || NET35 || DNXCORE50)
#if !(NET20 || NET35 || DNXCORE50)
using System.Runtime.Serialization.Json;
#endif
using Newtonsoft.Json.Serialization;
@@ -63,7 +59,7 @@ namespace Newtonsoft.Json.Tests.Serialization
nonSerializedField = "Error"
};
#if !(NETFX_CORE || NET20 || NET35 || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(NET20 || NET35 || PORTABLE || DNXCORE50 || PORTABLE40)
MemoryStream ms = new MemoryStream();
DataContractJsonSerializer dataContractJsonSerializer = new DataContractJsonSerializer(typeof(SerializableType));
dataContractJsonSerializer.WriteObject(ms, serializableType);
@@ -79,7 +75,7 @@ namespace Newtonsoft.Json.Tests.Serialization
{
ContractResolver = new DefaultContractResolver
{
#if !(NETFX_CORE || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
IgnoreSerializableAttribute = false
#endif
}
@@ -88,7 +84,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.AreEqual(expected, json);
}
#if !(NETFX_CORE || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
[Test]
public void SerializeInheritedType()
{
@@ -118,7 +114,7 @@ namespace Newtonsoft.Json.Tests.Serialization
}
}
#if !(NETFX_CORE || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
[Serializable]
#else
[JsonObject(MemberSerialization.Fields)]
@@ -142,7 +138,7 @@ namespace Newtonsoft.Json.Tests.Serialization
set { privateField = value; }
}
#if !(NETFX_CORE || PORTABLE || DNXCORE50 || PORTABLE40)
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
[NonSerialized]
#else
[JsonIgnore]