-Fixed MetadataTypeAttribute reflection bug by using CustomAttributeData
-Fixed immutable collections bug by getting type from known assembly -Added support from running tests on aspnetcore50
This commit is contained in:
@@ -30,17 +30,21 @@ using System.Reflection;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !(NET20 || NET35 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50)
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Bson;
|
||||
using System.IO;
|
||||
@@ -1456,7 +1460,7 @@ namespace Newtonsoft.Json.Tests.Bson
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
public class BigIntegerTestClass
|
||||
{
|
||||
public BigInteger Blah { get; set; }
|
||||
|
||||
@@ -25,17 +25,21 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !(NET20 || NET35 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50)
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Bson;
|
||||
using System.IO;
|
||||
@@ -810,7 +814,7 @@ namespace Newtonsoft.Json.Tests.Bson
|
||||
Assert.AreEqual(c.AGuid, c2.AGuid.ToString());
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void WriteBigInteger()
|
||||
{
|
||||
|
||||
@@ -25,20 +25,24 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !NET20 && !NETFX_CORE
|
||||
#if !(NET20 || NETFX_CORE || ASPNETCORE50)
|
||||
using System.Data.Linq;
|
||||
#endif
|
||||
#if !(NETFX_CORE)
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
using System.Data.SqlTypes;
|
||||
#endif
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Converters;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Converters
|
||||
@@ -54,7 +58,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
public byte[] NullByteArray { get; set; }
|
||||
}
|
||||
|
||||
#if !(NET20 || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NETFX_CORE || PORTABLE || PORTABLE40 || ASPNETCORE50)
|
||||
[Test]
|
||||
public void DeserializeBinaryClass()
|
||||
{
|
||||
@@ -120,7 +124,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
}", json);
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40 || ASPNETCORE50)
|
||||
public class SqlBinaryClass
|
||||
{
|
||||
public SqlBinary SqlBinary { get; set; }
|
||||
|
||||
@@ -26,13 +26,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Converters;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Converters
|
||||
|
||||
@@ -23,15 +23,19 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
using System;
|
||||
using Newtonsoft.Json.Converters;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
|
||||
@@ -27,15 +27,19 @@ using System.IO;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Bson;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
#if !NETFX_CORE
|
||||
using System.Data;
|
||||
@@ -97,17 +101,17 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
Assert.AreEqual(2, deserializedDataTable.Rows.Count);
|
||||
|
||||
DataRow dr1 = deserializedDataTable.Rows[0];
|
||||
Assert.AreEqual(0, dr1["id"]);
|
||||
Assert.AreEqual(0L, dr1["id"]);
|
||||
Assert.AreEqual("item 0", dr1["item"]);
|
||||
Assert.AreEqual("0!", ((DataTable)dr1["DataTableCol"]).Rows[0]["NestedStringCol"]);
|
||||
Assert.AreEqual(0, ((long[])dr1["ArrayCol"])[0]);
|
||||
Assert.AreEqual(0L, ((long[])dr1["ArrayCol"])[0]);
|
||||
Assert.AreEqual(new DateTime(2000, 12, 29, 0, 0, 0, DateTimeKind.Utc), dr1["DateCol"]);
|
||||
|
||||
DataRow dr2 = deserializedDataTable.Rows[1];
|
||||
Assert.AreEqual(1, dr2["id"]);
|
||||
Assert.AreEqual(1L, dr2["id"]);
|
||||
Assert.AreEqual("item 1", dr2["item"]);
|
||||
Assert.AreEqual("1!", ((DataTable)dr2["DataTableCol"]).Rows[0]["NestedStringCol"]);
|
||||
Assert.AreEqual(1, ((long[])dr2["ArrayCol"])[0]);
|
||||
Assert.AreEqual(1L, ((long[])dr2["ArrayCol"])[0]);
|
||||
Assert.AreEqual(new DateTime(2000, 12, 29, 0, 0, 0, DateTimeKind.Utc), dr2["DateCol"]);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || NETFX_CORE)
|
||||
#if !(NET35 || NET20 || NETFX_CORE || ASPNETCORE50)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -24,27 +24,23 @@
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE40)
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !NET20 && !NETFX_CORE
|
||||
using System.Data.Linq;
|
||||
#endif
|
||||
#if !NETFX_CORE
|
||||
using System.Data.SqlTypes;
|
||||
#endif
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Converters;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Converters
|
||||
{
|
||||
|
||||
@@ -25,12 +25,16 @@
|
||||
|
||||
using System;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
@@ -122,7 +126,7 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
Assert.AreEqual(2006, d.Year);
|
||||
}
|
||||
|
||||
#if !NETFX_CORE
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
[Test]
|
||||
public void SerializeFormattedDateTimeNewZealandCulture()
|
||||
{
|
||||
|
||||
@@ -25,12 +25,16 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Tests.Serialization;
|
||||
|
||||
@@ -3,12 +3,16 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Converters
|
||||
|
||||
@@ -26,13 +26,16 @@
|
||||
using System.IO;
|
||||
using Newtonsoft.Json.Bson;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Converters
|
||||
|
||||
@@ -25,24 +25,22 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !NET20 && !NETFX_CORE
|
||||
using System.Data.Linq;
|
||||
#endif
|
||||
#if !NETFX_CORE
|
||||
using System.Data.SqlTypes;
|
||||
#endif
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using Newtonsoft.Json.Bson;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
|
||||
|
||||
@@ -31,12 +31,16 @@ using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Newtonsoft.Json.Converters;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
|
||||
|
||||
@@ -25,13 +25,16 @@
|
||||
|
||||
using System;
|
||||
using Newtonsoft.Json.Converters;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Converters
|
||||
|
||||
@@ -29,17 +29,21 @@ using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
using System.Linq;
|
||||
#endif
|
||||
using System.Text;
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Tests.Serialization;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json;
|
||||
using System.IO;
|
||||
|
||||
@@ -32,12 +32,16 @@ using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Schema;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE)
|
||||
#if !(NET35 || NET20 || PORTABLE || ASPNETCORE50)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -37,12 +37,16 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE)
|
||||
#if !(NET35 || NET20 || PORTABLE || ASPNETCORE50)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -35,12 +35,16 @@ using System.Text;
|
||||
using System.Xml;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE)
|
||||
#if !(NET35 || NET20 || PORTABLE || ASPNETCORE50)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -34,12 +34,16 @@ using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Schema;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE)
|
||||
#if !(NET35 || NET20 || PORTABLE || ASPNETCORE50)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -34,12 +34,16 @@ using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE)
|
||||
#if !(NET35 || NET20 || PORTABLE || ASPNETCORE50)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -36,12 +36,16 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE)
|
||||
#if !(NET35 || NET20 || PORTABLE || ASPNETCORE50)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -34,12 +34,16 @@ using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
|
||||
{
|
||||
|
||||
@@ -3,8 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer
|
||||
{
|
||||
public class SerializeDataSet
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE)
|
||||
#if !(NET35 || NET20 || PORTABLE || ASPNETCORE50)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -34,12 +34,16 @@ using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE)
|
||||
#if !(NET35 || NET20 || PORTABLE || ASPNETCORE50)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -38,12 +38,16 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Tests.Serialization;
|
||||
|
||||
@@ -25,13 +25,16 @@
|
||||
|
||||
using System;
|
||||
using Newtonsoft.Json.Schema;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests
|
||||
|
||||
@@ -23,12 +23,16 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests
|
||||
|
||||
@@ -27,7 +27,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE || ASPNETCORE50)
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Runtime.Serialization;
|
||||
@@ -42,13 +42,16 @@ using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Tests.Serialization;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests
|
||||
@@ -535,7 +538,7 @@ namespace Newtonsoft.Json.Tests
|
||||
value = null;
|
||||
Assert.AreEqual("null", JsonConvert.ToString(value));
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
value = DBNull.Value;
|
||||
Assert.AreEqual("null", JsonConvert.ToString(value));
|
||||
#endif
|
||||
@@ -1137,7 +1140,7 @@ namespace Newtonsoft.Json.Tests
|
||||
}
|
||||
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE || ASPNETCORE50)
|
||||
[Test]
|
||||
public void IntegerLengthOverflows()
|
||||
{
|
||||
|
||||
@@ -27,16 +27,20 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE || ASPNETCORE50)
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json;
|
||||
using System.IO;
|
||||
@@ -78,7 +82,7 @@ second line
|
||||
third line", jsonTextReader.Value);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE || ASPNETCORE50)
|
||||
[Test]
|
||||
public void ReadBigInteger()
|
||||
{
|
||||
@@ -517,7 +521,7 @@ third line", jsonTextReader.Value);
|
||||
]content";
|
||||
|
||||
JsonTextReader reader = new JsonTextReader(new StringReader(json));
|
||||
#if DEBUG
|
||||
#if DEBUG && !NOINTERNALS
|
||||
reader.SetCharBuffer(new char[2]);
|
||||
#endif
|
||||
|
||||
@@ -586,7 +590,7 @@ third line", jsonTextReader.Value);
|
||||
|
||||
using (JsonTextReader jsonReader = new JsonTextReader(sr))
|
||||
{
|
||||
#if DEBUG
|
||||
#if DEBUG && !NOINTERNALS
|
||||
jsonReader.SetCharBuffer(new char[5]);
|
||||
#endif
|
||||
|
||||
@@ -904,7 +908,7 @@ third line", jsonTextReader.Value);
|
||||
]";
|
||||
|
||||
JsonTextReader reader = new JsonTextReader(new StringReader(json));
|
||||
#if DEBUG
|
||||
#if DEBUG && !NOINTERNALS
|
||||
reader.SetCharBuffer(new char[129]);
|
||||
#endif
|
||||
|
||||
@@ -958,7 +962,7 @@ third line", jsonTextReader.Value);
|
||||
}
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE || ASPNETCORE50)
|
||||
[Test]
|
||||
public void ReadInt64Overflow()
|
||||
{
|
||||
@@ -1019,7 +1023,7 @@ third line", jsonTextReader.Value);
|
||||
";
|
||||
|
||||
JsonTextReader reader = new JsonTextReader(new StringReader(json));
|
||||
#if DEBUG
|
||||
#if DEBUG && !NOINTERNALS
|
||||
reader.SetCharBuffer(new char[129]);
|
||||
#endif
|
||||
|
||||
@@ -1562,7 +1566,7 @@ third line", jsonTextReader.Value);
|
||||
string json = @"[""\u003c"",""\u5f20""]";
|
||||
|
||||
JsonTextReader reader = new JsonTextReader(new StringReader(json));
|
||||
#if DEBUG
|
||||
#if DEBUG && !NOINTERNALS
|
||||
reader.SetCharBuffer(new char[2]);
|
||||
#endif
|
||||
|
||||
@@ -1894,7 +1898,7 @@ third line", jsonTextReader.Value);
|
||||
string json = @"{""Message"":""Hi,I\u0092ve send you smth""}";
|
||||
|
||||
JsonTextReader reader = new JsonTextReader(new StringReader(json));
|
||||
#if DEBUG
|
||||
#if DEBUG && !NOINTERNALS
|
||||
reader.SetCharBuffer(new char[5]);
|
||||
#endif
|
||||
|
||||
@@ -2251,7 +2255,7 @@ third line", jsonTextReader.Value);
|
||||
]";
|
||||
|
||||
JsonTextReader reader = new JsonTextReader(new StringReader(json));
|
||||
#if DEBUG
|
||||
#if DEBUG && !NOINTERNALS
|
||||
reader.SetCharBuffer(new char[5]);
|
||||
#endif
|
||||
|
||||
@@ -2279,7 +2283,7 @@ third line", jsonTextReader.Value);
|
||||
} /*comment*/";
|
||||
|
||||
JsonTextReader reader = new JsonTextReader(new StringReader(json));
|
||||
#if DEBUG
|
||||
#if DEBUG && !NOINTERNALS
|
||||
reader.SetCharBuffer(new char[5]);
|
||||
#endif
|
||||
|
||||
@@ -2299,7 +2303,7 @@ third line", jsonTextReader.Value);
|
||||
{
|
||||
string json = "new Date\0()";
|
||||
JsonTextReader reader = new JsonTextReader(new StringReader(json));
|
||||
#if DEBUG
|
||||
#if DEBUG && !NOINTERNALS
|
||||
reader.SetCharBuffer(new char[7]);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -35,13 +35,20 @@ using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json.Converters;
|
||||
@@ -114,7 +121,7 @@ namespace Newtonsoft.Json.Tests
|
||||
Assert.IsTrue(ms.CanRead);
|
||||
}
|
||||
|
||||
#if !(PORTABLE || NETFX_CORE)
|
||||
#if !(PORTABLE || ASPNETCORE50 || NETFX_CORE)
|
||||
[Test]
|
||||
public void WriteIConvertable()
|
||||
{
|
||||
@@ -1509,7 +1516,7 @@ null//comment
|
||||
}
|
||||
}
|
||||
|
||||
#if !(PORTABLE || NETFX_CORE)
|
||||
#if !(PORTABLE || ASPNETCORE50 || NETFX_CORE)
|
||||
public struct ConvertibleInt : IConvertible
|
||||
{
|
||||
private readonly int _value;
|
||||
|
||||
@@ -29,16 +29,20 @@ using System.IO;
|
||||
#if NET20
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#endif
|
||||
#if !(NET20 || NET35 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50)
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
@@ -352,7 +356,7 @@ namespace Newtonsoft.Json.Tests
|
||||
Assert.IsNotNull(validationEventArgs);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void IntegerGreaterThanMaximumValue_BigInteger()
|
||||
{
|
||||
@@ -605,7 +609,7 @@ namespace Newtonsoft.Json.Tests
|
||||
Assert.IsNotNull(validationEventArgs);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void BigIntegerDivisibleBy_Success()
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40 || ASPNETCORE50)
|
||||
using NUnit.Framework;
|
||||
using System.Web.UI;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40 || ASPNETCORE50)
|
||||
using NUnit.Framework;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
|
||||
@@ -28,17 +28,21 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
#if !(NET20 || NET35 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50)
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Utilities;
|
||||
using System.Globalization;
|
||||
@@ -176,7 +180,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)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50)
|
||||
, new JProperty("BigInteger", BigInteger.Parse("1"))
|
||||
#endif
|
||||
);
|
||||
@@ -209,7 +213,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)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50)
|
||||
Assert.IsTrue(d.Decimal > new BigInteger(0));
|
||||
#endif
|
||||
|
||||
@@ -225,11 +229,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)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50)
|
||||
Assert.IsTrue(d.Float > new BigInteger(0));
|
||||
#endif
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50)
|
||||
Assert.IsTrue(d.BigInteger == d.BigInteger);
|
||||
Assert.IsTrue(d.BigInteger > 0);
|
||||
Assert.IsTrue(d.BigInteger > 0.0m);
|
||||
@@ -285,7 +289,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)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50)
|
||||
, new JProperty("BigInteger", new BigInteger(100))
|
||||
#endif
|
||||
);
|
||||
@@ -364,7 +368,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
r += 2;
|
||||
Assert.AreEqual(null, r.Value);
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50)
|
||||
r = d.BigInteger + null;
|
||||
Assert.AreEqual(null, r.Value);
|
||||
r += 2;
|
||||
@@ -443,7 +447,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
r -= 2;
|
||||
Assert.AreEqual(null, r.Value);
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50)
|
||||
r = d.BigInteger - null;
|
||||
Assert.AreEqual(null, r.Value);
|
||||
r -= 2;
|
||||
@@ -517,7 +521,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
r *= 2;
|
||||
Assert.AreEqual(null, r.Value);
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50)
|
||||
r = d.BigInteger * 1.1d;
|
||||
Assert.AreEqual(100m, (decimal)r);
|
||||
r *= 2;
|
||||
@@ -591,7 +595,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
r /= 2;
|
||||
Assert.AreEqual(null, r.Value);
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50)
|
||||
r = d.BigInteger / 1.1d;
|
||||
Assert.AreEqual(100m, (decimal)r);
|
||||
r /= 2;
|
||||
@@ -619,7 +623,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)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50)
|
||||
, new JProperty("BigInteger", new BigInteger(100))
|
||||
#endif
|
||||
);
|
||||
@@ -636,7 +640,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)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50)
|
||||
Assert.AreEqual("100", d.BigInteger.ToString());
|
||||
#endif
|
||||
}
|
||||
@@ -720,7 +724,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
AssertValueConverted<Guid?>(null);
|
||||
AssertValueConverted<Uri>(new Uri("http://json.codeplex.com/"));
|
||||
AssertValueConverted<Uri>(null);
|
||||
#if !(NET20 || NET35 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50)
|
||||
AssertValueConverted<BigInteger>(new BigInteger(100));
|
||||
AssertValueConverted<BigInteger?>(null);
|
||||
#endif
|
||||
|
||||
@@ -26,12 +26,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if NET20
|
||||
@@ -432,7 +436,7 @@ Parameter name: index");
|
||||
}
|
||||
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void ITypedListGetItemProperties()
|
||||
{
|
||||
|
||||
@@ -26,12 +26,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using System.IO;
|
||||
#if NET20
|
||||
|
||||
@@ -27,22 +27,26 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
#if !(NET20 || NET35 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50)
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
#if !NETFX_CORE
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
using System.Web.UI;
|
||||
#endif
|
||||
#if NET20
|
||||
@@ -697,7 +701,7 @@ Parameter name: arrayIndex");
|
||||
Assert.AreEqual(p4, l[1]);
|
||||
}
|
||||
|
||||
#if !(NET20 || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void PropertyChanging()
|
||||
{
|
||||
@@ -1240,7 +1244,7 @@ Parameter name: arrayIndex");
|
||||
}, "Can not add property Test3 to Newtonsoft.Json.Linq.JObject. Property with the same name already exists on object.");
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void IBindingListSortDirection()
|
||||
{
|
||||
@@ -1564,7 +1568,7 @@ Parameter name: arrayIndex");
|
||||
Assert.AreEqual("Name2", value);
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void WriteObjectNullDBNullValue()
|
||||
{
|
||||
@@ -1676,7 +1680,7 @@ Parameter name: arrayIndex");
|
||||
}, "Unexpected end of content while loading JObject. Path 'short.error.code', line 6, position 15.");
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void GetProperties()
|
||||
{
|
||||
|
||||
@@ -33,12 +33,16 @@ using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
using System.Linq;
|
||||
#endif
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using System.IO;
|
||||
|
||||
@@ -61,7 +65,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
Assert.AreEqual(p, p.Value.Parent);
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void ListChanged()
|
||||
{
|
||||
|
||||
@@ -23,13 +23,16 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !NETFX_CORE
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
|
||||
@@ -24,12 +24,16 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
|
||||
@@ -26,12 +26,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json;
|
||||
using System.IO;
|
||||
|
||||
@@ -25,17 +25,21 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !(NET20 || NET35 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50)
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Converters;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.IO;
|
||||
@@ -355,7 +359,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
|
||||
Assert.AreEqual(5, (int)(new JValue(StringComparison.OrdinalIgnoreCase)));
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
string bigIntegerText = "1234567899999999999999999999999999999999999999999999999999999999999990";
|
||||
|
||||
Assert.AreEqual(BigInteger.Parse(bigIntegerText), (new JValue(BigInteger.Parse(bigIntegerText))).Value);
|
||||
@@ -435,7 +439,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)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
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.");
|
||||
@@ -452,7 +456,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
[Test]
|
||||
public void ToObject()
|
||||
{
|
||||
#if !(NET20 || NET35 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50)
|
||||
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?))));
|
||||
@@ -509,7 +513,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
Assert.IsTrue(JToken.DeepEquals(new JValue((DateTimeOffset?)null), (JValue)(DateTimeOffset?)null));
|
||||
#endif
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
// 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)));
|
||||
@@ -948,7 +952,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
Assert.IsTrue(a.DeepEquals(a2));
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void Clone()
|
||||
{
|
||||
|
||||
@@ -29,12 +29,16 @@ using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json;
|
||||
using System.IO;
|
||||
@@ -120,7 +124,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
jsonWriter.WriteValue("DVD read/writer");
|
||||
Assert.AreEqual(WriteState.Array, jsonWriter.WriteState);
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
jsonWriter.WriteValue(new BigInteger(123));
|
||||
Assert.AreEqual(WriteState.Array, jsonWriter.WriteState);
|
||||
#endif
|
||||
@@ -149,7 +153,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
/*fail*/]", writer.Token.ToString());
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void WriteBigInteger()
|
||||
{
|
||||
|
||||
@@ -27,16 +27,20 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !(NET20 || NET35 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50)
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Text;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Globalization;
|
||||
@@ -124,7 +128,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
Assert.AreEqual("Pie", v.Value);
|
||||
Assert.AreEqual(JTokenType.String, v.Type);
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
v.Value = DBNull.Value;
|
||||
Assert.AreEqual(DBNull.Value, v.Value);
|
||||
Assert.AreEqual(JTokenType.Null, v.Type);
|
||||
@@ -153,7 +157,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
Assert.AreEqual(g, v.Value);
|
||||
Assert.AreEqual(JTokenType.Guid, v.Type);
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
BigInteger i = BigInteger.Parse("123456789999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990");
|
||||
v.Value = i;
|
||||
Assert.AreEqual(i, v.Value);
|
||||
@@ -213,13 +217,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)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
v = new JValue(BigInteger.Parse("123456789999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990"));
|
||||
Assert.AreEqual("123456789999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990", v.ToString(null, CultureInfo.InvariantCulture));
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void JValueParse()
|
||||
{
|
||||
@@ -468,7 +472,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50)
|
||||
[Test]
|
||||
public void ConvertsToBoolean()
|
||||
{
|
||||
@@ -487,7 +491,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
Assert.AreEqual(Int32.MaxValue, Convert.ToInt32(new JValue(Int32.MaxValue)));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void ConvertsToInt32_BigInteger()
|
||||
{
|
||||
@@ -649,7 +653,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)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
v = new JValue(new BigInteger(3));
|
||||
Assert.AreEqual(TypeCode.Object, v.GetTypeCode());
|
||||
#endif
|
||||
@@ -663,7 +667,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
int i = (int)v.ToType(typeof(int), CultureInfo.InvariantCulture);
|
||||
Assert.AreEqual(9, i);
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50)
|
||||
BigInteger bi = (BigInteger)v.ToType(typeof(BigInteger), CultureInfo.InvariantCulture);
|
||||
Assert.AreEqual(new BigInteger(9), bi);
|
||||
#endif
|
||||
@@ -678,7 +682,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
Assert.AreEqual("2013", v.ToString("yyyy"));
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void ToStringNewTypes()
|
||||
{
|
||||
|
||||
@@ -30,12 +30,16 @@ using System.Numerics;
|
||||
#endif
|
||||
using Newtonsoft.Json.Linq.JsonPath;
|
||||
using Newtonsoft.Json.Tests.Bson;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if NET20
|
||||
@@ -601,7 +605,7 @@ namespace Newtonsoft.Json.Tests.Linq.JsonPath
|
||||
Assert.IsTrue(JToken.DeepEquals(new JObject(new JProperty("hi", 3)), t[1]));
|
||||
}
|
||||
|
||||
#if !(PORTABLE || PORTABLE40 || NET35 || NET20)
|
||||
#if !(PORTABLE || ASPNETCORE50 || PORTABLE40 || NET35 || NET20)
|
||||
[Test]
|
||||
public void GreaterQueryBigInteger()
|
||||
{
|
||||
|
||||
@@ -26,12 +26,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Linq.JsonPath;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if NET20
|
||||
|
||||
@@ -1,14 +1,43 @@
|
||||
using System;
|
||||
#region License
|
||||
// Copyright (c) 2007 James Newton-King
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the "Software"), to deal in the Software without
|
||||
// restriction, including without limitation the rights to use,
|
||||
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following
|
||||
// conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Linq.JsonPath;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Linq.JsonPath
|
||||
|
||||
@@ -27,12 +27,16 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
@@ -1,4 +1,29 @@
|
||||
using System;
|
||||
#region License
|
||||
// Copyright (c) 2007 James Newton-King
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the "Software"), to deal in the Software without
|
||||
// restriction, including without limitation the rights to use,
|
||||
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following
|
||||
// conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if NET20
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
@@ -7,7 +32,17 @@ using System.Linq;
|
||||
#endif
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Linq
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(ASPNETCORE50 || NETFX_CORE || PORTABLE40 || PORTABLE40)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
@@ -132,4 +133,5 @@ namespace Newtonsoft.Json.Tests.LinqToSql
|
||||
Assert.AreEqual("_FirstName", columnAttribute.Storage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -23,8 +23,8 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET20 || NET35 || NETFX_CORE || PORTABLE || ASPNETCORE50)
|
||||
using System.Xml;
|
||||
#if !(NET20 || NET35 || NETFX_CORE || PORTABLE)
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -184,7 +184,7 @@ namespace Newtonsoft.Json.Tests
|
||||
{
|
||||
var json = System.IO.File.ReadAllText("large.json");
|
||||
|
||||
BenchmarkDeserializeMethod<IList<RootObject>>(SerializeMethod.JsonNet, json, 100, false);
|
||||
BenchmarkDeserializeMethod<IList<RootObject>>(SerializeMethod.JsonNet, json, Iterations / 10, false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -25,20 +25,23 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Schema;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !(NETFX_CORE)
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
using System.Data;
|
||||
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Schema
|
||||
@@ -199,7 +202,7 @@ namespace Newtonsoft.Json.Tests.Schema
|
||||
#if !NET20
|
||||
GenerateSchemaAndSerializeFromType(new NullableDateTimeTestClass());
|
||||
#endif
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
GenerateSchemaAndSerializeFromType(new DataSet());
|
||||
#endif
|
||||
GenerateSchemaAndSerializeFromType(new object());
|
||||
@@ -207,7 +210,7 @@ namespace Newtonsoft.Json.Tests.Schema
|
||||
GenerateSchemaAndSerializeFromType("Hi");
|
||||
GenerateSchemaAndSerializeFromType(new DateTime(2000, 12, 29, 23, 59, 0, DateTimeKind.Utc));
|
||||
GenerateSchemaAndSerializeFromType(TimeSpan.FromTicks(1000000));
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
GenerateSchemaAndSerializeFromType(DBNull.Value);
|
||||
#endif
|
||||
GenerateSchemaAndSerializeFromType(new JsonPropertyWithHandlingValues());
|
||||
|
||||
@@ -24,12 +24,16 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Schema;
|
||||
using System.IO;
|
||||
|
||||
@@ -31,12 +31,16 @@ using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Schema;
|
||||
using System.IO;
|
||||
@@ -47,7 +51,6 @@ using Extensions = Newtonsoft.Json.Schema.Extensions;
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Schema
|
||||
@@ -91,7 +94,7 @@ namespace Newtonsoft.Json.Tests.Schema
|
||||
Assert.IsTrue(o.IsValid(schema));
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void Generate_DefaultValueAttributeTestClass()
|
||||
{
|
||||
@@ -310,7 +313,7 @@ namespace Newtonsoft.Json.Tests.Schema
|
||||
Assert.IsTrue(v.IsValid(schema));
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void GenerateSchemaForISerializable()
|
||||
{
|
||||
@@ -325,7 +328,7 @@ namespace Newtonsoft.Json.Tests.Schema
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void GenerateSchemaForDBNull()
|
||||
{
|
||||
@@ -370,7 +373,7 @@ namespace Newtonsoft.Json.Tests.Schema
|
||||
generator.UndefinedSchemaIdHandling = UndefinedSchemaIdHandling.UseTypeName;
|
||||
generator.ContractResolver = new CustomDirectoryInfoMapper
|
||||
{
|
||||
#if !(NETFX_CORE || PORTABLE)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50)
|
||||
IgnoreSerializableAttribute = true
|
||||
#endif
|
||||
};
|
||||
@@ -454,7 +457,7 @@ namespace Newtonsoft.Json.Tests.Schema
|
||||
serializer.Converters.Add(new IsoDateTimeConverter());
|
||||
serializer.ContractResolver = new CustomDirectoryInfoMapper
|
||||
{
|
||||
#if !(NETFX_CORE || PORTABLE)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50)
|
||||
IgnoreSerializableInterface = true
|
||||
#endif
|
||||
};
|
||||
@@ -474,7 +477,7 @@ namespace Newtonsoft.Json.Tests.Schema
|
||||
generator.UndefinedSchemaIdHandling = UndefinedSchemaIdHandling.UseTypeName;
|
||||
generator.ContractResolver = new CamelCasePropertyNamesContractResolver()
|
||||
{
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
IgnoreSerializableAttribute = true
|
||||
#endif
|
||||
};
|
||||
@@ -519,7 +522,7 @@ namespace Newtonsoft.Json.Tests.Schema
|
||||
}", json);
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void GenerateSchemaSerializable()
|
||||
{
|
||||
@@ -773,6 +776,7 @@ namespace Newtonsoft.Json.Tests.Schema
|
||||
public SortTypeFlagAsString y;
|
||||
}
|
||||
|
||||
#if !ASPNETCORE50
|
||||
[Test]
|
||||
[Ignore]
|
||||
public void GenerateSchemaWithStringEnum()
|
||||
@@ -799,6 +803,7 @@ namespace Newtonsoft.Json.Tests.Schema
|
||||
}
|
||||
}", json);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public class NullableInt32TestClass
|
||||
|
||||
@@ -24,13 +24,16 @@
|
||||
#endregion
|
||||
|
||||
using Newtonsoft.Json.Schema;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Schema
|
||||
|
||||
@@ -24,13 +24,16 @@
|
||||
#endregion
|
||||
|
||||
using Newtonsoft.Json.Schema;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Schema
|
||||
|
||||
@@ -1,4 +1,30 @@
|
||||
using System;
|
||||
#region License
|
||||
// Copyright (c) 2007 James Newton-King
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the "Software"), to deal in the Software without
|
||||
// restriction, including without limitation the rights to use,
|
||||
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following
|
||||
// conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(ASPNETCORE50 || NETFX_CORE)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -92,4 +118,5 @@ namespace Newtonsoft.Json.Tests.Schema
|
||||
return specTests;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -28,13 +28,16 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Schema;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Schema
|
||||
|
||||
+8
-4
@@ -26,12 +26,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
using Newtonsoft.Json.Linq;
|
||||
@@ -101,7 +105,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
string json = o.ToString();
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
#pragma warning disable 618
|
||||
[Test]
|
||||
public void MemberSearchFlags()
|
||||
|
||||
@@ -26,13 +26,16 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
@@ -27,12 +27,16 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
#if NET20
|
||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
@@ -547,7 +551,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
}", startingWithB);
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
#pragma warning disable 618
|
||||
[Test]
|
||||
public void SerializeCompilerGeneratedMembers()
|
||||
|
||||
@@ -32,12 +32,16 @@ using System.Runtime.Serialization.Json;
|
||||
#endif
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Utilities;
|
||||
|
||||
|
||||
@@ -23,17 +23,27 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || ASPNETCORE50)
|
||||
using Autofac;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !(NET35 || NET20)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.FSharp.Collections;
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Serialization
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50)
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
@@ -30,12 +31,16 @@ using Newtonsoft.Json.Tests.TestObjects;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Serialization
|
||||
@@ -280,4 +285,5 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
propertyBuilder.SetSetMethod(backingSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -37,13 +37,16 @@ using System.Text;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
@@ -23,21 +23,24 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
using Newtonsoft.Json.Serialization;
|
||||
#if !(NET35 || NET20 || NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Converters;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
@@ -28,12 +28,16 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
@@ -23,14 +23,14 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || NETFX_CORE)
|
||||
#if !(NET35 || NET20 || NETFX_CORE || ASPNETCORE50)
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.FSharp.Collections;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Serialization
|
||||
{
|
||||
|
||||
@@ -30,12 +30,16 @@ using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
@@ -61,6 +65,9 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
""II"",
|
||||
""3""
|
||||
]", json);
|
||||
|
||||
Console.WriteLine("Serialized immutable list:");
|
||||
Console.WriteLine(json);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -99,6 +106,10 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Assert.AreEqual("Volibear", champions[0]);
|
||||
Assert.AreEqual("Teemo", champions[1]);
|
||||
Assert.AreEqual("Katarina", champions[2]);
|
||||
|
||||
Console.WriteLine("Deserialized immutable list:");
|
||||
Console.WriteLine(string.Join(", ", champions));
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -23,12 +23,16 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
#if !(NET35 || NET20 || PORTABLE || PORTABLE40)
|
||||
#if !(NET35 || NET20 || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
@@ -40,12 +40,16 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Serialization
|
||||
@@ -541,7 +545,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Assert.AreEqual(3, v2["Third"]);
|
||||
}
|
||||
|
||||
#if !(NET35 || NET20 || PORTABLE || PORTABLE40)
|
||||
#if !(NET35 || NET20 || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void DeserializeConcurrentDictionary()
|
||||
{
|
||||
@@ -1255,7 +1259,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Assert.AreEqual(1, (int)((JObject)o.Data[2])["one"]);
|
||||
}
|
||||
|
||||
#if !NETFX_CORE
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
[Test]
|
||||
public void SerializeArrayAsArrayList()
|
||||
{
|
||||
|
||||
@@ -29,10 +29,10 @@ using System.ComponentModel;
|
||||
using System.Collections.Concurrent;
|
||||
#endif
|
||||
using System.Collections.Generic;
|
||||
#if !(NET20 || NET35 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50)
|
||||
using System.Numerics;
|
||||
#endif
|
||||
#if !NET20 && !NETFX_CORE
|
||||
#if !(NET20 || NETFX_CORE || ASPNETCORE50)
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Configuration;
|
||||
using System.Runtime.CompilerServices;
|
||||
@@ -42,12 +42,16 @@ using System.Web.Script.Serialization;
|
||||
#endif
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json;
|
||||
using System.IO;
|
||||
@@ -81,7 +85,7 @@ using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
#endif
|
||||
#if !(NETFX_CORE)
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
using System.Drawing;
|
||||
using System.Diagnostics;
|
||||
#endif
|
||||
@@ -109,7 +113,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
public int ChildId;
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE)
|
||||
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE || ASPNETCORE50)
|
||||
[Test]
|
||||
public void ReadIntegerWithError()
|
||||
{
|
||||
@@ -365,7 +369,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
serializer.ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor;
|
||||
Assert.AreEqual(ConstructorHandling.AllowNonPublicDefaultConstructor, serializer.ConstructorHandling);
|
||||
|
||||
#if !NETFX_CORE
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
serializer.Context = new StreamingContext(StreamingContextStates.Other);
|
||||
Assert.AreEqual(new StreamingContext(StreamingContextStates.Other), serializer.Context);
|
||||
#endif
|
||||
@@ -433,7 +437,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
serializer.TraceWriter = traceWriter;
|
||||
Assert.AreEqual(traceWriter, serializer.TraceWriter);
|
||||
|
||||
#if !(PORTABLE || PORTABLE40 || NETFX_CORE || NET20)
|
||||
#if !(PORTABLE || PORTABLE40 || NETFX_CORE || NET20 || ASPNETCORE50)
|
||||
serializer.TypeNameAssemblyFormat = FormatterAssemblyStyle.Full;
|
||||
Assert.AreEqual(FormatterAssemblyStyle.Full, serializer.TypeNameAssemblyFormat);
|
||||
#endif
|
||||
@@ -457,7 +461,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
settings.ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor;
|
||||
Assert.AreEqual(ConstructorHandling.AllowNonPublicDefaultConstructor, settings.ConstructorHandling);
|
||||
|
||||
#if !NETFX_CORE
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
settings.Context = new StreamingContext(StreamingContextStates.Other);
|
||||
Assert.AreEqual(new StreamingContext(StreamingContextStates.Other), settings.Context);
|
||||
#endif
|
||||
@@ -525,7 +529,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
settings.TraceWriter = traceWriter;
|
||||
Assert.AreEqual(traceWriter, settings.TraceWriter);
|
||||
|
||||
#if !(PORTABLE || PORTABLE40 || NETFX_CORE || NET20)
|
||||
#if !(PORTABLE || PORTABLE40 || NETFX_CORE || NET20 || ASPNETCORE50)
|
||||
settings.TypeNameAssemblyFormat = FormatterAssemblyStyle.Full;
|
||||
Assert.AreEqual(FormatterAssemblyStyle.Full, settings.TypeNameAssemblyFormat);
|
||||
#endif
|
||||
@@ -549,7 +553,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
serializerProxy.ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor;
|
||||
Assert.AreEqual(ConstructorHandling.AllowNonPublicDefaultConstructor, serializerProxy.ConstructorHandling);
|
||||
|
||||
#if !NETFX_CORE
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
serializerProxy.Context = new StreamingContext(StreamingContextStates.Other);
|
||||
Assert.AreEqual(new StreamingContext(StreamingContextStates.Other), serializerProxy.Context);
|
||||
#endif
|
||||
@@ -617,7 +621,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
serializerProxy.TraceWriter = traceWriter;
|
||||
Assert.AreEqual(traceWriter, serializerProxy.TraceWriter);
|
||||
|
||||
#if !(PORTABLE || PORTABLE40 || NETFX_CORE || NET20)
|
||||
#if !(PORTABLE || PORTABLE40 || NETFX_CORE || NET20 || ASPNETCORE50)
|
||||
serializerProxy.TypeNameAssemblyFormat = FormatterAssemblyStyle.Full;
|
||||
Assert.AreEqual(FormatterAssemblyStyle.Full, serializerProxy.TypeNameAssemblyFormat);
|
||||
#endif
|
||||
@@ -626,7 +630,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Assert.AreEqual(TypeNameHandling.All, serializerProxy.TypeNameHandling);
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40 || ASPNETCORE50)
|
||||
[Test]
|
||||
public void DeserializeISerializableIConvertible()
|
||||
{
|
||||
@@ -768,7 +772,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Assert.AreEqual("value", deserialized.foo.bar);
|
||||
}
|
||||
|
||||
#if !NETFX_CORE
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
[Test]
|
||||
public void ConversionOperator()
|
||||
{
|
||||
@@ -1196,7 +1200,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Assert.AreEqual(executorObject2.clientGetResultFunction, "ClientBanSubsCB");
|
||||
}
|
||||
|
||||
#if !NETFX_CORE
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
[Test]
|
||||
public void HashtableDeserialization()
|
||||
{
|
||||
@@ -1405,7 +1409,7 @@ keyword such as type of business.""
|
||||
{
|
||||
string json = @"[""vvv\/vvv\tvvv\""vvv\bvvv\nvvv\rvvv\\vvv\fvvv""]";
|
||||
|
||||
#if !NETFX_CORE
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer();
|
||||
List<string> javaScriptSerializerResult = javaScriptSerializer.Deserialize<List<string>>(json);
|
||||
#endif
|
||||
@@ -1417,7 +1421,7 @@ keyword such as type of business.""
|
||||
|
||||
Assert.AreEqual(1, jsonNetResult.Count);
|
||||
Assert.AreEqual(dataContractResult[0], jsonNetResult[0]);
|
||||
#if !NETFX_CORE
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
Assert.AreEqual(javaScriptSerializerResult[0], jsonNetResult[0]);
|
||||
#endif
|
||||
}
|
||||
@@ -1636,7 +1640,7 @@ keyword such as type of business.""
|
||||
string json = JsonConvert.SerializeObject(new ConverableMembers(), Formatting.Indented);
|
||||
|
||||
string expected = null;
|
||||
#if !(NETFX_CORE || PORTABLE)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50)
|
||||
expected = @"{
|
||||
""String"": ""string"",
|
||||
""Int32"": 2147483647,
|
||||
@@ -1676,7 +1680,7 @@ keyword such as type of business.""
|
||||
ConverableMembers c = JsonConvert.DeserializeObject<ConverableMembers>(json);
|
||||
Assert.AreEqual("string", c.String);
|
||||
Assert.AreEqual(double.MaxValue, c.Double);
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
Assert.AreEqual(DBNull.Value, c.DBNull);
|
||||
#endif
|
||||
}
|
||||
@@ -2523,7 +2527,7 @@ keyword such as type of business.""
|
||||
Assert.AreEqual("titleId", n.FidOrder[n.FidOrder.Count - 1]);
|
||||
}
|
||||
|
||||
#if !(NET20 || NETFX_CORE)
|
||||
#if !(NET20 || NETFX_CORE || ASPNETCORE50 || PORTABLE40)
|
||||
[MetadataType(typeof(OptInClassMetadata))]
|
||||
public class OptInClass
|
||||
{
|
||||
@@ -2911,7 +2915,7 @@ To fix this error either change the JSON to a JSON object (e.g. {""name"":""valu
|
||||
Path '', line 1, position 1.");
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50)
|
||||
[Test]
|
||||
public void CannotDeserializeArrayIntoSerializable()
|
||||
{
|
||||
@@ -3028,7 +3032,7 @@ Path '', line 1, position 1.");
|
||||
{
|
||||
ContractResolver = new DefaultContractResolver
|
||||
{
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
IgnoreSerializableAttribute = true
|
||||
#endif
|
||||
}
|
||||
@@ -3045,7 +3049,7 @@ Path '', line 1, position 1.");
|
||||
{
|
||||
ContractResolver = new DefaultContractResolver
|
||||
{
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
IgnoreSerializableAttribute = true
|
||||
#endif
|
||||
}
|
||||
@@ -3062,7 +3066,7 @@ Path '', line 1, position 1.");
|
||||
{
|
||||
ContractResolver = new DefaultContractResolver
|
||||
{
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
IgnoreSerializableAttribute = true
|
||||
#endif
|
||||
}
|
||||
@@ -3079,7 +3083,7 @@ Path '', line 1, position 1.");
|
||||
{
|
||||
ContractResolver = new DefaultContractResolver
|
||||
{
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
IgnoreSerializableAttribute = true
|
||||
#endif
|
||||
}
|
||||
@@ -3587,19 +3591,15 @@ Path '', line 1, position 1.");
|
||||
public TimeSpan TimeSpanProperty { get; set; }
|
||||
public Guid GuidProperty { get; set; }
|
||||
public Animal AnimalProperty { get; set; }
|
||||
public Exception ExceptionProperty { get; set; }
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DataContractJsonSerializerTest()
|
||||
{
|
||||
Exception ex = new Exception("Blah blah blah");
|
||||
|
||||
DataContractJsonSerializerTestClass c = new DataContractJsonSerializerTestClass();
|
||||
c.TimeSpanProperty = new TimeSpan(200, 20, 59, 30, 900);
|
||||
c.GuidProperty = new Guid("66143115-BE2A-4a59-AF0A-348E1EA15B1E");
|
||||
c.AnimalProperty = new Human() { Ethnicity = "European" };
|
||||
c.ExceptionProperty = ex;
|
||||
|
||||
MemoryStream ms = new MemoryStream();
|
||||
DataContractJsonSerializer serializer = new DataContractJsonSerializer(
|
||||
@@ -3756,7 +3756,7 @@ Path '', line 1, position 1.");
|
||||
Assert.AreEqual("value", newModelStateDictionary["key"]);
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
public class ISerializableTestObject : ISerializable
|
||||
{
|
||||
internal string _stringValue;
|
||||
@@ -4081,7 +4081,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
}", json);
|
||||
}
|
||||
|
||||
#if !PORTABLE
|
||||
#if !(PORTABLE || ASPNETCORE50)
|
||||
[Test]
|
||||
public void DeserializeClassWithInheritedProtectedMember()
|
||||
{
|
||||
@@ -4282,7 +4282,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void SerializeDeserializeXmlNodeProperties()
|
||||
{
|
||||
@@ -4354,7 +4354,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
|
||||
public override bool CanConvert(Type objectType)
|
||||
{
|
||||
return objectType.IsAssignableFrom(typeof(Pos));
|
||||
return objectType == typeof(Pos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4377,7 +4377,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
|
||||
public override bool CanConvert(Type objectType)
|
||||
{
|
||||
return objectType.IsAssignableFrom(typeof(PosDouble));
|
||||
return objectType == typeof(PosDouble);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4604,7 +4604,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
Assert.AreEqual(0, z[1].Prop1.Length);
|
||||
}
|
||||
|
||||
#if !NET20 && !NETFX_CORE
|
||||
#if !(NET20 || NETFX_CORE || ASPNETCORE50)
|
||||
public class StringDictionaryTestClass
|
||||
{
|
||||
public StringDictionary StringDictionaryProperty { get; set; }
|
||||
@@ -4918,7 +4918,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
Assert.AreEqual(meh.IDontWork, "meh");
|
||||
}
|
||||
|
||||
#if !(NET20 || NETFX_CORE)
|
||||
#if !(NET20 || NETFX_CORE || ASPNETCORE50)
|
||||
[DataContract]
|
||||
public struct StructISerializable : ISerializable
|
||||
{
|
||||
@@ -5660,7 +5660,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
}
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void SerializeException1()
|
||||
{
|
||||
@@ -5887,7 +5887,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
Assert.AreEqual(-3, StaticTestClass.z);
|
||||
}
|
||||
|
||||
#if !(NET20 || NETFX_CORE)
|
||||
#if !(NET20 || NETFX_CORE || ASPNETCORE50)
|
||||
[Test]
|
||||
public void DeserializeDecimalsWithCulture()
|
||||
{
|
||||
@@ -5984,7 +5984,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
ExceptionAssert.Throws<JsonSerializationException>(() => { List<int> numbers = JsonConvert.DeserializeObject<List<int>>(json); }, "Error converting value {null} to type 'System.Int32'. Path '[3]', line 5, position 7.");
|
||||
}
|
||||
|
||||
#if !(PORTABLE || NETFX_CORE)
|
||||
#if !(PORTABLE || ASPNETCORE50 || NETFX_CORE)
|
||||
public class ConvertableIntTestClass
|
||||
{
|
||||
public ConvertibleInt Integer { get; set; }
|
||||
@@ -6341,7 +6341,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(NETFX_CORE)
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
[Test]
|
||||
public void MetroBlogPost()
|
||||
{
|
||||
@@ -6702,7 +6702,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
Assert.AreEqual("", s);
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void SerializeAndDeserializeWithAttributes()
|
||||
{
|
||||
@@ -6863,7 +6863,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
ExceptionAssert.Throws<JsonReaderException>(() => { s.Deserialize<Dictionary<string, int>>(new JsonTextReader(new StringReader(json))); }, "Additional text encountered after finished reading JSON content: {. Path '', line 1, position 7.");
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void DeserializeException()
|
||||
{
|
||||
@@ -7047,7 +7047,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || NET40 || PORTABLE40)
|
||||
#if !PORTABLE
|
||||
#if !(PORTABLE || ASPNETCORE50)
|
||||
[Test]
|
||||
public void DeserializeReadOnlyListWithBigInteger()
|
||||
{
|
||||
@@ -7105,7 +7105,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
|
||||
Action doStuff = () => { obj = JsonConvert.DeserializeObject<MyTuple<int>>(json); };
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
doStuff();
|
||||
Assert.AreEqual(500, obj.Item1);
|
||||
#else
|
||||
@@ -7115,7 +7115,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
#endif
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
#if DEBUG && !NOINTERNALS
|
||||
[Test]
|
||||
public void SerializeCustomTupleWithSerializableAttributeInPartialTrust()
|
||||
{
|
||||
@@ -7136,7 +7136,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || NET35 || NET20 || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || NET35 || NET20 || PORTABLE40)
|
||||
[Test]
|
||||
public void SerializeTupleWithSerializableAttribute()
|
||||
{
|
||||
@@ -7382,7 +7382,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(PORTABLE || NET35 || NET20 || PORTABLE40)
|
||||
#if !(PORTABLE || ASPNETCORE50 || NET35 || NET20 || PORTABLE40)
|
||||
[Test]
|
||||
public void ReadTooLargeInteger()
|
||||
{
|
||||
@@ -7396,7 +7396,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !NETFX_CORE
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
[Serializable]
|
||||
#endif
|
||||
[DataContract]
|
||||
@@ -7425,7 +7425,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
|
||||
Assert.AreEqual(@"{""First"":""One"",""Second"":2}", json);
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
DefaultContractResolver r = new DefaultContractResolver();
|
||||
r.IgnoreSerializableAttribute = false;
|
||||
|
||||
@@ -7545,7 +7545,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
Assert.AreEqual(1234567890.123456m, d);
|
||||
}
|
||||
|
||||
#if !(PORTABLE || NETFX_CORE || PORTABLE40)
|
||||
#if !(PORTABLE || ASPNETCORE50 || NETFX_CORE || PORTABLE40)
|
||||
[Test]
|
||||
public void DontSerializeStaticFields()
|
||||
{
|
||||
@@ -7569,7 +7569,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void SerializeBigInteger()
|
||||
{
|
||||
@@ -7654,7 +7654,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
]", json);
|
||||
}
|
||||
|
||||
#if !(PORTABLE || PORTABLE40 || NETFX_CORE)
|
||||
#if !(PORTABLE || PORTABLE40 || NETFX_CORE || ASPNETCORE50)
|
||||
[Test]
|
||||
public void SerializeDictionaryWithStructKey()
|
||||
{
|
||||
@@ -7707,7 +7707,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
Assert.AreEqual(jane, john.Spouse);
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || NET35 || NET20 || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || NET35 || NET20 || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void TypeConverterOnInterface()
|
||||
{
|
||||
@@ -7772,7 +7772,7 @@ To fix this error either change the environment to be fully trusted, change the
|
||||
ParticipantEntity deserializedProduct = JsonConvert.DeserializeObject<ParticipantEntity>(json);
|
||||
}
|
||||
|
||||
#if !(PORTABLE || NETFX_CORE)
|
||||
#if !(PORTABLE || ASPNETCORE50 || NETFX_CORE)
|
||||
public class ConvertibleId : IConvertible
|
||||
{
|
||||
public int Value;
|
||||
|
||||
@@ -30,12 +30,16 @@ using System.Text;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Serialization
|
||||
@@ -328,7 +332,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Assert.IsTrue(JToken.DeepEquals(t1, t2));
|
||||
}
|
||||
|
||||
#if !(PORTABLE || PORTABLE40)
|
||||
#if !(PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void DeserializeGenericObjectListWithTypeName()
|
||||
{
|
||||
|
||||
@@ -27,13 +27,16 @@ using System;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
@@ -26,13 +26,16 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
@@ -27,13 +27,16 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
@@ -30,13 +30,16 @@ using System.Runtime.Serialization.Formatters;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Serialization
|
||||
@@ -88,7 +91,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
Assert.AreEqual(2, circularDictionary.Count);
|
||||
Assert.AreEqual(1, circularDictionary["other"].Count);
|
||||
Assert.AreEqual(circularDictionary, circularDictionary["self"]);
|
||||
Assert.IsTrue(ReferenceEquals(circularDictionary, circularDictionary["self"]));
|
||||
}
|
||||
|
||||
public class CircularList : List<CircularList>
|
||||
|
||||
@@ -25,12 +25,16 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
#if !(NET20 || NET35)
|
||||
using System.Dynamic;
|
||||
@@ -149,7 +153,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
}", json);
|
||||
}
|
||||
|
||||
#if !(PORTABLE || NETFX_CORE || PORTABLE40)
|
||||
#if !(PORTABLE || ASPNETCORE50 || NETFX_CORE || PORTABLE40)
|
||||
public class MainClass : ISerializable
|
||||
{
|
||||
public ChildClass Child { get; set; }
|
||||
|
||||
@@ -35,12 +35,16 @@ using Newtonsoft.Json.Utilities.LinqBridge;
|
||||
#else
|
||||
using System.Linq;
|
||||
#endif
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using System.IO;
|
||||
using ErrorEventArgs = Newtonsoft.Json.Serialization.ErrorEventArgs;
|
||||
|
||||
@@ -37,12 +37,16 @@ using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
@@ -282,7 +286,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
}", json);
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50)
|
||||
public class SerializationEventContextTestObject
|
||||
{
|
||||
public string TestMember { get; set; }
|
||||
@@ -313,7 +317,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !PORTABLE
|
||||
#if !(PORTABLE || ASPNETCORE50)
|
||||
public void WhenSerializationErrorDetectedBySerializer_ThenCallbackIsCalled()
|
||||
{
|
||||
// Verify contract is properly finding our callback
|
||||
|
||||
@@ -29,12 +29,16 @@ using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
@@ -4,18 +4,22 @@ using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
using System.Numerics;
|
||||
#endif
|
||||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Serialization.Formatters;
|
||||
using System.Text;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
@@ -39,7 +43,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
[TestFixture]
|
||||
public class TraceWriterTests : TestFixtureBase
|
||||
{
|
||||
#if !(PORTABLE || NETFX_CORE || PORTABLE40)
|
||||
#if !(PORTABLE || ASPNETCORE50 || NETFX_CORE || PORTABLE40)
|
||||
[Test]
|
||||
public void DiagnosticsTraceWriterTest()
|
||||
{
|
||||
@@ -602,7 +606,7 @@ Newtonsoft.Json Error: 0 : Error!
|
||||
Assert.IsTrue(traceWriter.TraceRecords[9].Message.StartsWith("Finished deserializing System.Collections.Generic.List`1[System.Object]. Path '$values'"));
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void DeserializeISerializable()
|
||||
{
|
||||
@@ -808,7 +812,7 @@ Newtonsoft.Json Error: 0 : Error!
|
||||
Assert.AreEqual(23, deserialized.FavoriteNumber);
|
||||
}
|
||||
|
||||
#if !(NET20 || NET35 || PORTABLE || PORTABLE40)
|
||||
#if !(NET20 || NET35 || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void TraceJsonWriterTest()
|
||||
{
|
||||
|
||||
@@ -23,31 +23,35 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(PORTABLE || PORTABLE40)
|
||||
#if !(NET35 || NET20 || PORTABLE)
|
||||
#if !(PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
#if !(NET35 || NET20 || PORTABLE || ASPNETCORE50)
|
||||
using System.Dynamic;
|
||||
#endif
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Tests.Linq;
|
||||
using global::System;
|
||||
using global::System.Collections;
|
||||
using global::System.Collections.Generic;
|
||||
using global::System.Globalization;
|
||||
using global::System.Runtime.Serialization.Formatters;
|
||||
using global::Newtonsoft.Json.Linq;
|
||||
using global::Newtonsoft.Json.Serialization;
|
||||
using global::Newtonsoft.Json.Tests.TestObjects;
|
||||
#if !NETFX_CORE
|
||||
using global::NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Runtime.Serialization.Formatters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json.Tests.TestObjects;
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using global::Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = global::Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = global::Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using global::Newtonsoft.Json.Utilities;
|
||||
using global::System.Net;
|
||||
using global::System.Runtime.Serialization;
|
||||
using global::System.IO;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
using System.Net;
|
||||
using System.Runtime.Serialization;
|
||||
using System.IO;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Serialization
|
||||
{
|
||||
@@ -259,7 +263,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Assert.AreEqual("Name!", ((EmployeeReference)employee).Name);
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50)
|
||||
[Test]
|
||||
public void DeserializeTypeNameFromGacAssembly()
|
||||
{
|
||||
@@ -1097,7 +1101,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Binder = new MetroBinder(),
|
||||
ContractResolver = new DefaultContractResolver
|
||||
{
|
||||
#if !(NETFX_CORE || PORTABLE)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50)
|
||||
IgnoreSerializableAttribute = true
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -30,12 +30,16 @@ using System.IO;
|
||||
using System.Linq;
|
||||
#endif
|
||||
using System.Text;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Test = Xunit.FactAttribute;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
#if !(NETFX_CORE || NET20)
|
||||
using System.Runtime.Serialization.Json;
|
||||
@@ -59,7 +63,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
nonSerializedField = "Error"
|
||||
};
|
||||
|
||||
#if !(NETFX_CORE || NET20 || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || NET20 || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
MemoryStream ms = new MemoryStream();
|
||||
DataContractJsonSerializer dataContractJsonSerializer = new DataContractJsonSerializer(typeof(SerializableType));
|
||||
dataContractJsonSerializer.WriteObject(ms, serializableType);
|
||||
@@ -75,7 +79,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
{
|
||||
ContractResolver = new DefaultContractResolver
|
||||
{
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
IgnoreSerializableAttribute = false
|
||||
#endif
|
||||
}
|
||||
@@ -84,7 +88,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Assert.AreEqual(expected, json);
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Test]
|
||||
public void SerializeInheritedType()
|
||||
{
|
||||
@@ -114,7 +118,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
}
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[Serializable]
|
||||
#else
|
||||
[JsonObject(MemberSerialization.Fields)]
|
||||
@@ -138,7 +142,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
set { privateField = value; }
|
||||
}
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[NonSerialized]
|
||||
#else
|
||||
[JsonIgnore]
|
||||
|
||||
@@ -27,6 +27,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
#if NET20
|
||||
using Newtonsoft.Json.Serialization;
|
||||
@@ -35,13 +36,17 @@ using System.Runtime.Serialization.Json;
|
||||
#endif
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
#if !NETFX_CORE
|
||||
using NUnit.Framework;
|
||||
#else
|
||||
#if NETFX_CORE
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||
using TestMethod = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||
using SetUp = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestInitializeAttribute;
|
||||
#elif ASPNETCORE50
|
||||
using Xunit;
|
||||
using Assert = Newtonsoft.Json.Tests.XUnitAssert;
|
||||
using XAssert = Xunit.Assert;
|
||||
#else
|
||||
using NUnit.Framework;
|
||||
#endif
|
||||
using Newtonsoft.Json.Utilities;
|
||||
using System.Collections;
|
||||
@@ -53,6 +58,137 @@ using System.Linq;
|
||||
|
||||
namespace Newtonsoft.Json.Tests
|
||||
{
|
||||
public class TestReflectionUtils
|
||||
{
|
||||
public static IEnumerable<ConstructorInfo> GetConstructors(Type type)
|
||||
{
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
return type.GetConstructors();
|
||||
#else
|
||||
return type.GetTypeInfo().DeclaredConstructors;
|
||||
#endif
|
||||
}
|
||||
|
||||
public static PropertyInfo GetProperty(Type type, string name)
|
||||
{
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
return type.GetProperty(name);
|
||||
#else
|
||||
return type.GetTypeInfo().GetDeclaredProperty(name);
|
||||
#endif
|
||||
}
|
||||
|
||||
public static FieldInfo GetField(Type type, string name)
|
||||
{
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
return type.GetField(name);
|
||||
#else
|
||||
return type.GetTypeInfo().GetDeclaredField(name);
|
||||
#endif
|
||||
}
|
||||
|
||||
public static MethodInfo GetMethod(Type type, string name)
|
||||
{
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
return type.GetMethod(name);
|
||||
#else
|
||||
return type.GetTypeInfo().GetDeclaredMethod(name);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if ASPNETCORE50
|
||||
public class TestFixtureAttribute : Attribute
|
||||
{
|
||||
// xunit doesn't need a test fixture attribute
|
||||
// this exists so the project compiles
|
||||
}
|
||||
|
||||
public class XUnitAssert
|
||||
{
|
||||
public static void IsInstanceOf(Type expectedType, object o)
|
||||
{
|
||||
XAssert.IsType(expectedType, o);
|
||||
}
|
||||
|
||||
public static void AreEqual(double expected, double actual, double r)
|
||||
{
|
||||
XAssert.Equal(expected, actual, 5); // hack
|
||||
}
|
||||
|
||||
public static void AreEqual(object expected, object actual, string message = null)
|
||||
{
|
||||
XAssert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
public static void AreEqual<T>(T expected, T actual, string message = null)
|
||||
{
|
||||
XAssert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
public static void AreNotEqual(object expected, object actual, string message = null)
|
||||
{
|
||||
XAssert.NotEqual(expected, actual);
|
||||
}
|
||||
|
||||
public static void AreNotEqual<T>(T expected, T actual, string message = null)
|
||||
{
|
||||
XAssert.NotEqual(expected, actual);
|
||||
}
|
||||
|
||||
public static void Fail(string message = null, params object[] args)
|
||||
{
|
||||
if (message != null)
|
||||
message = message.FormatWith(CultureInfo.InvariantCulture, args);
|
||||
|
||||
XAssert.True(false, message);
|
||||
}
|
||||
|
||||
public static void IsTrue(bool condition, string message = null)
|
||||
{
|
||||
XAssert.True(condition);
|
||||
}
|
||||
|
||||
public static void IsFalse(bool condition)
|
||||
{
|
||||
XAssert.False(condition);
|
||||
}
|
||||
|
||||
public static void IsNull(object o)
|
||||
{
|
||||
XAssert.Null(o);
|
||||
}
|
||||
|
||||
public static void IsNotNull(object o)
|
||||
{
|
||||
XAssert.NotNull(o);
|
||||
}
|
||||
|
||||
public static void AreNotSame(object expected, object actual)
|
||||
{
|
||||
XAssert.NotSame(expected, actual);
|
||||
}
|
||||
|
||||
public static void AreSame(object expected, object actual)
|
||||
{
|
||||
XAssert.Same(expected, actual);
|
||||
}
|
||||
}
|
||||
|
||||
public class CollectionAssert
|
||||
{
|
||||
public static void AreEquivalent<T>(IEnumerable<T> expected, IEnumerable<T> actual)
|
||||
{
|
||||
XAssert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
public static void AreEqual<T>(IEnumerable<T> expected, IEnumerable<T> actual)
|
||||
{
|
||||
XAssert.Equal(expected, actual);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
[TestFixture]
|
||||
public abstract class TestFixtureBase
|
||||
{
|
||||
@@ -118,8 +254,12 @@ namespace Newtonsoft.Json.Tests
|
||||
return bytes;
|
||||
}
|
||||
|
||||
#if ASPNETCORE50
|
||||
protected TestFixtureBase()
|
||||
#else
|
||||
[SetUp]
|
||||
protected void TestSetup()
|
||||
#endif
|
||||
{
|
||||
//#if !NETFX_CORE
|
||||
// CultureInfo turkey = CultureInfo.CreateSpecificCulture("tr");
|
||||
@@ -169,7 +309,7 @@ namespace Newtonsoft.Json.Tests
|
||||
|
||||
public static void Contains(IList collection, object value, string message)
|
||||
{
|
||||
#if !NETFX_CORE
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
Assert.Contains(value, collection, message);
|
||||
#else
|
||||
if (!collection.Cast<object>().Any(i => i.Equals(value)))
|
||||
|
||||
@@ -33,7 +33,7 @@ using System.Linq;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !(NETFX_CORE || PORTABLE)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50)
|
||||
[Serializable]
|
||||
public class AnswerFilterModel
|
||||
{
|
||||
|
||||
@@ -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 !(NETFX_CORE || PORTABLE)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50)
|
||||
public DBNull DBNull = DBNull.Value;
|
||||
#endif
|
||||
public bool Bool = true;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || NETFX_CORE)
|
||||
#if !(NET35 || NET20 || NETFX_CORE || ASPNETCORE50)
|
||||
using Microsoft.FSharp.Core;
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
|
||||
#if !(NETFX_CORE || PORTABLE40 || PORTABLE || ASPNETCORE50)
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
@@ -27,7 +27,7 @@ using System.ComponentModel;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !NETFX_CORE
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
[Description("DefaultValueAttributeTestClass description!")]
|
||||
#endif
|
||||
public sealed class DefaultValueAttributeTestClass
|
||||
|
||||
@@ -36,7 +36,7 @@ using System.Linq;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !(NETFX_CORE || NET35 || NET20 || PORTABLE || PORTABLE40)
|
||||
#if !(NETFX_CORE || NET35 || NET20 || PORTABLE || ASPNETCORE50 || PORTABLE40)
|
||||
[TypeConverter(typeof(MyInterfaceConverter))]
|
||||
internal interface IMyInterface
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
protected internal override string ResolvePropertyName(string propertyName)
|
||||
{
|
||||
#if !(NETFX_CORE)
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
return ":::" + propertyName.ToUpper(CultureInfo.InvariantCulture) + ":::";
|
||||
#else
|
||||
return ":::" + propertyName.ToUpper() + ":::";
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||
{
|
||||
#if !(NETFX_CORE)
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
writer.WriteValue(":::" + value.ToString().ToUpper(CultureInfo.InvariantCulture) + ":::");
|
||||
#else
|
||||
writer.WriteValue(":::" + value.ToString().ToUpper() + ":::");
|
||||
@@ -45,7 +45,7 @@ namespace Newtonsoft.Json.Tests.TestObjects
|
||||
if (s == null)
|
||||
return null;
|
||||
|
||||
#if !(NETFX_CORE)
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
return s.ToLower(CultureInfo.InvariantCulture).Trim(new[] { ':' });
|
||||
#else
|
||||
return s.ToLower().Trim(new[] { ':' });
|
||||
|
||||
@@ -31,7 +31,7 @@ using System.ComponentModel;
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
[JsonObject(Id = "Person", Title = "Title!", Description = "JsonObjectAttribute description!", MemberSerialization = MemberSerialization.OptIn)]
|
||||
#if !NETFX_CORE
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
[Description("DescriptionAttribute description!")]
|
||||
#endif
|
||||
public class Person
|
||||
|
||||
@@ -27,7 +27,7 @@ using System;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !(NETFX_CORE || PORTABLE)
|
||||
#if !(NETFX_CORE || PORTABLE || ASPNETCORE50)
|
||||
[Serializable]
|
||||
public class PersonSerializable
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ using System.Runtime.Serialization;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !NETFX_CORE
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
public struct Ratio : IConvertible, IFormattable, ISerializable
|
||||
{
|
||||
private readonly int _numerator;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
#endregion
|
||||
|
||||
#if !(NET35 || NET20 || NETFX_CORE)
|
||||
#if !(NET35 || NET20 || NETFX_CORE || ASPNETCORE50)
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -27,7 +27,7 @@ using System.Collections;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.TestObjects
|
||||
{
|
||||
#if !NETFX_CORE
|
||||
#if !(NETFX_CORE || ASPNETCORE50)
|
||||
public class TypedSubHashtable
|
||||
{
|
||||
public string Name;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user