-Added netstandard2.0
This commit is contained in:
@@ -35,7 +35,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
#if !PORTABLE
|
||||
#if !PORTABLE || NETSTANDARD2_0
|
||||
using MemberTypes = System.Reflection.MemberTypes;
|
||||
using BindingFlags = System.Reflection.BindingFlags;
|
||||
#else
|
||||
|
||||
@@ -31,7 +31,7 @@ using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
@@ -1491,7 +1491,7 @@ namespace Newtonsoft.Json.Tests.Bson
|
||||
Assert.AreEqual(badText, (string)o["test"]);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
public class BigIntegerTestClass
|
||||
{
|
||||
public BigInteger Blah { get; set; }
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#pragma warning disable 618
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
using System;
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
@@ -499,7 +499,7 @@ namespace Newtonsoft.Json.Tests.Bson
|
||||
Assert.AreEqual("10-00-00-00-09-30-00-C8-88-07-6B-DC-00-00-00-00", (BitConverter.ToString(ms.ToArray())));
|
||||
}
|
||||
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public async Task WriteBigIntegerAsync()
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#pragma warning disable 618
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
@@ -798,7 +798,7 @@ namespace Newtonsoft.Json.Tests.Bson
|
||||
Assert.AreEqual(c.AGuid, c2.AGuid.ToString());
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void WriteBigInteger()
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ using System.Collections.Generic;
|
||||
#if !(NET20 || DNXCORE50)
|
||||
using System.Data.Linq;
|
||||
#endif
|
||||
#if !DNXCORE50
|
||||
#if !DNXCORE50 || NETSTANDARD2_0
|
||||
using System.Data.SqlTypes;
|
||||
#endif
|
||||
using System.Text;
|
||||
@@ -121,7 +121,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
}", json);
|
||||
}
|
||||
|
||||
#if !(PORTABLE || PORTABLE40 || DNXCORE50)
|
||||
#if !(PORTABLE || PORTABLE40 || DNXCORE50) || NETSTANDARD2_0
|
||||
public class SqlBinaryClass
|
||||
{
|
||||
public SqlBinary SqlBinary { get; set; }
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD2_0
|
||||
using System;
|
||||
using Newtonsoft.Json.Converters;
|
||||
#if DNXCORE50
|
||||
|
||||
@@ -23,12 +23,12 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD2_0
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Bson;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if DNXCORE50
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET40 || NET35 || NET20 || DNXCORE50)
|
||||
#if !(NET40 || NET35 || NET20 || DNXCORE50) || NETSTANDARD2_0
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using Microsoft.FSharp.Core;
|
||||
@@ -36,7 +36,13 @@ using System.Threading.Tasks;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
using Newtonsoft.Json.Tests.TestObjects.GeometricForms;
|
||||
using Newtonsoft.Json.Tests.TestObjects.Money;
|
||||
#if DNXCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Converters
|
||||
{
|
||||
@@ -191,7 +197,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
{
|
||||
Union u = new Union();
|
||||
|
||||
u.TagReader = FSharpFunc<object, int>.ToConverter(FSharpValue.PreComputeUnionTagReader(t, null));
|
||||
u.TagReader = (s) => FSharpValue.PreComputeUnionTagReader(t, null).Invoke(s);
|
||||
u.Cases = new List<UnionCase>();
|
||||
|
||||
UnionCaseInfo[] cases = FSharpType.GetUnionCases(t, null);
|
||||
@@ -202,8 +208,8 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
unionCase.Tag = unionCaseInfo.Tag;
|
||||
unionCase.Name = unionCaseInfo.Name;
|
||||
unionCase.Fields = unionCaseInfo.GetFields();
|
||||
unionCase.FieldReader = FSharpFunc<object, object[]>.ToConverter(FSharpValue.PreComputeUnionReader(unionCaseInfo, null));
|
||||
unionCase.Constructor = FSharpFunc<object[], object>.ToConverter(FSharpValue.PreComputeUnionConstructor(unionCaseInfo, null));
|
||||
unionCase.FieldReader = (s) => FSharpValue.PreComputeUnionReader(unionCaseInfo, null).Invoke(s);
|
||||
unionCase.Constructor = (s) => FSharpValue.PreComputeUnionConstructor(unionCaseInfo, null).Invoke(s);
|
||||
|
||||
u.Cases.Add(unionCase);
|
||||
}
|
||||
@@ -224,8 +230,8 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
|
||||
object[] fields = caseInfo.FieldReader.Invoke(value);
|
||||
|
||||
Assert.AreEqual(10, fields[0]);
|
||||
Assert.AreEqual(5, fields[1]);
|
||||
Assert.AreEqual(10d, fields[0]);
|
||||
Assert.AreEqual(5d, fields[1]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
Assert.AreEqual(2006, d.Year);
|
||||
}
|
||||
|
||||
#if !(DNXCORE50)
|
||||
#if !(DNXCORE50) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void SerializeFormattedDateTimeNewZealandCulture()
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(DNXCORE50 || PORTABLE40)
|
||||
#if !(DNXCORE50 || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System.Globalization;
|
||||
#if NET20
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
@@ -58,7 +58,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
[TestFixture]
|
||||
public class XmlNodeConverterTest : TestFixtureBase
|
||||
{
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
private string SerializeXmlNode(XmlNode node)
|
||||
{
|
||||
string json = JsonConvert.SerializeXmlNode(node, Formatting.Indented);
|
||||
@@ -262,7 +262,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void MultipleNamespacesXmlDocument()
|
||||
{
|
||||
@@ -441,7 +441,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
</root>", doc.ToString());
|
||||
}
|
||||
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void SerializeEmptyDocument()
|
||||
{
|
||||
@@ -487,7 +487,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
Assert.IsTrue(equals);
|
||||
}
|
||||
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void DeserializeUndeclaredNamespacePrefix()
|
||||
{
|
||||
@@ -502,7 +502,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void DeserializeMultipleRootElements()
|
||||
{
|
||||
@@ -1297,7 +1297,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
]
|
||||
}";
|
||||
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
XmlDocument newDoc = JsonConvert.DeserializeXmlNode(json, "myRoot");
|
||||
|
||||
string xml = IndentXml(newDoc.InnerXml);
|
||||
@@ -1335,7 +1335,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
</myRoot>", IndentXml(newXDoc.ToString(SaveOptions.DisableFormatting)));
|
||||
#endif
|
||||
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
string newJson = JsonConvert.SerializeXmlNode(newDoc, Formatting.Indented);
|
||||
Console.WriteLine(newJson);
|
||||
#endif
|
||||
@@ -1360,7 +1360,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
]
|
||||
}";
|
||||
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
XmlDocument newDoc = JsonConvert.DeserializeXmlNode(json, "myRoot", true);
|
||||
|
||||
StringAssert.AreEqual(@"<myRoot>
|
||||
@@ -1396,7 +1396,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
</myRoot>", IndentXml(newXDoc.ToString(SaveOptions.DisableFormatting)));
|
||||
#endif
|
||||
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
string newJson = JsonConvert.SerializeXmlNode(newDoc, Formatting.Indented, true);
|
||||
StringAssert.AreEqual(json, newJson);
|
||||
#endif
|
||||
@@ -1422,7 +1422,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
]
|
||||
}";
|
||||
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
XmlDocument newDoc = JsonConvert.DeserializeXmlNode(json, "myRoot");
|
||||
|
||||
Assert.AreEqual(@"<myRoot><available_sizes><available_sizes><available_sizes>113</available_sizes><available_sizes>150</available_sizes></available_sizes><available_sizes>assets/images/resized/0001/1070/11070v1-max-150x150.jpg</available_sizes></available_sizes><available_sizes><available_sizes><available_sizes>189</available_sizes><available_sizes>250</available_sizes></available_sizes><available_sizes>assets/images/resized/0001/1070/11070v1-max-250x250.jpg</available_sizes></available_sizes><available_sizes><available_sizes><available_sizes>341</available_sizes><available_sizes>450</available_sizes></available_sizes><available_sizes>assets/images/resized/0001/1070/11070v1-max-450x450.jpg</available_sizes></available_sizes></myRoot>", newDoc.InnerXml);
|
||||
@@ -1435,7 +1435,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void Encoding()
|
||||
{
|
||||
@@ -1450,7 +1450,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void SerializeComment()
|
||||
{
|
||||
@@ -2139,6 +2139,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
Assert.AreEqual(@"<?xml version=""1.0"" encoding=""utf-8""?><root booleanType=""true"" />", xmlString);
|
||||
}
|
||||
|
||||
#if !(NETSTANDARD1_0 || NETSTANDARD1_3)
|
||||
[Test]
|
||||
public void IgnoreCultureForTypedAttributes()
|
||||
{
|
||||
@@ -2174,6 +2175,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
System.Threading.Thread.CurrentThread.CurrentCulture = originalCulture;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
[Test]
|
||||
public void NullAttributeValue()
|
||||
@@ -2499,7 +2501,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void DeserializeXmlNodeDefaultNamespace()
|
||||
{
|
||||
@@ -2827,7 +2829,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void SerializeAndDeserializeXmlElementWithNamespaceInChildrenRootDontHaveNameSpace()
|
||||
{
|
||||
@@ -2846,7 +2848,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
Assert.AreEqual(@"<root><b xmlns=""http://www.example.com/ns"">Asd</b><c>AAA</c><test>adad</test></root>", xmlBack.OuterXml);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void DeserializeBigInteger()
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE || PORTABLE40 || DNXCORE50)
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE || PORTABLE40 || DNXCORE50) || NETSTANDARD2_0
|
||||
using System.Buffers;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
@@ -592,7 +592,7 @@ namespace Newtonsoft.Json.Tests
|
||||
}", json);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE || PORTABLE40 || DNXCORE50)
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE || PORTABLE40 || DNXCORE50) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void ArrayPooling()
|
||||
{
|
||||
@@ -610,7 +610,7 @@ namespace Newtonsoft.Json.Tests
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE || PORTABLE40 || DNXCORE50)
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE || PORTABLE40 || DNXCORE50) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public async Task AsyncDemo()
|
||||
{
|
||||
@@ -634,7 +634,7 @@ namespace Newtonsoft.Json.Tests
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE || PORTABLE40 || DNXCORE50)
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE || PORTABLE40 || DNXCORE50) || NETSTANDARD2_0
|
||||
public class JsonArrayPool : IArrayPool<char>
|
||||
{
|
||||
public static readonly JsonArrayPool Instance = new JsonArrayPool();
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE || DNXCORE50)
|
||||
#if !(NET35 || NET20 || PORTABLE || DNXCORE50) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE || PORTABLE40 || DNXCORE50)
|
||||
#if !(NET35 || NET20 || PORTABLE || PORTABLE40 || DNXCORE50) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE || DNXCORE50)
|
||||
#if !(NET35 || NET20 || PORTABLE || DNXCORE50) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
#pragma warning disable 618
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || DNXCORE50)
|
||||
#if !(NET35 || NET20 || DNXCORE50) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE || DNXCORE50)
|
||||
#if !(NET35 || NET20 || PORTABLE || DNXCORE50) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE || DNXCORE50)
|
||||
#if !(NET35 || NET20 || PORTABLE || DNXCORE50) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
||||
@@ -39,7 +39,7 @@ using NUnit.Framework;
|
||||
|
||||
#endif
|
||||
|
||||
#if !(DNXCORE50 || NET20)
|
||||
#if !(DNXCORE50 || NET20) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Documentation.Samples.Json
|
||||
{
|
||||
@@ -375,7 +375,7 @@ namespace Newtonsoft.Json.Tests.Documentation.Samples.Json
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(JsonToken.Integer, reader.TokenType);
|
||||
Assert.AreEqual(123, reader.Value);
|
||||
Assert.AreEqual(123L, reader.Value);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(JsonToken.PropertyName, reader.TokenType);
|
||||
@@ -442,7 +442,7 @@ namespace Newtonsoft.Json.Tests.Documentation.Samples.Json
|
||||
|
||||
Assert.AreEqual(1, reader.ReadAsInt32());
|
||||
Assert.AreEqual(JsonToken.Integer, reader.TokenType);
|
||||
Assert.AreEqual(1, reader.Value);
|
||||
Assert.AreEqual(1L, reader.Value);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(JsonToken.Bytes, reader.TokenType);
|
||||
@@ -490,15 +490,15 @@ namespace Newtonsoft.Json.Tests.Documentation.Samples.Json
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(JsonToken.Integer, reader.TokenType);
|
||||
Assert.AreEqual(2000, reader.Value);
|
||||
Assert.AreEqual(2000L, reader.Value);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(JsonToken.Integer, reader.TokenType);
|
||||
Assert.AreEqual(12, reader.Value);
|
||||
Assert.AreEqual(12L, reader.Value);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(JsonToken.Integer, reader.TokenType);
|
||||
Assert.AreEqual(30, reader.Value);
|
||||
Assert.AreEqual(30L, reader.Value);
|
||||
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(JsonToken.EndConstructor, reader.TokenType);
|
||||
|
||||
@@ -39,7 +39,7 @@ using NUnit.Framework;
|
||||
|
||||
#endif
|
||||
|
||||
#if !(DNXCORE50 || NET20)
|
||||
#if !(DNXCORE50 || NET20) || NETSTANDARD2_0
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Documentation.Samples.Json
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !DNXCORE50
|
||||
#if !DNXCORE50 || NETSTANDARD2_0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !DNXCORE50
|
||||
#if !DNXCORE50 || NETSTANDARD2_0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -37,7 +37,7 @@ using NUnit.Framework;
|
||||
|
||||
#endif
|
||||
|
||||
#if !(DNXCORE50 || NET20 || NET35)
|
||||
#if !(DNXCORE50 || NET20 || NET35) || NETSTANDARD2_0
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(DNXCORE50 || PORTABLE || PORTABLE40)
|
||||
#if !(DNXCORE50 || PORTABLE || PORTABLE40) || NETSTANDARD2_0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !DNXCORE50
|
||||
#if !DNXCORE50 || NETSTANDARD2_0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || DNXCORE50 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || NET40 || DNXCORE50 || PORTABLE40 || PORTABLE) || NETSTANDARD1_0 || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(DNXCORE50 || PORTABLE || PORTABLE40)
|
||||
#if !(DNXCORE50 || PORTABLE || PORTABLE40) || NETSTANDARD2_0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -36,7 +36,7 @@ using NUnit.Framework;
|
||||
|
||||
#endif
|
||||
|
||||
#if !(DNXCORE50 || NET20 || PORTABLE || PORTABLE40)
|
||||
#if !(DNXCORE50 || NET20 || PORTABLE || PORTABLE40) || NETSTANDARD2_0
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Documentation.Samples.Xml
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ using NUnit.Framework;
|
||||
|
||||
#endif
|
||||
|
||||
#if !(NET20 || DNXCORE50 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || DNXCORE50 || PORTABLE || PORTABLE40) || NETSTANDARD2_0
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Documentation.Samples.Xml
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE || DNXCORE50)
|
||||
#if !(NET35 || NET20 || PORTABLE || DNXCORE50) || NETSTANDARD2_0
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || DNXCORE50)
|
||||
#if !(NET35 || NET20 || DNXCORE50) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
#if !(PORTABLE || DNXCORE50)
|
||||
#if !(PORTABLE || DNXCORE50) || NETSTANDARD2_0
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
#endif
|
||||
using Newtonsoft.Json.Schema;
|
||||
@@ -105,7 +105,7 @@ namespace Newtonsoft.Json.Tests
|
||||
}
|
||||
#pragma warning restore 618
|
||||
|
||||
#if !(PORTABLE || PORTABLE40 || DNXCORE50)
|
||||
#if !(PORTABLE || PORTABLE40 || DNXCORE50) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void BinarySerializeException()
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(DNXCORE50 || PORTABLE40)
|
||||
#if !(DNXCORE50 || PORTABLE40) || NETSTANDARD2_0
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -47,7 +47,7 @@ namespace Newtonsoft.Json.Tests.Issues
|
||||
[TestFixture]
|
||||
public class Issue1327 : TestFixtureBase
|
||||
{
|
||||
#if !PORTABLE
|
||||
#if !PORTABLE || NETSTANDARD2_0
|
||||
public class PersonWithXmlNode
|
||||
{
|
||||
public XmlNode TestXml { get; set; }
|
||||
@@ -71,7 +71,7 @@ namespace Newtonsoft.Json.Tests.Issues
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !PORTABLE
|
||||
#if !PORTABLE || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void Test_XmlNode()
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json.Schema;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Runtime.Serialization;
|
||||
@@ -1111,7 +1111,7 @@ namespace Newtonsoft.Json.Tests
|
||||
writer.Flush();
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void IntegerLengthOverflows()
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
@@ -593,7 +593,7 @@ namespace Newtonsoft.Json.Tests.JsonTextReaderTests
|
||||
}
|
||||
}
|
||||
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public async Task ReadInt64OverflowAsync()
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
@@ -616,7 +616,7 @@ namespace Newtonsoft.Json.Tests.JsonTextReaderTests
|
||||
}
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void ReadInt64Overflow()
|
||||
{
|
||||
@@ -638,7 +638,7 @@ namespace Newtonsoft.Json.Tests.JsonTextReaderTests
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void ReadInt64Overflow_Negative()
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
|
||||
@@ -988,7 +988,6 @@ null//comment
|
||||
Assert.IsTrue(await reader.ReadAsync());
|
||||
}
|
||||
|
||||
#if !DNXCORE50
|
||||
[Test]
|
||||
public async Task LinePositionOnNewLineAsync()
|
||||
{
|
||||
@@ -1036,7 +1035,6 @@ null//comment
|
||||
|
||||
Assert.IsFalse(await r.ReadAsync());
|
||||
}
|
||||
#endif
|
||||
|
||||
[Test]
|
||||
public async Task InvalidUnicodeSequenceAsync()
|
||||
|
||||
@@ -28,7 +28,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
|
||||
@@ -28,7 +28,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
@@ -88,7 +88,7 @@ namespace Newtonsoft.Json.Tests.JsonTextReaderTests
|
||||
"Unexpected character encountered while parsing value: u. Path '', line 1, position 1.");
|
||||
}
|
||||
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20)
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public async Task ReadAsBooleanAsync()
|
||||
{
|
||||
@@ -1056,69 +1056,6 @@ namespace Newtonsoft.Json.Tests.JsonTextReaderTests
|
||||
Assert.IsTrue(await reader.ReadAsync());
|
||||
}
|
||||
|
||||
#if !DNXCORE50
|
||||
[Test]
|
||||
[Ignore("Probably not a Json.NET issue")]
|
||||
public async Task ReadFromNetworkStreamAsync()
|
||||
{
|
||||
const int port = 11999;
|
||||
const int jsonArrayElementsCount = 193;
|
||||
|
||||
var serverStartedEvent = new ManualResetEvent(false);
|
||||
var clientReceivedEvent = new ManualResetEvent(false);
|
||||
|
||||
ThreadPool.QueueUserWorkItem(work =>
|
||||
{
|
||||
var server = new TcpListener(IPAddress.Parse("0.0.0.0"), port);
|
||||
server.Start();
|
||||
|
||||
serverStartedEvent.Set();
|
||||
|
||||
var serverSocket = server.AcceptSocket();
|
||||
|
||||
var jsonString = "[\r\n" + String.Join(",", Enumerable.Repeat(" \"testdata\"\r\n", jsonArrayElementsCount).ToArray()) + "]";
|
||||
var bytes = new UTF8Encoding().GetBytes(jsonString);
|
||||
serverSocket.Send(bytes);
|
||||
Console.WriteLine("server send: " + bytes.Length);
|
||||
|
||||
clientReceivedEvent.WaitOne();
|
||||
|
||||
});
|
||||
|
||||
serverStartedEvent.WaitOne();
|
||||
|
||||
var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
socket.Blocking = false;
|
||||
socket.Connect("127.0.0.1", port);
|
||||
|
||||
var stream = new NetworkStream(socket);
|
||||
|
||||
int i = 0;
|
||||
using (var sr = new StreamReader(stream, new UTF8Encoding(), false))
|
||||
using (var jsonTextReader = new JsonTextReader(sr))
|
||||
{
|
||||
while (await jsonTextReader.ReadAsync())
|
||||
{
|
||||
i++;
|
||||
|
||||
if (i == 193)
|
||||
{
|
||||
string s = string.Empty;
|
||||
}
|
||||
|
||||
Console.WriteLine($"{i} - {jsonTextReader.TokenType} - {jsonTextReader.Value}");
|
||||
}
|
||||
|
||||
//var result = serializer.Deserialize(jsonTextReader).ToString();
|
||||
//Console.WriteLine("client receive: " + new UTF8Encoding().GetBytes(result).Length);
|
||||
}
|
||||
|
||||
clientReceivedEvent.Set();
|
||||
|
||||
Console.WriteLine("Done");
|
||||
}
|
||||
#endif
|
||||
|
||||
[Test]
|
||||
public async Task ReadCommentInsideArrayAsync()
|
||||
{
|
||||
@@ -1205,7 +1142,7 @@ second line
|
||||
third line", jsonTextReader.Value);
|
||||
}
|
||||
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public async Task ReadBigIntegerAsync()
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
@@ -93,7 +93,7 @@ namespace Newtonsoft.Json.Tests.JsonTextReaderTests
|
||||
"Unexpected character encountered while parsing value: u. Path '', line 1, position 1.");
|
||||
}
|
||||
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20)
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void ReadAsBoolean()
|
||||
{
|
||||
@@ -1073,71 +1073,6 @@ namespace Newtonsoft.Json.Tests.JsonTextReaderTests
|
||||
Assert.IsTrue(reader.Read());
|
||||
}
|
||||
|
||||
#if !DNXCORE50
|
||||
[Test]
|
||||
[Ignore("Probably not a Json.NET issue")]
|
||||
public void ReadFromNetworkStream()
|
||||
{
|
||||
const int port = 11999;
|
||||
const int jsonArrayElementsCount = 193;
|
||||
|
||||
var serverStartedEvent = new ManualResetEvent(false);
|
||||
var clientReceivedEvent = new ManualResetEvent(false);
|
||||
|
||||
ThreadPool.QueueUserWorkItem(work =>
|
||||
{
|
||||
var server = new TcpListener(IPAddress.Parse("0.0.0.0"), port);
|
||||
server.Start();
|
||||
|
||||
serverStartedEvent.Set();
|
||||
|
||||
var serverSocket = server.AcceptSocket();
|
||||
|
||||
var jsonString = "[\r\n" + String.Join(",", Enumerable.Repeat(" \"testdata\"\r\n", jsonArrayElementsCount).ToArray()) + "]";
|
||||
var bytes = new UTF8Encoding().GetBytes(jsonString);
|
||||
serverSocket.Send(bytes);
|
||||
Console.WriteLine("server send: " + bytes.Length);
|
||||
|
||||
|
||||
clientReceivedEvent.WaitOne();
|
||||
|
||||
});
|
||||
|
||||
serverStartedEvent.WaitOne();
|
||||
|
||||
|
||||
var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||
socket.Blocking = false;
|
||||
socket.Connect("127.0.0.1", port);
|
||||
|
||||
var stream = new NetworkStream(socket);
|
||||
var serializer = new JsonSerializer();
|
||||
|
||||
int i = 0;
|
||||
using (var sr = new StreamReader(stream, new UTF8Encoding(), false))
|
||||
using (var jsonTextReader = new JsonTextReader(sr))
|
||||
{
|
||||
while (jsonTextReader.Read())
|
||||
{
|
||||
i++;
|
||||
|
||||
if (i == 193)
|
||||
{
|
||||
string s = string.Empty;
|
||||
}
|
||||
|
||||
Console.WriteLine($"{i} - {jsonTextReader.TokenType} - {jsonTextReader.Value}");
|
||||
}
|
||||
//var result = serializer.Deserialize(jsonTextReader).ToString();
|
||||
//Console.WriteLine("client receive: " + new UTF8Encoding().GetBytes(result).Length);
|
||||
}
|
||||
|
||||
clientReceivedEvent.Set();
|
||||
|
||||
Console.WriteLine("Done");
|
||||
}
|
||||
#endif
|
||||
|
||||
[Test]
|
||||
public void ReadCommentInsideArray()
|
||||
{
|
||||
@@ -1226,7 +1161,7 @@ third line", jsonTextReader.Value);
|
||||
|
||||
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void ReadBigInteger()
|
||||
{
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace Newtonsoft.Json.Tests
|
||||
}
|
||||
}
|
||||
|
||||
#if !(NETSTANDARD1_0 || PORTABLE)
|
||||
#if !(NETSTANDARD1_0 || PORTABLE) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public async Task WriteLazy()
|
||||
{
|
||||
@@ -344,7 +344,7 @@ namespace Newtonsoft.Json.Tests
|
||||
Assert.IsTrue(ms.CanRead);
|
||||
}
|
||||
|
||||
#if !(PORTABLE)
|
||||
#if !(PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public async Task WriteIConvertableAsync()
|
||||
{
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace Newtonsoft.Json.Tests
|
||||
Assert.AreEqual(1, arrayPool.FreeArrays.Count);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE || PORTABLE40 || DNXCORE50)
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE || PORTABLE40 || DNXCORE50) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void BufferErroringWithInvalidSize()
|
||||
{
|
||||
@@ -224,7 +224,7 @@ namespace Newtonsoft.Json.Tests
|
||||
Assert.IsTrue(ms.CanRead);
|
||||
}
|
||||
|
||||
#if !(PORTABLE)
|
||||
#if !(PORTABLE) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void WriteIConvertable()
|
||||
{
|
||||
@@ -315,7 +315,7 @@ namespace Newtonsoft.Json.Tests
|
||||
#if !NET20
|
||||
expected = @"[null,""c"",null,true,null,1,null,1,null,1,null,1,null,1,null,1,null,1,null,1,null,1.1,null,1.1,null,1.1,null,""1970-01-01T00:00:00Z"",null,""1970-01-01T00:00:00+00:00""]";
|
||||
#else
|
||||
expected = @"[null,""c"",null,true,null,1,null,1,null,1,null,1,null,1,null,1,null,1,null,1,null,1.1,null,1.1,null,1.1,null,""1970-01-01T00:00:00Z""]";
|
||||
expected = @"[null,""c"",null,true,null,1,null,1,null,1,null,1,null,1,null,1,null,1,null,1,null,1.1,null,1.1,null,1.1,null,""1970-01-01T00:00:00Z""]";
|
||||
#endif
|
||||
|
||||
Assert.AreEqual(expected, json);
|
||||
|
||||
@@ -30,7 +30,7 @@ using System.IO;
|
||||
#if NET20
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#endif
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
@@ -353,7 +353,7 @@ namespace Newtonsoft.Json.Tests
|
||||
Assert.IsNotNull(validationEventArgs);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void IntegerGreaterThanMaximumValue_BigInteger()
|
||||
{
|
||||
@@ -606,7 +606,7 @@ namespace Newtonsoft.Json.Tests
|
||||
Assert.IsNotNull(validationEventArgs);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void BigIntegerDivisibleBy_Success()
|
||||
{
|
||||
|
||||
@@ -23,8 +23,14 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(PORTABLE || PORTABLE40 || DNXCORE50)
|
||||
#if !(PORTABLE || PORTABLE40 || DNXCORE50) || NETSTANDARD2_0
|
||||
#if DNXCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Linq.ComponentModel
|
||||
|
||||
@@ -29,7 +29,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
@@ -257,7 +257,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
new JProperty("Uri", new Uri("http://json.codeplex.com/")),
|
||||
new JProperty("Guid", new Guid("EA27FE1D-0D80-44F2-BF34-4654156FA7AF")),
|
||||
new JProperty("TimeSpan", TimeSpan.FromDays(1))
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
, new JProperty("BigInteger", BigInteger.Parse("1"))
|
||||
#endif
|
||||
);
|
||||
@@ -290,7 +290,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
Assert.IsTrue(d.Decimal == 1.1m);
|
||||
Assert.IsTrue(d.Decimal != 1.0f);
|
||||
Assert.IsTrue(d.Decimal != 1.0d);
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
Assert.IsTrue(d.Decimal > new BigInteger(0));
|
||||
#endif
|
||||
|
||||
@@ -306,11 +306,11 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
Assert.IsTrue(d.Float == 1.1m);
|
||||
Assert.IsTrue(d.Float != 1.0f);
|
||||
Assert.IsTrue(d.Float != 1.0d);
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
Assert.IsTrue(d.Float > new BigInteger(0));
|
||||
#endif
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
Assert.IsTrue(d.BigInteger == d.BigInteger);
|
||||
Assert.IsTrue(d.BigInteger > 0);
|
||||
Assert.IsTrue(d.BigInteger > 0.0m);
|
||||
@@ -366,7 +366,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
new JProperty("Uri", new Uri("http://json.codeplex.com/")),
|
||||
new JProperty("Guid", new Guid("EA27FE1D-0D80-44F2-BF34-4654156FA7AF")),
|
||||
new JProperty("TimeSpan", TimeSpan.FromDays(1))
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
, new JProperty("BigInteger", new BigInteger(100))
|
||||
#endif
|
||||
);
|
||||
@@ -445,7 +445,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
r += 2;
|
||||
Assert.AreEqual(null, r.Value);
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
r = d.BigInteger + null;
|
||||
Assert.AreEqual(null, r.Value);
|
||||
r += 2;
|
||||
@@ -524,7 +524,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
r -= 2;
|
||||
Assert.AreEqual(null, r.Value);
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
r = d.BigInteger - null;
|
||||
Assert.AreEqual(null, r.Value);
|
||||
r -= 2;
|
||||
@@ -598,7 +598,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
r *= 2;
|
||||
Assert.AreEqual(null, r.Value);
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
r = d.BigInteger * 1.1d;
|
||||
Assert.AreEqual(100m, (decimal)r);
|
||||
r *= 2;
|
||||
@@ -672,7 +672,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
r /= 2;
|
||||
Assert.AreEqual(null, r.Value);
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
r = d.BigInteger / 1.1d;
|
||||
Assert.AreEqual(100m, (decimal)r);
|
||||
r /= 2;
|
||||
@@ -700,7 +700,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
new JProperty("Uri", new Uri("http://json.codeplex.com/")),
|
||||
new JProperty("Guid", new Guid("EA27FE1D-0D80-44F2-BF34-4654156FA7AF")),
|
||||
new JProperty("TimeSpan", TimeSpan.FromDays(1))
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
, new JProperty("BigInteger", new BigInteger(100))
|
||||
#endif
|
||||
);
|
||||
@@ -717,7 +717,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
Assert.AreEqual("http://json.codeplex.com/", d.Uri.ToString());
|
||||
Assert.AreEqual("ea27fe1d-0d80-44f2-bf34-4654156fa7af", d.Guid.ToString());
|
||||
Assert.AreEqual("1.00:00:00", d.TimeSpan.ToString());
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
Assert.AreEqual("100", d.BigInteger.ToString());
|
||||
#endif
|
||||
}
|
||||
@@ -801,7 +801,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
AssertValueConverted<Guid?>(null);
|
||||
AssertValueConverted<Uri>(new Uri("http://json.codeplex.com/"));
|
||||
AssertValueConverted<Uri>(null);
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
AssertValueConverted<BigInteger>(new BigInteger(100));
|
||||
AssertValueConverted<BigInteger?>(null);
|
||||
#endif
|
||||
|
||||
@@ -431,7 +431,7 @@ Parameter name: index");
|
||||
}
|
||||
}
|
||||
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void ITypedListGetItemProperties()
|
||||
{
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
[TestFixture]
|
||||
public class JObjectTests : TestFixtureBase
|
||||
{
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
#if !(NET35 || NET20 || PORTABLE40) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void EmbedJValueStringInNewJObject()
|
||||
{
|
||||
@@ -716,7 +716,7 @@ Parameter name: arrayIndex");
|
||||
Assert.AreEqual(p4, l[1]);
|
||||
}
|
||||
|
||||
#if !(NET20 || PORTABLE || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(NET20 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void PropertyChanging()
|
||||
{
|
||||
@@ -1259,7 +1259,7 @@ Parameter name: arrayIndex");
|
||||
}, "Can not add property Test3 to Newtonsoft.Json.Linq.JObject. Property with the same name already exists on object.");
|
||||
}
|
||||
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void IBindingListSortDirection()
|
||||
{
|
||||
@@ -1454,7 +1454,7 @@ Parameter name: arrayIndex");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE40) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void CollectionChanged()
|
||||
{
|
||||
@@ -1583,7 +1583,7 @@ Parameter name: arrayIndex");
|
||||
Assert.AreEqual("Name2", value);
|
||||
}
|
||||
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void WriteObjectNullDBNullValue()
|
||||
{
|
||||
@@ -1695,7 +1695,7 @@ Parameter name: arrayIndex");
|
||||
}, "Unexpected end of content while loading JObject. Path 'short.error.code', line 6, position 14.");
|
||||
}
|
||||
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void GetProperties()
|
||||
{
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
Assert.AreEqual(p, p.Value.Parent);
|
||||
}
|
||||
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void ListChanged()
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using System.IO;
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using Newtonsoft.Json.Linq;
|
||||
@@ -48,7 +48,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
[TestFixture]
|
||||
public class JTokenReaderAsyncTests : TestFixtureBase
|
||||
{
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public async Task ConvertBigIntegerToDoubleAsync()
|
||||
{
|
||||
@@ -757,7 +757,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
Assert.AreEqual(1d, await reader.ReadAsDoubleAsync());
|
||||
}
|
||||
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public async Task ReadAsBoolean_BigInteger_SuccessAsync()
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json;
|
||||
using System.IO;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using Newtonsoft.Json.Linq;
|
||||
@@ -47,7 +47,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
[TestFixture]
|
||||
public class JTokenReaderTest : TestFixtureBase
|
||||
{
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void ConvertBigIntegerToDouble()
|
||||
{
|
||||
@@ -884,7 +884,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
Assert.AreEqual(1d, reader.ReadAsDouble());
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void ReadAsBoolean_BigInteger_Success()
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
@@ -369,7 +369,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
|
||||
Assert.AreEqual(5, (int)(new JValue(StringComparison.OrdinalIgnoreCase)));
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
string bigIntegerText = "1234567899999999999999999999999999999999999999999999999999999999999990";
|
||||
|
||||
Assert.AreEqual(BigInteger.Parse(bigIntegerText), (new JValue(BigInteger.Parse(bigIntegerText))).Value);
|
||||
@@ -449,7 +449,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
#endif
|
||||
ExceptionAssert.Throws<ArgumentException>(() => { var i = (Uri)new JValue(true); }, "Can not convert Boolean to Uri.");
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
ExceptionAssert.Throws<ArgumentException>(() => { var i = (new JValue(new Uri("http://www.google.com"))).ToObject<BigInteger>(); }, "Can not convert Uri to BigInteger.");
|
||||
ExceptionAssert.Throws<ArgumentException>(() => { var i = (JValue.CreateNull()).ToObject<BigInteger>(); }, "Can not convert Null to BigInteger.");
|
||||
ExceptionAssert.Throws<ArgumentException>(() => { var i = (new JValue(Guid.NewGuid())).ToObject<BigInteger>(); }, "Can not convert Guid to BigInteger.");
|
||||
@@ -466,7 +466,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
[Test]
|
||||
public void ToObject()
|
||||
{
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
Assert.AreEqual((BigInteger)1, (new JValue(1).ToObject(typeof(BigInteger))));
|
||||
Assert.AreEqual((BigInteger)1, (new JValue(1).ToObject(typeof(BigInteger?))));
|
||||
Assert.AreEqual((BigInteger?)null, (JValue.CreateNull().ToObject(typeof(BigInteger?))));
|
||||
@@ -524,7 +524,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
Assert.IsTrue(JToken.DeepEquals(new JValue((DateTimeOffset?)null), (JValue)(DateTimeOffset?)null));
|
||||
#endif
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
// had to remove implicit casting to avoid user reference to System.Numerics.dll
|
||||
Assert.IsTrue(JToken.DeepEquals(new JValue(new BigInteger(1)), new JValue(new BigInteger(1))));
|
||||
Assert.IsTrue(JToken.DeepEquals(new JValue((BigInteger?)null), new JValue((BigInteger?)null)));
|
||||
@@ -1147,7 +1147,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
Assert.IsTrue(a.DeepEquals(a2));
|
||||
}
|
||||
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void Clone()
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
|
||||
using System;
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
@@ -115,7 +115,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
await jsonWriter.WriteValueAsync("DVD read/writer");
|
||||
Assert.AreEqual(WriteState.Array, jsonWriter.WriteState);
|
||||
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
await jsonWriter.WriteValueAsync(new BigInteger(123));
|
||||
Assert.AreEqual(WriteState.Array, jsonWriter.WriteState);
|
||||
#endif
|
||||
@@ -167,7 +167,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
Assert.AreEqual(WriteState.Array, jsonWriter.WriteState);
|
||||
Assert.AreEqual(a[a.Count - 1], jsonWriter.CurrentToken);
|
||||
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
await jsonWriter.WriteValueAsync(new BigInteger(123));
|
||||
Assert.AreEqual(WriteState.Array, jsonWriter.WriteState);
|
||||
Assert.AreEqual(a[a.Count - 1], jsonWriter.CurrentToken);
|
||||
@@ -200,7 +200,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
/*fail*/]", writer.Token.ToString());
|
||||
}
|
||||
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public async Task WriteBigIntegerAsync()
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
@@ -120,7 +120,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
jsonWriter.WriteValue("DVD read/writer");
|
||||
Assert.AreEqual(WriteState.Array, jsonWriter.WriteState);
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
jsonWriter.WriteValue(new BigInteger(123));
|
||||
Assert.AreEqual(WriteState.Array, jsonWriter.WriteState);
|
||||
#endif
|
||||
@@ -172,7 +172,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
Assert.AreEqual(WriteState.Array, jsonWriter.WriteState);
|
||||
Assert.AreEqual(a[a.Count - 1], jsonWriter.CurrentToken);
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
jsonWriter.WriteValue(new BigInteger(123));
|
||||
Assert.AreEqual(WriteState.Array, jsonWriter.WriteState);
|
||||
Assert.AreEqual(a[a.Count - 1], jsonWriter.CurrentToken);
|
||||
@@ -205,7 +205,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
/*fail*/]", writer.Token.ToString());
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void WriteBigInteger()
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
@@ -179,7 +179,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
Assert.AreEqual(g, v.Value);
|
||||
Assert.AreEqual(JTokenType.Guid, v.Type);
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
BigInteger i = BigInteger.Parse("123456789999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990");
|
||||
v.Value = i;
|
||||
Assert.AreEqual(i, v.Value);
|
||||
@@ -239,13 +239,13 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
v = new JValue(new Guid("B282ADE7-C520-496C-A448-4084F6803DE5"));
|
||||
Assert.AreEqual("b282ade7-c520-496c-a448-4084f6803de5", v.ToString(null, CultureInfo.InvariantCulture));
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
v = new JValue(BigInteger.Parse("123456789999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990"));
|
||||
Assert.AreEqual("123456789999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990", v.ToString(null, CultureInfo.InvariantCulture));
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void JValueParse()
|
||||
{
|
||||
@@ -256,7 +256,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(PORTABLE) || NETSTANDARD1_3
|
||||
#if !(PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void JValueIConvertable()
|
||||
{
|
||||
@@ -503,7 +503,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(PORTABLE) || NETSTANDARD1_3
|
||||
#if !(PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void ConvertsToBoolean()
|
||||
{
|
||||
@@ -522,7 +522,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
Assert.AreEqual(Int32.MaxValue, Convert.ToInt32(new JValue(Int32.MaxValue)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void ConvertsToInt32_BigInteger()
|
||||
{
|
||||
@@ -684,7 +684,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
v = new JValue(new Uri("http://www.google.com"));
|
||||
Assert.AreEqual(TypeCode.Object, v.GetTypeCode());
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
v = new JValue(new BigInteger(3));
|
||||
Assert.AreEqual(TypeCode.Object, v.GetTypeCode());
|
||||
#endif
|
||||
@@ -703,7 +703,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
int i = (int)v.ToType(typeof(int), CultureInfo.InvariantCulture);
|
||||
Assert.AreEqual(9, i);
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
BigInteger bi = (BigInteger)v.ToType(typeof(BigInteger), CultureInfo.InvariantCulture);
|
||||
Assert.AreEqual(new BigInteger(9), bi);
|
||||
#endif
|
||||
@@ -718,7 +718,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
Assert.AreEqual("2013", v.ToString("yyyy"));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void ToStringNewTypes()
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_3
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using Newtonsoft.Json.Linq.JsonPath;
|
||||
@@ -938,7 +938,7 @@ namespace Newtonsoft.Json.Tests.Linq.JsonPath
|
||||
Assert.IsTrue(JToken.DeepEquals(new JObject(new JProperty("hi", 3)), t[1]));
|
||||
}
|
||||
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_3
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void GreaterQueryBigInteger()
|
||||
{
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
[TestFixture]
|
||||
public class LinqToJsonTest : TestFixtureBase
|
||||
{
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
public class DemoClass
|
||||
{
|
||||
public decimal maxValue;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks Condition="'$(TestFrameworks)'==''">net46;net451;net452;net40;net35;net20;netcoreapp2.0;netcoreapp1.0</TargetFrameworks>
|
||||
<TargetFrameworks Condition="'$(TestFrameworks)'==''">net46;net451;net452;net40;net35;net20;netcoreapp2.0;netcoreapp1.1;netcoreapp1.0</TargetFrameworks>
|
||||
<TargetFrameworks Condition="'$(TestFrameworks)'!=''">$(TestFrameworks)</TargetFrameworks>
|
||||
<VersionPrefix>1.0</VersionPrefix>
|
||||
<Authors>James Newton-King</Authors>
|
||||
@@ -18,7 +18,7 @@
|
||||
<RootNamespace>Newtonsoft.Json.Tests</RootNamespace>
|
||||
<IsPackable>false</IsPackable>
|
||||
<!-- Workaround for https://github.com/nunit/nunit3-vs-adapter/issues/296 -->
|
||||
<DebugType Condition="'$(TargetFramework)' != '' AND '$(TargetFramework)' != 'netcoreapp1.0' AND '$(TargetFramework)' != 'netcoreapp1.1'">Full</DebugType>
|
||||
<DebugType Condition="'$(TargetFramework)' != '' AND '$(TargetFramework)' != 'netcoreapp1.0' AND '$(TargetFramework)' != 'netcoreapp1.1' AND '$(TargetFramework)' != 'netcoreapp2.0'">Full</DebugType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<!-- Tracking for removal https://github.com/Microsoft/vstest/issues/472 -->
|
||||
@@ -153,7 +153,7 @@
|
||||
<AssemblyTitle>Json.NET Tests .NET 2.0</AssemblyTitle>
|
||||
<DefineConstants>NET20;$(AdditionalConstants)</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp2.0'">
|
||||
<PackageReference Include="BenchmarkDotNet" Version="0.10.9" />
|
||||
<PackageReference Include="FSharp.Core" Version="4.2.3" />
|
||||
@@ -162,17 +162,38 @@
|
||||
<PackageReference Include="System.Runtime.Serialization.Xml" Version="4.3.0" />
|
||||
<PackageReference Include="System.Runtime.Serialization.Formatters" Version="4.3.0" />
|
||||
<PackageReference Include="System.Xml.XmlSerializer" Version="4.3.0" />
|
||||
<PackageReference Include="System.ValueTuple" Version="4.3.0" />
|
||||
<PackageReference Include="System.ValueTuple" Version="4.3.0" />
|
||||
<PackageReference Include="Autofac" Version="4.6.1" />
|
||||
<PackageReference Include="xunit" Version="2.2.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='netcoreapp2.0'">
|
||||
<AssemblyTitle>Json.NET Tests .NET Standard 2.0</AssemblyTitle>
|
||||
<ReferringTargetFrameworkForProjectReferences>.NETStandard,Version=v2.0</ReferringTargetFrameworkForProjectReferences>
|
||||
<DefineConstants>NETSTANDARD2_0;DNXCORE50;PORTABLE;HAVE_BENCHMARKS;$(AdditionalConstants)</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp1.1'">
|
||||
<PackageReference Include="BenchmarkDotNet" Version="0.10.9" />
|
||||
<PackageReference Include="FSharp.Core" Version="4.2.3" />
|
||||
<PackageReference Include="System.ObjectModel" Version="4.3.0" />
|
||||
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
|
||||
<PackageReference Include="System.Runtime.Serialization.Xml" Version="4.3.0" />
|
||||
<PackageReference Include="System.Runtime.Serialization.Formatters" Version="4.3.0" />
|
||||
<PackageReference Include="System.Xml.XmlSerializer" Version="4.3.0" />
|
||||
<PackageReference Include="System.ValueTuple" Version="4.3.0" />
|
||||
<PackageReference Include="Autofac" Version="4.6.1" />
|
||||
<PackageReference Include="xunit" Version="2.2.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='netcoreapp1.1'">
|
||||
<AssemblyTitle>Json.NET Tests .NET Standard 1.3</AssemblyTitle>
|
||||
<ReferringTargetFrameworkForProjectReferences>.NETStandard,Version=v1.3</ReferringTargetFrameworkForProjectReferences>
|
||||
<DefineConstants>NETSTANDARD1_3;DNXCORE50;PORTABLE;HAVE_BENCHMARKS;$(AdditionalConstants)</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp1.0'">
|
||||
<PackageReference Include="FSharp.Core" Version="4.2.3" />
|
||||
<PackageReference Include="System.ObjectModel" Version="4.3.0" />
|
||||
@@ -181,6 +202,7 @@
|
||||
<PackageReference Include="System.Runtime.Serialization.Formatters" Version="4.3.0" />
|
||||
<PackageReference Include="System.Xml.XmlSerializer" Version="4.3.0" />
|
||||
<PackageReference Include="System.ValueTuple" Version="4.3.0" />
|
||||
<PackageReference Include="Autofac" Version="4.6.1" />
|
||||
<PackageReference Include="xunit" Version="2.2.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
|
||||
|
||||
@@ -312,7 +312,7 @@ namespace Newtonsoft.Json.Tests.Schema
|
||||
Assert.IsTrue(v.IsValid(schema));
|
||||
}
|
||||
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void GenerateSchemaForISerializable()
|
||||
{
|
||||
@@ -340,7 +340,7 @@ namespace Newtonsoft.Json.Tests.Schema
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
public class CustomDirectoryInfoMapper : DefaultContractResolver
|
||||
{
|
||||
public CustomDirectoryInfoMapper()
|
||||
@@ -376,7 +376,7 @@ namespace Newtonsoft.Json.Tests.Schema
|
||||
generator.UndefinedSchemaIdHandling = UndefinedSchemaIdHandling.UseTypeName;
|
||||
generator.ContractResolver = new CamelCasePropertyNamesContractResolver()
|
||||
{
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
IgnoreSerializableAttribute = true
|
||||
#endif
|
||||
};
|
||||
@@ -421,7 +421,7 @@ namespace Newtonsoft.Json.Tests.Schema
|
||||
}", json);
|
||||
}
|
||||
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void GenerateSchemaSerializable()
|
||||
{
|
||||
@@ -734,7 +734,7 @@ namespace Newtonsoft.Json.Tests.Schema
|
||||
{
|
||||
}
|
||||
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Serializable]
|
||||
public sealed class SerializableTestObject
|
||||
{
|
||||
|
||||
+1
-1
@@ -119,7 +119,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
string json = o.ToString();
|
||||
}
|
||||
|
||||
#if !(PORTABLE || PORTABLE40)
|
||||
#if !(PORTABLE || PORTABLE40) || NETSTANDARD2_0
|
||||
#pragma warning disable 618
|
||||
[Test]
|
||||
public void MemberSearchFlags()
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
[TestFixture]
|
||||
public class ContractResolverTests : TestFixtureBase
|
||||
{
|
||||
#if !(PORTABLE || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void ResolveSerializableContract()
|
||||
{
|
||||
@@ -573,7 +573,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
}", startingWithB);
|
||||
}
|
||||
|
||||
#if !(PORTABLE || PORTABLE40)
|
||||
#if !(PORTABLE || PORTABLE40) || NETSTANDARD2_0
|
||||
#pragma warning disable 618
|
||||
[Test]
|
||||
public void SerializeCompilerGeneratedMembers()
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET40 || NET35 || NET20 || DNXCORE50 || PORTABLE || PORTABLE40)
|
||||
#if !(NET40 || NET35 || NET20 || DNXCORE50 || PORTABLE || PORTABLE40) || NETSTANDARD1_0 || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using Autofac;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Assert.AreEqual(dynamicObject.ChildObject.Text, d.ChildObject.Text);
|
||||
}
|
||||
|
||||
#if !(PORTABLE || PORTABLE40)
|
||||
#if !(PORTABLE || PORTABLE40) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void SerializeDynamicObjectWithObjectTracking()
|
||||
{
|
||||
|
||||
@@ -23,8 +23,14 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET40 || NET35 || NET20 || DNXCORE50)
|
||||
#if !(NET40 || NET35 || NET20 || DNXCORE50) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
#if DNXCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -262,7 +262,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
"Constructor for 'Newtonsoft.Json.Tests.Serialization.JsonSerializerCollectionsTests+TestCollectionBadIEnumerableParameter' must have no parameters or a single parameter that implements 'System.Collections.Generic.IEnumerable`1[System.Int32]'.");
|
||||
}
|
||||
|
||||
#if !(DNXCORE50 || PORTABLE)
|
||||
#if !(DNXCORE50 || PORTABLE) || NETSTANDARD2_0
|
||||
public class TestCollectionNonGeneric : ArrayList
|
||||
{
|
||||
[JsonConstructor]
|
||||
@@ -279,9 +279,9 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
TestCollectionNonGeneric l = JsonConvert.DeserializeObject<TestCollectionNonGeneric>(json);
|
||||
|
||||
Assert.AreEqual(3, l.Count);
|
||||
Assert.AreEqual(1, l[0]);
|
||||
Assert.AreEqual(2, l[1]);
|
||||
Assert.AreEqual(3, l[2]);
|
||||
Assert.AreEqual(1L, l[0]);
|
||||
Assert.AreEqual(2L, l[1]);
|
||||
Assert.AreEqual(3L, l[2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -375,7 +375,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
"Constructor for 'Newtonsoft.Json.Tests.Serialization.JsonSerializerCollectionsTests+TestDictionaryBadIEnumerableParameter' must have no parameters or a single parameter that implements 'System.Collections.Generic.IEnumerable`1[System.Collections.Generic.KeyValuePair`2[System.String,System.Int32]]'.");
|
||||
}
|
||||
|
||||
#if !(DNXCORE50 || PORTABLE)
|
||||
#if !(DNXCORE50 || PORTABLE) || NETSTANDARD2_0
|
||||
public class TestDictionaryNonGeneric : Hashtable
|
||||
{
|
||||
[JsonConstructor]
|
||||
@@ -392,13 +392,13 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
TestDictionaryNonGeneric d = JsonConvert.DeserializeObject<TestDictionaryNonGeneric>(json);
|
||||
|
||||
Assert.AreEqual(3, d.Count);
|
||||
Assert.AreEqual(0, d["zero"]);
|
||||
Assert.AreEqual(1, d["one"]);
|
||||
Assert.AreEqual(2, d["two"]);
|
||||
Assert.AreEqual(0L, d["zero"]);
|
||||
Assert.AreEqual(1L, d["one"]);
|
||||
Assert.AreEqual(2L, d["two"]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(DNXCORE50)
|
||||
#if !(DNXCORE50) || NETSTANDARD2_0
|
||||
public class NameValueCollectionTestClass
|
||||
{
|
||||
public NameValueCollection Collection { get; set; }
|
||||
@@ -413,7 +413,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE || PORTABLE40)
|
||||
#if !(NET35 || NET20 || PORTABLE || PORTABLE40) || NETSTANDARD2_0
|
||||
public class SomeObject
|
||||
{
|
||||
public string Text1 { get; set; }
|
||||
@@ -1055,7 +1055,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Assert.AreEqual(3, v2["Third"]);
|
||||
}
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE || PORTABLE40)
|
||||
#if !(NET35 || NET20 || PORTABLE || PORTABLE40) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void DeserializeConcurrentDictionary()
|
||||
{
|
||||
@@ -1769,7 +1769,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Assert.AreEqual(1, (int)((JObject)o.Data[2])["one"]);
|
||||
}
|
||||
|
||||
#if !(DNXCORE50)
|
||||
#if !(DNXCORE50) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void SerializeArrayAsArrayList()
|
||||
{
|
||||
@@ -1999,7 +1999,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !DNXCORE50
|
||||
#if !DNXCORE50 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void EmptyStringInHashtableIsDeserialized()
|
||||
{
|
||||
|
||||
@@ -29,15 +29,17 @@ using System.ComponentModel;
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System.Numerics;
|
||||
#endif
|
||||
#if !(NET20 || DNXCORE50)
|
||||
#if !(NET20 || DNXCORE50) || NETSTANDARD2_0
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Configuration;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.Serialization.Formatters;
|
||||
using System.Threading;
|
||||
#endif
|
||||
#if !(NET20 || DNXCORE50)
|
||||
using System.Web.Script.Serialization;
|
||||
#endif
|
||||
using System.Text;
|
||||
@@ -218,7 +220,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Assert.AreEqual("def", enumerableObject[1].Value);
|
||||
}
|
||||
|
||||
#if !(PORTABLE || PORTABLE40 || NET20 || NET35)
|
||||
#if !(PORTABLE || PORTABLE40 || NET20 || NET35) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void LargeIntegerAsString()
|
||||
{
|
||||
@@ -274,7 +276,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
@"Error converting value {null} to type 'System.Boolean'. Path '[0]', line 1, position 3.");
|
||||
}
|
||||
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20)
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void DeserializeBooleans()
|
||||
{
|
||||
@@ -739,7 +741,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Assert.IsNull(otc.Value5);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void ReadIntegerWithError()
|
||||
{
|
||||
@@ -991,7 +993,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
serializer.ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor;
|
||||
Assert.AreEqual(ConstructorHandling.AllowNonPublicDefaultConstructor, serializer.ConstructorHandling);
|
||||
|
||||
#if !(DNXCORE50)
|
||||
#if !(DNXCORE50) || NETSTANDARD2_0
|
||||
serializer.Context = new StreamingContext(StreamingContextStates.Other);
|
||||
Assert.AreEqual(new StreamingContext(StreamingContextStates.Other), serializer.Context);
|
||||
#endif
|
||||
@@ -1062,7 +1064,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
serializer.TraceWriter = traceWriter;
|
||||
Assert.AreEqual(traceWriter, serializer.TraceWriter);
|
||||
|
||||
#if !(PORTABLE || PORTABLE40 || NET20 || DNXCORE50)
|
||||
#if !(PORTABLE || PORTABLE40 || NET20 || DNXCORE50) || NETSTANDARD2_0
|
||||
#pragma warning disable 618
|
||||
serializer.TypeNameAssemblyFormat = FormatterAssemblyStyle.Full;
|
||||
Assert.AreEqual(FormatterAssemblyStyle.Full, serializer.TypeNameAssemblyFormat);
|
||||
@@ -1100,7 +1102,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
settings.ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor;
|
||||
Assert.AreEqual(ConstructorHandling.AllowNonPublicDefaultConstructor, settings.ConstructorHandling);
|
||||
|
||||
#if !(DNXCORE50)
|
||||
#if !(DNXCORE50) || NETSTANDARD2_0
|
||||
settings.Context = new StreamingContext(StreamingContextStates.Other);
|
||||
Assert.AreEqual(new StreamingContext(StreamingContextStates.Other), settings.Context);
|
||||
#endif
|
||||
@@ -1177,7 +1179,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
settings.TraceWriter = traceWriter;
|
||||
Assert.AreEqual(traceWriter, settings.TraceWriter);
|
||||
|
||||
#if !(PORTABLE || PORTABLE40 || NET20 || DNXCORE50)
|
||||
#if !(PORTABLE || PORTABLE40 || NET20 || DNXCORE50) || NETSTANDARD2_0
|
||||
#pragma warning disable 618
|
||||
settings.TypeNameAssemblyFormat = FormatterAssemblyStyle.Full;
|
||||
Assert.AreEqual(FormatterAssemblyStyle.Full, settings.TypeNameAssemblyFormat);
|
||||
@@ -1226,7 +1228,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
serializerProxy.ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor;
|
||||
Assert.AreEqual(ConstructorHandling.AllowNonPublicDefaultConstructor, serializerProxy.ConstructorHandling);
|
||||
|
||||
#if !(DNXCORE50)
|
||||
#if !(DNXCORE50) || NETSTANDARD2_0
|
||||
serializerProxy.Context = new StreamingContext(StreamingContextStates.Other);
|
||||
Assert.AreEqual(new StreamingContext(StreamingContextStates.Other), serializerProxy.Context);
|
||||
#endif
|
||||
@@ -1297,7 +1299,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
serializerProxy.TraceWriter = traceWriter;
|
||||
Assert.AreEqual(traceWriter, serializerProxy.TraceWriter);
|
||||
|
||||
#if !(PORTABLE || PORTABLE40 || NET20 || DNXCORE50)
|
||||
#if !(PORTABLE || PORTABLE40 || NET20 || DNXCORE50) || NETSTANDARD2_0
|
||||
#pragma warning disable 618
|
||||
serializerProxy.TypeNameAssemblyFormat = FormatterAssemblyStyle.Full;
|
||||
Assert.AreEqual(FormatterAssemblyStyle.Full, serializerProxy.TypeNameAssemblyFormat);
|
||||
@@ -1318,7 +1320,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Assert.AreEqual(TypeNameHandling.All, serializerProxy.TypeNameHandling);
|
||||
}
|
||||
|
||||
#if !(PORTABLE || PORTABLE40 || DNXCORE50)
|
||||
#if !(PORTABLE || PORTABLE40 || DNXCORE50) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void DeserializeISerializableIConvertible()
|
||||
{
|
||||
@@ -1800,7 +1802,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Assert.AreEqual(executorObject2.clientGetResultFunction, "ClientBanSubsCB");
|
||||
}
|
||||
|
||||
#if !(DNXCORE50)
|
||||
#if !(DNXCORE50) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void HashtableDeserialization()
|
||||
{
|
||||
@@ -2241,7 +2243,7 @@ keyword such as type of business.""
|
||||
string json = JsonConvert.SerializeObject(new ConverableMembers(), Formatting.Indented);
|
||||
|
||||
string expected = null;
|
||||
#if !(PORTABLE || DNXCORE50)
|
||||
#if !(PORTABLE || DNXCORE50) || NETSTANDARD2_0
|
||||
expected = @"{
|
||||
""String"": ""string"",
|
||||
""Int32"": 2147483647,
|
||||
@@ -3423,7 +3425,7 @@ To fix this error either change the JSON to a JSON object (e.g. {""name"":""valu
|
||||
Path '', line 1, position 1.");
|
||||
}
|
||||
|
||||
#if !(PORTABLE || DNXCORE50)
|
||||
#if !(PORTABLE || DNXCORE50) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void CannotDeserializeArrayIntoSerializable()
|
||||
{
|
||||
@@ -3541,7 +3543,7 @@ Path '', line 1, position 1.");
|
||||
{
|
||||
ContractResolver = new DefaultContractResolver
|
||||
{
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
IgnoreSerializableAttribute = true
|
||||
#endif
|
||||
}
|
||||
@@ -3558,7 +3560,7 @@ Path '', line 1, position 1.");
|
||||
{
|
||||
ContractResolver = new DefaultContractResolver
|
||||
{
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
IgnoreSerializableAttribute = true
|
||||
#endif
|
||||
}
|
||||
@@ -3575,7 +3577,7 @@ Path '', line 1, position 1.");
|
||||
{
|
||||
ContractResolver = new DefaultContractResolver
|
||||
{
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
IgnoreSerializableAttribute = true
|
||||
#endif
|
||||
}
|
||||
@@ -3592,7 +3594,7 @@ Path '', line 1, position 1.");
|
||||
{
|
||||
ContractResolver = new DefaultContractResolver
|
||||
{
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
IgnoreSerializableAttribute = true
|
||||
#endif
|
||||
}
|
||||
@@ -4054,7 +4056,7 @@ Path '', line 1, position 1.");
|
||||
Assert.AreEqual("value", newModelStateDictionary["key"]);
|
||||
}
|
||||
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
#if DEBUG
|
||||
[Test]
|
||||
public void SerializeISerializableInPartialTrustWithIgnoreInterface()
|
||||
@@ -4201,7 +4203,7 @@ Path '', line 1, position 1.");
|
||||
#if !NET20
|
||||
dateTimeOffsetText = @"\/Date(977345999000+0200)\/";
|
||||
#else
|
||||
dateTimeOffsetText = @"12/20/2000 22:59:59 +02:00";
|
||||
dateTimeOffsetText = @"12/20/2000 22:59:59 +02:00";
|
||||
#endif
|
||||
|
||||
ISerializableTestObject o = new ISerializableTestObject("String!", int.MinValue, dateTimeOffset, person);
|
||||
@@ -4291,7 +4293,7 @@ Path '', line 1, position 1.");
|
||||
}", json);
|
||||
}
|
||||
|
||||
#if !(PORTABLE)
|
||||
#if !(PORTABLE) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void DeserializeClassWithInheritedProtectedMember()
|
||||
{
|
||||
@@ -4391,7 +4393,7 @@ Path '', line 1, position 1.");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void SerializeDeserializeXmlNodeProperties()
|
||||
{
|
||||
@@ -4607,7 +4609,7 @@ Path '', line 1, position 1.");
|
||||
Assert.AreEqual(0, z[1].Prop1.Length);
|
||||
}
|
||||
|
||||
#if !(NET20 || DNXCORE50)
|
||||
#if !(NET20 || DNXCORE50) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void StringDictionaryTest()
|
||||
{
|
||||
@@ -4852,7 +4854,7 @@ Path '', line 1, position 1.");
|
||||
Assert.AreEqual(meh.IDontWork, "meh");
|
||||
}
|
||||
|
||||
#if !(NET20 || DNXCORE50)
|
||||
#if !(NET20 || DNXCORE50) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void DeserializeNullableStruct()
|
||||
{
|
||||
@@ -5265,7 +5267,7 @@ Path '', line 1, position 1.");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void SerializeException1()
|
||||
{
|
||||
@@ -5484,7 +5486,7 @@ Path '', line 1, position 1.");
|
||||
Assert.AreEqual(-3, StaticTestClass.z);
|
||||
}
|
||||
|
||||
#if !(NET20 || DNXCORE50)
|
||||
#if !(NET20 || DNXCORE50) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void DeserializeDecimalsWithCulture()
|
||||
{
|
||||
@@ -5584,7 +5586,7 @@ Path '', line 1, position 1.");
|
||||
}, "Error converting value {null} to type 'System.Int32'. Path '[3]', line 5, position 6.");
|
||||
}
|
||||
|
||||
#if !(PORTABLE)
|
||||
#if !(PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void SerializeIConvertible()
|
||||
{
|
||||
@@ -6312,7 +6314,7 @@ Path '', line 1, position 1.");
|
||||
Assert.AreEqual("", s);
|
||||
}
|
||||
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void SerializeAndDeserializeWithAttributes()
|
||||
{
|
||||
@@ -6682,7 +6684,7 @@ This is just junk, though.";
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if !PORTABLE || NETSTANDARD1_3
|
||||
#if !PORTABLE || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void DeserializeReadOnlyListWithBigInteger()
|
||||
{
|
||||
@@ -6740,7 +6742,7 @@ This is just junk, though.";
|
||||
|
||||
Action doStuff = () => { obj = JsonConvert.DeserializeObject<MyTuple<int>>(json); };
|
||||
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD2_0
|
||||
doStuff();
|
||||
Assert.AreEqual(500, obj.Item1);
|
||||
#else
|
||||
@@ -6771,7 +6773,7 @@ This is just junk, though.";
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(PORTABLE || NET35 || NET20 || PORTABLE40 || DNXCORE50)
|
||||
#if !(PORTABLE || NET35 || NET20 || PORTABLE40 || DNXCORE50) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void SerializeTupleWithSerializableAttribute()
|
||||
{
|
||||
@@ -6967,7 +6969,7 @@ This is just junk, though.";
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(PORTABLE || NET35 || NET20 || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(PORTABLE || NET35 || NET20 || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void ReadTooLargeInteger()
|
||||
{
|
||||
@@ -6990,7 +6992,7 @@ This is just junk, though.";
|
||||
|
||||
Assert.AreEqual(@"{""First"":""One"",""Second"":2}", json);
|
||||
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
DefaultContractResolver r = new DefaultContractResolver();
|
||||
r.IgnoreSerializableAttribute = false;
|
||||
|
||||
@@ -7097,7 +7099,7 @@ This is just junk, though.";
|
||||
Assert.AreEqual(1234567890.123456m, d);
|
||||
}
|
||||
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void DontSerializeStaticFields()
|
||||
{
|
||||
@@ -7121,7 +7123,7 @@ This is just junk, though.";
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void SerializeBigInteger()
|
||||
{
|
||||
@@ -7262,7 +7264,7 @@ This is just junk, though.";
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(PORTABLE || PORTABLE40 || DNXCORE50) || NETSTANDARD1_0 || NETSTANDARD1_3
|
||||
#if !(PORTABLE || PORTABLE40 || DNXCORE50) || NETSTANDARD1_0 || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void SerializeDictionaryWithStructKey_Custom()
|
||||
{
|
||||
@@ -7353,7 +7355,7 @@ This is just junk, though.";
|
||||
Assert.AreEqual(jane, john.Spouse);
|
||||
}
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE || PORTABLE40)
|
||||
#if !(NET35 || NET20 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void TypeConverterOnInterface()
|
||||
{
|
||||
@@ -7419,7 +7421,7 @@ This is just junk, though.";
|
||||
ParticipantEntity deserializedProduct = JsonConvert.DeserializeObject<ParticipantEntity>(json);
|
||||
}
|
||||
|
||||
#if !(PORTABLE)
|
||||
#if !(PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void ConvertibleIdTest()
|
||||
{
|
||||
@@ -7745,7 +7747,7 @@ This is just junk, though.";
|
||||
Assert.AreEqual("derived", d.DerivedProperty);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void DeserializeNullableUnsignedLong()
|
||||
{
|
||||
@@ -7760,7 +7762,7 @@ This is just junk, though.";
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(DNXCORE50)
|
||||
#if !(DNXCORE50) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void MailMessageConverterTest()
|
||||
{
|
||||
|
||||
@@ -339,7 +339,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Assert.IsTrue(JToken.DeepEquals(t1, t2));
|
||||
}
|
||||
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void DeserializeGenericObjectListWithTypeName()
|
||||
{
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
}", json);
|
||||
}
|
||||
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
public class MainClass : ISerializable
|
||||
{
|
||||
public ChildClass Child { get; set; }
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
public void GetAttributes_Property()
|
||||
{
|
||||
PropertyInfo property;
|
||||
#if DNXCORE50
|
||||
#if DNXCORE50 && !NETSTANDARD2_0
|
||||
property = Newtonsoft.Json.Utilities.TypeExtensions.GetProperty(typeof(ReflectionTestObject), "TestProperty");
|
||||
#else
|
||||
property = typeof(ReflectionTestObject).GetProperty("TestProperty");
|
||||
@@ -87,7 +87,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
public void GetAttributes_Field()
|
||||
{
|
||||
FieldInfo field;
|
||||
#if DNXCORE50
|
||||
#if DNXCORE50 && !NETSTANDARD2_0
|
||||
field = (FieldInfo)Newtonsoft.Json.Utilities.TypeExtensions.GetField(typeof(ReflectionTestObject), "TestField");
|
||||
#else
|
||||
field = typeof(ReflectionTestObject).GetField("TestField");
|
||||
|
||||
@@ -272,7 +272,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
}", json);
|
||||
}
|
||||
|
||||
#if !(PORTABLE || DNXCORE50)
|
||||
#if !(PORTABLE || DNXCORE50) || NETSTANDARD2_0
|
||||
public class SerializationEventContextTestObject
|
||||
{
|
||||
public string TestMember { get; set; }
|
||||
@@ -303,7 +303,8 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(PORTABLE || DNXCORE50)
|
||||
#if !(PORTABLE || DNXCORE50) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void WhenSerializationErrorDetectedBySerializer_ThenCallbackIsCalled()
|
||||
{
|
||||
// Verify contract is properly finding our callback
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Runtime.Serialization;
|
||||
@@ -44,7 +44,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
[TestFixture]
|
||||
public class TraceWriterTests : TestFixtureBase
|
||||
{
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40)
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void DiagnosticsTraceWriterTest()
|
||||
{
|
||||
@@ -790,7 +790,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 !(PORTABLE || DNXCORE50 || PORTABLE40)
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void DeserializeISerializable()
|
||||
{
|
||||
@@ -996,7 +996,7 @@ Newtonsoft.Json Error: 0 : Error!
|
||||
Assert.AreEqual(23, deserialized.FavoriteNumber);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void TraceJsonWriterTest()
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
#endif
|
||||
#if !(PORTABLE || PORTABLE40)
|
||||
#if !(PORTABLE || PORTABLE40) || NETSTANDARD2_0
|
||||
using System.Collections.ObjectModel;
|
||||
#if !(NET35 || NET20)
|
||||
using System.Dynamic;
|
||||
@@ -1165,10 +1165,12 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
#pragma warning restore 618
|
||||
});
|
||||
|
||||
string dictionaryTypeName = ReflectionUtils.GetTypeName(typeof(Dictionary<string, object>), TypeNameAssemblyFormatHandling.Simple, null);
|
||||
string urlStatusTypeName = ReflectionUtils.GetTypeName(typeof(UrlStatus), TypeNameAssemblyFormatHandling.Simple, null);
|
||||
string listTypeName = ReflectionUtils.GetTypeName(typeof(List<UrlStatus>), TypeNameAssemblyFormatHandling.Simple, null);
|
||||
|
||||
StringAssert.AreEqual(@"{
|
||||
""$type"": ""System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[System.Object, mscorlib]], mscorlib"",
|
||||
""$type"": """ + dictionaryTypeName + @""",
|
||||
""First"": {
|
||||
""$type"": """ + urlStatusTypeName + @""",
|
||||
""Status"": 404,
|
||||
@@ -1180,7 +1182,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
""Url"": ""http://www.google.com""
|
||||
},
|
||||
""List"": {
|
||||
""$type"": ""System.Collections.Generic.List`1[[" + urlStatusTypeName + @"]], mscorlib"",
|
||||
""$type"": """ + listTypeName + @""",
|
||||
""$values"": [
|
||||
{
|
||||
""$type"": """ + urlStatusTypeName + @""",
|
||||
@@ -1306,15 +1308,17 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
string output = JsonConvert.SerializeObject(testerObject, Formatting.Indented, jsonSettings);
|
||||
|
||||
string carClassRef = ReflectionUtils.GetTypeName(typeof(Car), TypeNameAssemblyFormatHandling.Simple, null);
|
||||
string objectArrayRef = ReflectionUtils.GetTypeName(typeof(object[]), TypeNameAssemblyFormatHandling.Simple, null);
|
||||
string byteArrayRef = ReflectionUtils.GetTypeName(typeof(byte[]), TypeNameAssemblyFormatHandling.Simple, null);
|
||||
|
||||
StringAssert.AreEqual(output, @"{
|
||||
""$type"": """ + carClassRef + @""",
|
||||
""Year"": ""2000-10-05T01:01:01Z"",
|
||||
""Objects"": {
|
||||
""$type"": ""System.Object[], mscorlib"",
|
||||
""$type"": """ + objectArrayRef + @""",
|
||||
""$values"": [
|
||||
{
|
||||
""$type"": ""System.Byte[], mscorlib"",
|
||||
""$type"": """ + byteArrayRef + @""",
|
||||
""$value"": ""S0FSSVJB""
|
||||
},
|
||||
""prueba""
|
||||
@@ -1331,7 +1335,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
CollectionAssert.AreEquivalent(data, d);
|
||||
}
|
||||
|
||||
#if !(DNXCORE50)
|
||||
#if !(DNXCORE50) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void ISerializableTypeNameHandlingTest()
|
||||
{
|
||||
@@ -1611,6 +1615,9 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
};
|
||||
|
||||
string json = JsonConvert.SerializeObject(c1, Formatting.Indented);
|
||||
|
||||
string listTypeName = ReflectionUtils.GetTypeName(typeof(List<object>), TypeNameAssemblyFormatHandling.Simple, null);
|
||||
|
||||
StringAssert.AreEqual(@"{
|
||||
""Data"": [
|
||||
{
|
||||
@@ -1618,7 +1625,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
""MyProperty"": 1
|
||||
},
|
||||
{
|
||||
""$type"": ""System.Collections.Generic.List`1[[System.Object, mscorlib]], mscorlib"",
|
||||
""$type"": """+ listTypeName + @""",
|
||||
""$values"": [
|
||||
[
|
||||
[]
|
||||
@@ -1643,7 +1650,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
""MyProperty"": 1
|
||||
},
|
||||
{
|
||||
""$type"": ""System.Collections.Generic.List`1[[System.Object, mscorlib]], mscorlib"",
|
||||
""$type"": """ + listTypeName + @""",
|
||||
""$values"": [
|
||||
{
|
||||
""$type"": ""Newtonsoft.Json.Tests.TestObjects.TestComponentSimple, Newtonsoft.Json.Tests"",
|
||||
@@ -1690,6 +1697,9 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
};
|
||||
|
||||
string json = JsonConvert.SerializeObject(c1, Formatting.Indented);
|
||||
|
||||
string dictionaryTypeName = ReflectionUtils.GetTypeName(typeof(Dictionary<string, object>), TypeNameAssemblyFormatHandling.Simple, null);
|
||||
|
||||
StringAssert.AreEqual(@"{
|
||||
""Data"": {
|
||||
""one"": {
|
||||
@@ -1697,7 +1707,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
""MyProperty"": 1
|
||||
},
|
||||
""two"": {
|
||||
""$type"": ""System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[System.Object, mscorlib]], mscorlib"",
|
||||
""$type"": """ + dictionaryTypeName + @""",
|
||||
""one"": {
|
||||
""one"": 1
|
||||
}
|
||||
@@ -1720,7 +1730,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
""MyProperty"": 1
|
||||
},
|
||||
""two"": {
|
||||
""$type"": ""System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[System.Object, mscorlib]], mscorlib"",
|
||||
""$type"": """ + dictionaryTypeName + @""",
|
||||
""one"": {
|
||||
""$type"": ""Newtonsoft.Json.Tests.TestObjects.TestComponentSimple, Newtonsoft.Json.Tests"",
|
||||
""MyProperty"": 1
|
||||
@@ -1765,10 +1775,13 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
};
|
||||
|
||||
string json = JsonConvert.SerializeObject(o1, Formatting.Indented);
|
||||
|
||||
string listTypeName = ReflectionUtils.GetTypeName(typeof(List<object>), TypeNameAssemblyFormatHandling.Simple, null);
|
||||
|
||||
StringAssert.AreEqual(@"{
|
||||
""Data"": {
|
||||
""Prop1"": {
|
||||
""$type"": ""System.Collections.Generic.List`1[[System.Object, mscorlib]], mscorlib"",
|
||||
""$type"": """ + listTypeName + @""",
|
||||
""$values"": [
|
||||
{
|
||||
""MyProperty"": 1
|
||||
@@ -1872,7 +1885,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(DNXCORE50)
|
||||
#if !(DNXCORE50) || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void SerializeDeserialize_DictionaryContextContainsGuid_DeserializesItemAsGuid()
|
||||
{
|
||||
@@ -1889,8 +1902,10 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
};
|
||||
string serializedString = JsonConvert.SerializeObject(inputContext, jsonSerializerSettings);
|
||||
|
||||
string dictionaryTypeName = ReflectionUtils.GetTypeName(typeof(Dictionary<string, Guid>), TypeNameAssemblyFormatHandling.Simple, null);
|
||||
|
||||
StringAssert.AreEqual(@"{
|
||||
""$type"": ""System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[System.Guid, mscorlib]], mscorlib"",
|
||||
""$type"": """ + dictionaryTypeName + @""",
|
||||
""k1"": ""a6e986df-fc2c-4906-a1ef-9492388f7833""
|
||||
}", serializedString);
|
||||
|
||||
@@ -2078,10 +2093,12 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
data.Rows.Add("key", new List<MyInterfaceImplementationType> { new MyInterfaceImplementationType() { SomeProperty = "property" } });
|
||||
string serialized = JsonConvert.SerializeObject(data, Formatting.Indented);
|
||||
|
||||
string listTypeName = ReflectionUtils.GetTypeName(typeof(List<MyInterfaceImplementationType>), TypeNameAssemblyFormatHandling.Simple, null);
|
||||
|
||||
StringAssert.AreEqual(@"{
|
||||
""Rows"": {
|
||||
""key"": {
|
||||
""$type"": ""System.Collections.Generic.List`1[[Newtonsoft.Json.Tests.Serialization.MyInterfaceImplementationType, Newtonsoft.Json.Tests]], mscorlib"",
|
||||
""$type"": """ + listTypeName + @""",
|
||||
""$values"": [
|
||||
{
|
||||
""SomeProperty"": ""property""
|
||||
@@ -2190,7 +2207,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
{
|
||||
var serializer = JsonSerializer.Create();
|
||||
#pragma warning disable CS0618
|
||||
Assert.NotNull(serializer.Binder);
|
||||
Assert.AreNotEqual(null, serializer.Binder);
|
||||
Assert.IsInstanceOf(typeof(DefaultSerializationBinder), serializer.Binder);
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
Assert.IsInstanceOf(typeof(DefaultSerializationBinder), serializer.SerializationBinder);
|
||||
@@ -2297,7 +2314,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
public string SomeProperty { get; set; }
|
||||
}
|
||||
|
||||
#if !(DNXCORE50)
|
||||
#if !(DNXCORE50) || NETSTANDARD2_0
|
||||
public class ParentParent
|
||||
{
|
||||
[JsonProperty(ItemTypeNameHandling = TypeNameHandling.Auto)]
|
||||
@@ -2365,7 +2382,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
public int Quantity { get; set; }
|
||||
}
|
||||
|
||||
#if !(DNXCORE50)
|
||||
#if !(DNXCORE50) || NETSTANDARD2_0
|
||||
public class SerializableWrapper
|
||||
{
|
||||
public object Content { get; set; }
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
{
|
||||
ContractResolver = new DefaultContractResolver
|
||||
{
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
IgnoreSerializableAttribute = false
|
||||
#endif
|
||||
}
|
||||
@@ -84,7 +84,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Assert.AreEqual(expected, json);
|
||||
}
|
||||
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Test]
|
||||
public void SerializeInheritedType()
|
||||
{
|
||||
@@ -114,7 +114,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
}
|
||||
}
|
||||
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3
|
||||
#if !(PORTABLE || DNXCORE50 || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Serializable]
|
||||
#else
|
||||
[JsonObject(MemberSerialization.Fields)]
|
||||
|
||||
@@ -34,7 +34,7 @@ using System.Linq;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !(PORTABLE || DNXCORE50) || NETSTANDARD1_3
|
||||
#if !(PORTABLE || DNXCORE50) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Serializable]
|
||||
public class AnswerFilterModel
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ using System.IO;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !(DNXCORE50)
|
||||
#if !(DNXCORE50) || NETSTANDARD2_0
|
||||
public class AttachmentReadConverter : JsonConverter
|
||||
{
|
||||
public override bool CanConvert(Type objectType)
|
||||
|
||||
@@ -27,7 +27,7 @@ using System.ComponentModel;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !(NET35 || NET20 || PORTABLE || PORTABLE40)
|
||||
#if !(NET35 || NET20 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[TypeConverter(typeof(MyInterfaceConverter))]
|
||||
internal class ConsoleWriter : IMyInterface
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
public ulong ULong = long.MaxValue;
|
||||
public double Double = double.MaxValue;
|
||||
public float Float = float.MaxValue;
|
||||
#if !(PORTABLE || DNXCORE50)
|
||||
#if !(PORTABLE || DNXCORE50) || NETSTANDARD2_0
|
||||
public DBNull DBNull = DBNull.Value;
|
||||
#endif
|
||||
public bool Bool = true;
|
||||
|
||||
@@ -27,7 +27,7 @@ using System;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !(PORTABLE)
|
||||
#if !(PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
public class ConvertableIntTestClass
|
||||
{
|
||||
public ConvertibleInt Integer { get; set; }
|
||||
|
||||
@@ -27,7 +27,7 @@ using System;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !(PORTABLE)
|
||||
#if !(PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
public struct ConvertibleInt : IConvertible
|
||||
{
|
||||
private readonly int _value;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(PORTABLE40 || PORTABLE || DNXCORE50)
|
||||
#if !(PORTABLE40 || PORTABLE || DNXCORE50) || NETSTANDARD2_0
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
@@ -28,7 +28,7 @@ using System.Text;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !(DNXCORE50)
|
||||
#if !(DNXCORE50) || NETSTANDARD2_0
|
||||
public class EncodingReadConverter : JsonConverter
|
||||
{
|
||||
public override bool CanConvert(Type objectType)
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET40 || NET35 || NET20 || DNXCORE50)
|
||||
#if !(NET40 || NET35 || NET20 || DNXCORE50) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || DNXCORE50)
|
||||
#if !(NET35 || NET20 || DNXCORE50) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
namespace Newtonsoft.Json.Tests.TestObjects.GeometricForms
|
||||
{
|
||||
public static class Tags
|
||||
|
||||
@@ -27,7 +27,7 @@ using System.ComponentModel;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !(NET35 || NET20 || PORTABLE || PORTABLE40)
|
||||
#if !(NET35 || NET20 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[TypeConverter(typeof(MyInterfaceConverter))]
|
||||
internal interface IMyInterface
|
||||
{
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
|
||||
public override bool CanConvert(Type objectType)
|
||||
{
|
||||
#if DNXCORE50
|
||||
#if DNXCORE50 && !NETSTANDARD2_0
|
||||
return Newtonsoft.Json.Utilities.TypeExtensions.IsAssignableFrom(typeof(IList<T>), objectType);
|
||||
#else
|
||||
return typeof(IList<T>).IsAssignableFrom(objectType);
|
||||
|
||||
@@ -28,7 +28,7 @@ using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !(DNXCORE50)
|
||||
#if !(DNXCORE50) || NETSTANDARD2_0
|
||||
public class MailAddressReadConverter : JsonConverter
|
||||
{
|
||||
public override bool CanConvert(Type objectType)
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET40 || NET35 || NET20 || DNXCORE50)
|
||||
#if !(NET40 || NET35 || NET20 || DNXCORE50) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || DNXCORE50)
|
||||
#if !(NET35 || NET20 || DNXCORE50) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects.Money
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ using System.Linq;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !(NET35 || NET20 || PORTABLE || PORTABLE40)
|
||||
#if !(NET35 || NET20 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
internal class MyInterfaceConverter : TypeConverter
|
||||
{
|
||||
private readonly List<IMyInterface> _writers = new List<IMyInterface>
|
||||
|
||||
@@ -27,7 +27,7 @@ using System.Runtime.Serialization;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !(NET20 || DNXCORE50)
|
||||
#if !(NET20 || DNXCORE50) || NETSTANDARD2_0
|
||||
[DataContract]
|
||||
public class NullableStructPropertyClass
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ using System;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !(PORTABLE || DNXCORE50) || NETSTANDARD1_3
|
||||
#if !(PORTABLE || DNXCORE50) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
[Serializable]
|
||||
public class PersonSerializable
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ using System.Runtime.Serialization;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !(PORTABLE || PORTABLE40 || DNXCORE50)
|
||||
#if !(PORTABLE || PORTABLE40 || DNXCORE50) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
public class PreserveReferencesCallbackTestObject : ISerializable
|
||||
{
|
||||
internal string _stringValue;
|
||||
|
||||
@@ -29,7 +29,7 @@ using System.Runtime.Serialization;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !(DNXCORE50)
|
||||
#if !(DNXCORE50) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
public struct Ratio : IConvertible, IFormattable, ISerializable
|
||||
{
|
||||
private readonly int _numerator;
|
||||
|
||||
@@ -27,7 +27,7 @@ using Newtonsoft.Json.Serialization;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !(PORTABLE || NET35 || NET20 || PORTABLE40 || DNXCORE50)
|
||||
#if !(PORTABLE || NET35 || NET20 || PORTABLE40 || DNXCORE50) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
public class SerializableContractResolver : DefaultContractResolver
|
||||
{
|
||||
public SerializableContractResolver()
|
||||
|
||||
@@ -27,7 +27,7 @@ using System.Collections.Specialized;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !(NET20 || DNXCORE50)
|
||||
#if !(NET20 || DNXCORE50) || NETSTANDARD2_0
|
||||
public class StringDictionaryTestClass
|
||||
{
|
||||
public StringDictionary StringDictionaryProperty { get; set; }
|
||||
|
||||
@@ -27,7 +27,7 @@ using System.Runtime.Serialization;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !(NET20 || DNXCORE50)
|
||||
#if !(NET20 || DNXCORE50) || NETSTANDARD2_0
|
||||
[DataContract]
|
||||
public struct StructISerializable : ISerializable
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !(NET35 || NET20 || PORTABLE || PORTABLE40)
|
||||
#if !(NET35 || NET20 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
internal class TraceWriter : IMyInterface
|
||||
{
|
||||
public string Name
|
||||
|
||||
@@ -34,7 +34,7 @@ using Newtonsoft.Json.Utilities;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !(NET35 || NET20 || PORTABLE || PORTABLE40)
|
||||
#if !(NET35 || NET20 || PORTABLE || PORTABLE40) || NETSTANDARD1_3 || NETSTANDARD2_0
|
||||
internal class TypeConverterJsonConverter : JsonConverter
|
||||
{
|
||||
private TypeConverter GetConverter(Type type)
|
||||
|
||||
@@ -27,7 +27,7 @@ using System.Collections;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !(DNXCORE50)
|
||||
#if !(DNXCORE50) || NETSTANDARD2_0
|
||||
public class TypedSubHashtable
|
||||
{
|
||||
public string Name;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks Condition="'$(LibraryFrameworks)'==''">net45;net40;net35;net20;netstandard1.0;netstandard1.3;portable-net45+win8+wpa81+wp8;portable-net40+win8+wpa81+wp8+sl5</TargetFrameworks>
|
||||
<TargetFrameworks Condition="'$(LibraryFrameworks)'==''">net45;net40;net35;net20;netstandard1.0;netstandard1.3;netstandard2.0;portable-net45+win8+wpa81+wp8;portable-net40+win8+wpa81+wp8+sl5</TargetFrameworks>
|
||||
<TargetFrameworks Condition="'$(LibraryFrameworks)'!=''">$(LibraryFrameworks)</TargetFrameworks>
|
||||
<AssemblyVersion>10.0.0.0</AssemblyVersion>
|
||||
<FileVersion>10.0.1</FileVersion>
|
||||
@@ -24,7 +24,7 @@
|
||||
<RootNamespace>Newtonsoft.Json</RootNamespace>
|
||||
<AssemblyName>Newtonsoft.Json</AssemblyName>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
|
||||
<NetStandardImplicitPackageVersion>2.0.0</NetStandardImplicitPackageVersion>
|
||||
<MinClientVersion>2.12</MinClientVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
@@ -65,6 +65,10 @@
|
||||
<AssemblyTitle>Json.NET .NET Standard 1.3</AssemblyTitle>
|
||||
<DefineConstants>NETSTANDARD1_3;PORTABLE;HAVE_ASYNC;HAVE_BIG_INTEGER;HAVE_BINARY_SERIALIZATION;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DYNAMIC;HAVE_EXPRESSIONS;HAVE_FSHARP_TYPES;HAVE_GUID_TRY_PARSE;HAVE_HASH_SET;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_ISET;HAVE_LINQ;HAVE_METHOD_IMPL_ATTRIBUTE;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_READ_ONLY_COLLECTIONS;HAVE_REFLECTION_BINDER;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_OBSOLETE_FORMATTER_ASSEMBLY_STYLE;HAVE_XML_DOCUMENT;HAVE_CONCURRENT_DICTIONARY;HAVE_ICONVERTIBLE;$(AdditionalConstants)</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
|
||||
<AssemblyTitle>Json.NET .NET Standard 2.0</AssemblyTitle>
|
||||
<DefineConstants>NETSTANDARD2_0;HAVE_ADO_NET;HAVE_APP_DOMAIN;HAVE_ASYNC;HAVE_BIG_INTEGER;HAVE_BINARY_FORMATTER;HAVE_BINARY_SERIALIZATION;HAVE_BINARY_EXCEPTION_SERIALIZATION;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_CHAR_TO_STRING_WITH_CULTURE;HAVE_COM_ATTRIBUTES;HAVE_COMPONENT_MODEL;HAVE_CONCURRENT_COLLECTIONS;HAVE_COVARIANT_GENERICS;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_DYNAMIC;HAVE_EMPTY_TYPES;HAVE_ENTITY_FRAMEWORK;HAVE_EXPRESSIONS;HAVE_FAST_REVERSE;HAVE_FSHARP_TYPES;HAVE_FULL_REFLECTION;HAVE_GUID_TRY_PARSE;HAVE_HASH_SET;HAVE_ICLONEABLE;HAVE_ICONVERTIBLE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_INOTIFY_COLLECTION_CHANGED;HAVE_INOTIFY_PROPERTY_CHANGING;HAVE_ISET;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_METHOD_IMPL_ATTRIBUTE;HAVE_NON_SERIALIZED_ATTRIBUTE;HAVE_READ_ONLY_COLLECTIONS;HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STREAM_READER_WRITER_CLOSE;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_TRACE_WRITER;HAVE_TYPE_DESCRIPTOR;HAVE_UNICODE_SURROGATE_DETECTION;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;HAVE_XLINQ;HAVE_XML_DOCUMENT;HAVE_XML_DOCUMENT_TYPE;HAVE_CONCURRENT_DICTIONARY;$(AdditionalConstants)</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(TargetFramework)' == 'portable-net40+win8+wpa81+wp8+sl5'">
|
||||
<AssemblyTitle>Json.NET Portable .NET 4.0</AssemblyTitle>
|
||||
<DefineConstants>PORTABLE40;HAVE_CHAR_TO_LOWER_WITH_CULTURE;HAVE_DATA_CONTRACTS;HAVE_DATE_TIME_OFFSET;HAVE_DB_NULL_TYPE_CODE;HAVE_FAST_REVERSE;HAVE_FSHARP_TYPES;HAVE_FULL_REFLECTION;HAVE_GUID_TRY_PARSE;HAVE_ICONVERTIBLE;HAVE_IGNORE_DATA_MEMBER_ATTRIBUTE;HAVE_ISET;HAVE_LINQ;HAVE_MEMORY_BARRIER;HAVE_OBSOLETE_FORMATTER_ASSEMBLY_STYLE;HAVE_SECURITY_SAFE_CRITICAL_ATTRIBUTE;HAVE_SERIALIZATION_BINDER_BIND_TO_NAME;HAVE_STRING_JOIN_WITH_ENUMERABLE;HAVE_TIME_SPAN_PARSE_WITH_CULTURE;HAVE_TIME_SPAN_TO_STRING_WITH_CULTURE;HAVE_TIME_ZONE_INFO;HAVE_VARIANT_TYPE_PARAMETERS;HAVE_VERSION_TRY_PARSE;$(AdditionalConstants)</DefineConstants>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user