Update to net50 and fix warnings (#2424)
This commit is contained in:
@@ -113,7 +113,9 @@ namespace Newtonsoft.Json.Tests
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
var binaryFormatter = new BinaryFormatter();
|
||||
#pragma warning disable SYSLIB0011 // Type or member is obsolete
|
||||
binaryFormatter.Serialize(memoryStream, exception);
|
||||
#pragma warning restore SYSLIB0011 // Type or member is obsolete
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -200,7 +200,7 @@ namespace Newtonsoft.Json.Tests.JsonTextReaderTests
|
||||
Assert.AreEqual(Double.MinValue, reader.Value);
|
||||
|
||||
reader = new JsonTextReader(new StringReader("1E+309"));
|
||||
#if !NETSTANDARD2_0
|
||||
#if !(NETSTANDARD2_0 || NETSTANDARD1_3)
|
||||
await ExceptionAssert.ThrowsAsync<JsonReaderException>(async () => await reader.ReadAsync(), "Input string '1E+309' is not a valid number. Path '', line 1, position 6.");
|
||||
#else
|
||||
Assert.IsTrue(await reader.ReadAsync());
|
||||
@@ -209,7 +209,7 @@ namespace Newtonsoft.Json.Tests.JsonTextReaderTests
|
||||
#endif
|
||||
|
||||
reader = new JsonTextReader(new StringReader("-1E+5000"));
|
||||
#if !NETSTANDARD2_0
|
||||
#if !(NETSTANDARD2_0 || NETSTANDARD1_3)
|
||||
await ExceptionAssert.ThrowsAsync<JsonReaderException>(async () => await reader.ReadAsync(), "Input string '-1E+5000' is not a valid number. Path '', line 1, position 8.");
|
||||
#else
|
||||
Assert.IsTrue(await reader.ReadAsync());
|
||||
|
||||
@@ -220,7 +220,7 @@ namespace Newtonsoft.Json.Tests.JsonTextReaderTests
|
||||
Assert.AreEqual(Double.MinValue, reader.Value);
|
||||
|
||||
reader = new JsonTextReader(new StringReader("1E+309"));
|
||||
#if !NETSTANDARD2_0
|
||||
#if !(NETSTANDARD2_0 || NETSTANDARD1_3)
|
||||
ExceptionAssert.Throws<JsonReaderException>(() => reader.Read(), "Input string '1E+309' is not a valid number. Path '', line 1, position 6.");
|
||||
#else
|
||||
Assert.IsTrue(reader.Read());
|
||||
@@ -229,7 +229,7 @@ namespace Newtonsoft.Json.Tests.JsonTextReaderTests
|
||||
#endif
|
||||
|
||||
reader = new JsonTextReader(new StringReader("-1E+5000"));
|
||||
#if !NETSTANDARD2_0
|
||||
#if !(NETSTANDARD2_0 || NETSTANDARD1_3)
|
||||
ExceptionAssert.Throws<JsonReaderException>(() => reader.Read(), "Input string '-1E+5000' is not a valid number. Path '', line 1, position 8.");
|
||||
#else
|
||||
Assert.IsTrue(reader.Read());
|
||||
|
||||
@@ -1018,7 +1018,7 @@ namespace Newtonsoft.Json.Tests
|
||||
await jsonWriter.WriteEndArrayAsync();
|
||||
}
|
||||
|
||||
#if !NETSTANDARD2_0
|
||||
#if !(NETSTANDARD2_0 || NETSTANDARD1_3)
|
||||
Assert.AreEqual(@"[0.0,0.0,0.1,1.0,1.000001,1E-06,4.94065645841247E-324,Infinity,-Infinity,NaN,1.7976931348623157E+308,-1.7976931348623157E+308,Infinity,-Infinity,NaN]", sb.ToString());
|
||||
#else
|
||||
Assert.AreEqual(@"[0.0,0.0,0.1,1.0,1.000001,1E-06,5E-324,Infinity,-Infinity,NaN,1.7976931348623157E+308,-1.7976931348623157E+308,Infinity,-Infinity,NaN]", sb.ToString());
|
||||
|
||||
@@ -880,7 +880,7 @@ namespace Newtonsoft.Json.Tests
|
||||
jsonWriter.WriteEndArray();
|
||||
}
|
||||
|
||||
#if !NETSTANDARD2_0
|
||||
#if !(NETSTANDARD2_0 || NETSTANDARD1_3)
|
||||
Assert.AreEqual(@"[0.0,0.0,0.1,1.0,1.000001,1E-06,4.94065645841247E-324,Infinity,-Infinity,NaN,1.7976931348623157E+308,-1.7976931348623157E+308,Infinity,-Infinity,NaN]", sb.ToString());
|
||||
#else
|
||||
Assert.AreEqual(@"[0.0,0.0,0.1,1.0,1.000001,1E-06,5E-324,Infinity,-Infinity,NaN,1.7976931348623157E+308,-1.7976931348623157E+308,Infinity,-Infinity,NaN]", sb.ToString());
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks Condition="'$(TestFrameworks)'==''">net46;net40;net35;net20;netcoreapp3.0;netcoreapp2.2;netcoreapp2.1</TargetFrameworks>
|
||||
<TargetFrameworks Condition="'$(TestFrameworks)'==''">net46;net40;net35;net20;net5.0;netcoreapp3.1;netcoreapp2.1</TargetFrameworks>
|
||||
<TargetFrameworks Condition="'$(TestFrameworks)'!=''">$(TestFrameworks)</TargetFrameworks>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<VersionPrefix>1.0</VersionPrefix>
|
||||
@@ -13,7 +13,7 @@
|
||||
<RootNamespace>Newtonsoft.Json.Tests</RootNamespace>
|
||||
<IsPackable>false</IsPackable>
|
||||
<!-- Workaround for https://github.com/nunit/nunit3-vs-adapter/issues/296 -->
|
||||
<DebugType Condition="'$(TargetFramework)' != '' AND '$(TargetFramework)' != 'netcoreapp2.1' AND '$(TargetFramework)' != 'netcoreapp2.2' AND '$(TargetFramework)' != 'netcoreapp3.0'">Full</DebugType>
|
||||
<DebugType Condition="'$(TargetFramework)' != '' AND '$(TargetFramework)' != 'netcoreapp2.1' AND '$(TargetFramework)' != 'netcoreapp3.1' AND '$(TargetFramework)' != 'net5.0'">Full</DebugType>
|
||||
<!-- Disabled because SourceLink isn't referenced to calculate paths -->
|
||||
<DeterministicSourcePaths>false</DeterministicSourcePaths>
|
||||
</PropertyGroup>
|
||||
@@ -107,7 +107,7 @@
|
||||
<DefineConstants>NET20;$(AdditionalConstants)</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp3.0'">
|
||||
<ItemGroup Condition="'$(TargetFramework)'=='net5.0'">
|
||||
<PackageReference Include="BenchmarkDotNet" Version="$(BenchmarkDotNetPackageVersion)" />
|
||||
<PackageReference Include="FSharp.Core" Version="$(FSharpCorePackageVersion)" />
|
||||
<PackageReference Include="System.ObjectModel" Version="$(SystemObjectModelPackageVersion)" />
|
||||
@@ -122,13 +122,13 @@
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitRunnerVisualStudioPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='netcoreapp3.0'">
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='net5.0'">
|
||||
<AssemblyTitle>Json.NET Tests .NET Standard 2.0</AssemblyTitle>
|
||||
<ReferringTargetFrameworkForProjectReferences>.NETStandard,Version=v2.0</ReferringTargetFrameworkForProjectReferences>
|
||||
<DefineConstants>NETSTANDARD2_0;DNXCORE50;PORTABLE;HAVE_BENCHMARKS;$(AdditionalConstants)</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp2.2'">
|
||||
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp3.1'">
|
||||
<PackageReference Include="BenchmarkDotNet" Version="$(BenchmarkDotNetPackageVersion)" />
|
||||
<PackageReference Include="FSharp.Core" Version="$(FSharpCorePackageVersion)" />
|
||||
<PackageReference Include="System.ObjectModel" Version="$(SystemObjectModelPackageVersion)" />
|
||||
@@ -143,7 +143,7 @@
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitRunnerVisualStudioPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='netcoreapp2.2'">
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='netcoreapp3.1'">
|
||||
<AssemblyTitle>Json.NET Tests .NET Standard 1.3</AssemblyTitle>
|
||||
<ReferringTargetFrameworkForProjectReferences>.NETStandard,Version=v1.3</ReferringTargetFrameworkForProjectReferences>
|
||||
<DefineConstants>NETSTANDARD1_3;DNXCORE50;PORTABLE;HAVE_BENCHMARKS;$(AdditionalConstants)</DefineConstants>
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
{
|
||||
Dictionary<float, int> dictionary = new Dictionary<float, int> { { float.MaxValue, 1 } };
|
||||
string output = JsonConvert.SerializeObject(dictionary);
|
||||
#if !NETSTANDARD2_0
|
||||
#if !(NETSTANDARD2_0 || NETSTANDARD1_3)
|
||||
Assert.AreEqual(@"{""3.40282347E+38"":1}", output);
|
||||
#else
|
||||
Assert.AreEqual(@"{""3.4028235E+38"":1}", output);
|
||||
|
||||
@@ -2258,7 +2258,7 @@ keyword such as type of business.""
|
||||
string json = JsonConvert.SerializeObject(new ConverableMembers(), Formatting.Indented);
|
||||
|
||||
string expected = null;
|
||||
#if NETSTANDARD2_0
|
||||
#if (NETSTANDARD2_0)
|
||||
expected = @"{
|
||||
""String"": ""string"",
|
||||
""Int32"": 2147483647,
|
||||
@@ -2275,7 +2275,23 @@ keyword such as type of business.""
|
||||
""Bool"": true,
|
||||
""Char"": ""\u0000""
|
||||
}";
|
||||
#elif !(PORTABLE || DNXCORE50)
|
||||
#elif NETSTANDARD1_3
|
||||
expected = @"{
|
||||
""String"": ""string"",
|
||||
""Int32"": 2147483647,
|
||||
""UInt32"": 4294967295,
|
||||
""Byte"": 255,
|
||||
""SByte"": 127,
|
||||
""Short"": 32767,
|
||||
""UShort"": 65535,
|
||||
""Long"": 9223372036854775807,
|
||||
""ULong"": 9223372036854775807,
|
||||
""Double"": 1.7976931348623157E+308,
|
||||
""Float"": 3.4028235E+38,
|
||||
""Bool"": true,
|
||||
""Char"": ""\u0000""
|
||||
}";
|
||||
#elif !(PORTABLE || DNXCORE50) || NETSTANDARD1_3
|
||||
expected = @"{
|
||||
""String"": ""string"",
|
||||
""Int32"": 2147483647,
|
||||
|
||||
Reference in New Issue
Block a user