-Fixed MetadataTypeAttribute reflection bug by using CustomAttributeData

-Fixed immutable collections bug by getting type from known assembly
-Added support from running tests on aspnetcore50
This commit is contained in:
James Newton-King
2014-10-18 00:00:26 +13:00
parent 4d09aca2c1
commit 88eeb8ba92
111 changed files with 1193 additions and 573 deletions
+20 -16
View File
@@ -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