-Added netstandard2.0

This commit is contained in:
James Newton-King
2017-10-01 23:11:30 +13:00
parent 5cdad2e275
commit ab3315f1d5
104 changed files with 347 additions and 410 deletions
@@ -28,7 +28,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using Newtonsoft.Json.Linq;
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
using System.Numerics;
#endif
using System.Text;
@@ -93,7 +93,7 @@ namespace Newtonsoft.Json.Tests.JsonTextReaderTests
"Unexpected character encountered while parsing value: u. Path '', line 1, position 1.");
}
#if !(PORTABLE || PORTABLE40 || NET35 || NET20)
#if !(PORTABLE || PORTABLE40 || NET35 || NET20) || NETSTANDARD1_3 || NETSTANDARD2_0
[Test]
public void ReadAsBoolean()
{
@@ -1073,71 +1073,6 @@ namespace Newtonsoft.Json.Tests.JsonTextReaderTests
Assert.IsTrue(reader.Read());
}
#if !DNXCORE50
[Test]
[Ignore("Probably not a Json.NET issue")]
public void ReadFromNetworkStream()
{
const int port = 11999;
const int jsonArrayElementsCount = 193;
var serverStartedEvent = new ManualResetEvent(false);
var clientReceivedEvent = new ManualResetEvent(false);
ThreadPool.QueueUserWorkItem(work =>
{
var server = new TcpListener(IPAddress.Parse("0.0.0.0"), port);
server.Start();
serverStartedEvent.Set();
var serverSocket = server.AcceptSocket();
var jsonString = "[\r\n" + String.Join(",", Enumerable.Repeat(" \"testdata\"\r\n", jsonArrayElementsCount).ToArray()) + "]";
var bytes = new UTF8Encoding().GetBytes(jsonString);
serverSocket.Send(bytes);
Console.WriteLine("server send: " + bytes.Length);
clientReceivedEvent.WaitOne();
});
serverStartedEvent.WaitOne();
var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Blocking = false;
socket.Connect("127.0.0.1", port);
var stream = new NetworkStream(socket);
var serializer = new JsonSerializer();
int i = 0;
using (var sr = new StreamReader(stream, new UTF8Encoding(), false))
using (var jsonTextReader = new JsonTextReader(sr))
{
while (jsonTextReader.Read())
{
i++;
if (i == 193)
{
string s = string.Empty;
}
Console.WriteLine($"{i} - {jsonTextReader.TokenType} - {jsonTextReader.Value}");
}
//var result = serializer.Deserialize(jsonTextReader).ToString();
//Console.WriteLine("client receive: " + new UTF8Encoding().GetBytes(result).Length);
}
clientReceivedEvent.Set();
Console.WriteLine("Done");
}
#endif
[Test]
public void ReadCommentInsideArray()
{
@@ -1226,7 +1161,7 @@ third line", jsonTextReader.Value);
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3
#if !(NET20 || NET35 || PORTABLE40 || PORTABLE) || NETSTANDARD1_3 || NETSTANDARD2_0
[Test]
public void ReadBigInteger()
{