Run unit tests on .NET Core 3.0 and fix Enumerable.Empty (#2137)
This commit is contained in:
@@ -363,7 +363,8 @@ namespace Newtonsoft.Json.Tests.JsonTextReaderTests
|
||||
new string[]
|
||||
{
|
||||
"Value cannot be null." + Environment.NewLine + "Parameter name: reader",
|
||||
"Argument cannot be null." + Environment.NewLine + "Parameter name: reader" // Mono
|
||||
"Argument cannot be null." + Environment.NewLine + "Parameter name: reader", // Mono
|
||||
"Value cannot be null. (Parameter 'reader')"
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -200,10 +200,22 @@ namespace Newtonsoft.Json.Tests.JsonTextReaderTests
|
||||
Assert.AreEqual(Double.MinValue, reader.Value);
|
||||
|
||||
reader = new JsonTextReader(new StringReader("1E+309"));
|
||||
#if !NETSTANDARD2_0
|
||||
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());
|
||||
Assert.AreEqual(typeof(double), reader.ValueType);
|
||||
Assert.AreEqual(Double.PositiveInfinity, reader.Value);
|
||||
#endif
|
||||
|
||||
reader = new JsonTextReader(new StringReader("-1E+5000"));
|
||||
#if !NETSTANDARD2_0
|
||||
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());
|
||||
Assert.AreEqual(typeof(double), reader.ValueType);
|
||||
Assert.AreEqual(Double.NegativeInfinity, reader.Value);
|
||||
#endif
|
||||
|
||||
reader = new JsonTextReader(new StringReader("5.1231231E"));
|
||||
await ExceptionAssert.ThrowsAsync<JsonReaderException>(async () => await reader.ReadAsync(), "Input string '5.1231231E' is not a valid number. Path '', line 1, position 10.");
|
||||
|
||||
@@ -220,10 +220,22 @@ namespace Newtonsoft.Json.Tests.JsonTextReaderTests
|
||||
Assert.AreEqual(Double.MinValue, reader.Value);
|
||||
|
||||
reader = new JsonTextReader(new StringReader("1E+309"));
|
||||
#if !NETSTANDARD2_0
|
||||
ExceptionAssert.Throws<JsonReaderException>(() => reader.Read(), "Input string '1E+309' is not a valid number. Path '', line 1, position 6.");
|
||||
#else
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(typeof(double), reader.ValueType);
|
||||
Assert.AreEqual(Double.PositiveInfinity, reader.Value);
|
||||
#endif
|
||||
|
||||
reader = new JsonTextReader(new StringReader("-1E+5000"));
|
||||
#if !NETSTANDARD2_0
|
||||
ExceptionAssert.Throws<JsonReaderException>(() => reader.Read(), "Input string '-1E+5000' is not a valid number. Path '', line 1, position 8.");
|
||||
#else
|
||||
Assert.IsTrue(reader.Read());
|
||||
Assert.AreEqual(typeof(double), reader.ValueType);
|
||||
Assert.AreEqual(Double.NegativeInfinity, reader.Value);
|
||||
#endif
|
||||
|
||||
reader = new JsonTextReader(new StringReader("5.1231231E"));
|
||||
ExceptionAssert.Throws<JsonReaderException>(() => reader.Read(), "Input string '5.1231231E' is not a valid number. Path '', line 1, position 10.");
|
||||
|
||||
@@ -84,7 +84,8 @@ namespace Newtonsoft.Json.Tests.JsonTextReaderTests
|
||||
|
||||
await ExceptionAssert.ThrowsAsync<JsonReaderException>(
|
||||
() => token.CreateReader().ReadAsDecimalAsync(),
|
||||
"Could not convert to decimal: 1.79769313486232E+308. Path ''."
|
||||
"Could not convert to decimal: 1.79769313486232E+308. Path ''.",
|
||||
"Could not convert to decimal: 1.7976931348623157E+308. Path ''."
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,8 @@ namespace Newtonsoft.Json.Tests.JsonTextReaderTests
|
||||
|
||||
ExceptionAssert.Throws<JsonReaderException>(
|
||||
() => token.CreateReader().ReadAsDecimal(),
|
||||
"Could not convert to decimal: 1.79769313486232E+308. Path ''."
|
||||
"Could not convert to decimal: 1.79769313486232E+308. Path ''.",
|
||||
"Could not convert to decimal: 1.7976931348623157E+308. Path ''."
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user