-WinRT build
This commit is contained in:
@@ -33,13 +33,13 @@ using NUnit.Framework;
|
|||||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||||
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||||
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||||
|
#endif
|
||||||
using Windows.Data.Json;
|
using Windows.Data.Json;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace Newtonsoft.Json.Tests.Converters
|
namespace Newtonsoft.Json.Tests.Converters
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,7 +5,13 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using Newtonsoft.Json.Linq.JsonPath;
|
using Newtonsoft.Json.Linq.JsonPath;
|
||||||
|
#if !NETFX_CORE
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
#else
|
||||||
|
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||||
|
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
|
||||||
|
using Test = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestMethodAttribute;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Newtonsoft.Json.Tests.Linq.JsonPath
|
namespace Newtonsoft.Json.Tests.Linq.JsonPath
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -142,9 +142,11 @@
|
|||||||
<Compile Include="Linq\JArrayTests.cs" />
|
<Compile Include="Linq\JArrayTests.cs" />
|
||||||
<Compile Include="Linq\JConstructorTests.cs" />
|
<Compile Include="Linq\JConstructorTests.cs" />
|
||||||
<Compile Include="Linq\JObjectTests.cs" />
|
<Compile Include="Linq\JObjectTests.cs" />
|
||||||
<Compile Include="Linq\JPathTests.cs" />
|
|
||||||
<Compile Include="Linq\JPropertyTests.cs" />
|
<Compile Include="Linq\JPropertyTests.cs" />
|
||||||
<Compile Include="Linq\JRawTests.cs" />
|
<Compile Include="Linq\JRawTests.cs" />
|
||||||
|
<Compile Include="Linq\JsonPath\JPathExecuteTests.cs" />
|
||||||
|
<Compile Include="Linq\JsonPath\JPathParseTests.cs" />
|
||||||
|
<Compile Include="Linq\JsonPath\QueryExpressionTests.cs" />
|
||||||
<Compile Include="Linq\JTokenEqualityComparerTests.cs" />
|
<Compile Include="Linq\JTokenEqualityComparerTests.cs" />
|
||||||
<Compile Include="Linq\JTokenReaderTest.cs" />
|
<Compile Include="Linq\JTokenReaderTest.cs" />
|
||||||
<Compile Include="Linq\JTokenTests.cs" />
|
<Compile Include="Linq\JTokenTests.cs" />
|
||||||
@@ -177,7 +179,6 @@
|
|||||||
<Compile Include="Serialization\TraceWriterTests.cs" />
|
<Compile Include="Serialization\TraceWriterTests.cs" />
|
||||||
<Compile Include="Serialization\TypeNameHandlingTests.cs" />
|
<Compile Include="Serialization\TypeNameHandlingTests.cs" />
|
||||||
<Compile Include="Serialization\WebApiIntegrationTests.cs" />
|
<Compile Include="Serialization\WebApiIntegrationTests.cs" />
|
||||||
<Compile Include="SilverlightTests.cs" />
|
|
||||||
<Compile Include="TestFixtureBase.cs" />
|
<Compile Include="TestFixtureBase.cs" />
|
||||||
<Compile Include="TestObjects\AbstractGenericBase.cs" />
|
<Compile Include="TestObjects\AbstractGenericBase.cs" />
|
||||||
<Compile Include="TestObjects\ArgumentConverterPrecedenceClassConverter.cs" />
|
<Compile Include="TestObjects\ArgumentConverterPrecedenceClassConverter.cs" />
|
||||||
|
|||||||
@@ -9471,28 +9471,6 @@ Parameter name: value",
|
|||||||
]", json);
|
]", json);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Foo2
|
|
||||||
{
|
|
||||||
public string Name { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
[Ignore]
|
|
||||||
public void SerializeMultipleObjectsFromStream()
|
|
||||||
{
|
|
||||||
StringReader sr = new StringReader(@"{ ""name"": ""bar"" }{ ""name"": ""baz"" }");
|
|
||||||
|
|
||||||
var reader1 = new JsonTextReader(sr);
|
|
||||||
var serializer1 = new JsonSerializer { };
|
|
||||||
var foo1 = serializer1.Deserialize<Foo2>(reader1);
|
|
||||||
Assert.AreEqual("bar", foo1.Name);
|
|
||||||
|
|
||||||
var reader2 = new JsonTextReader(sr);
|
|
||||||
var serializer2 = new JsonSerializer { };
|
|
||||||
var foo2 = serializer2.Deserialize<Foo2>(reader2);
|
|
||||||
Assert.AreEqual("baz", foo2.Name);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if !(PORTABLE || PORTABLE40 || NETFX_CORE)
|
#if !(PORTABLE || PORTABLE40 || NETFX_CORE)
|
||||||
[Test]
|
[Test]
|
||||||
public void SerializeDictionaryWithStructKey()
|
public void SerializeDictionaryWithStructKey()
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ using System;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data.Odbc;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Newtonsoft.Json.Serialization;
|
using Newtonsoft.Json.Serialization;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
@@ -145,7 +145,12 @@ namespace Newtonsoft.Json.Converters
|
|||||||
|
|
||||||
// all fsharp objects have CompilationMappingAttribute
|
// all fsharp objects have CompilationMappingAttribute
|
||||||
// get the fsharp assembly from the attribute and initialize latebound methods
|
// get the fsharp assembly from the attribute and initialize latebound methods
|
||||||
object[] attributes = objectType.GetCustomAttributes(true);
|
object[] attributes;
|
||||||
|
#if !(NETFX_CORE || PORTABLE)
|
||||||
|
attributes = objectType.GetCustomAttributes(true);
|
||||||
|
#else
|
||||||
|
attributes = objectType.GetTypeInfo().GetCustomAttributes(true).ToArray();
|
||||||
|
#endif
|
||||||
bool isFSharpType = false;
|
bool isFSharpType = false;
|
||||||
foreach (object attribute in attributes)
|
foreach (object attribute in attributes)
|
||||||
{
|
{
|
||||||
@@ -171,7 +176,7 @@ namespace Newtonsoft.Json.Converters
|
|||||||
{
|
{
|
||||||
_initialized = true;
|
_initialized = true;
|
||||||
|
|
||||||
Assembly fsharpCoreAssembly = attributeType.Assembly;
|
Assembly fsharpCoreAssembly = attributeType.Assembly();
|
||||||
Type fsharpType = fsharpCoreAssembly.GetType("Microsoft.FSharp.Reflection.FSharpType");
|
Type fsharpType = fsharpCoreAssembly.GetType("Microsoft.FSharp.Reflection.FSharpType");
|
||||||
|
|
||||||
MethodInfo isUnionMethodInfo = fsharpType.GetMethod("IsUnion", BindingFlags.Public | BindingFlags.Static);
|
MethodInfo isUnionMethodInfo = fsharpType.GetMethod("IsUnion", BindingFlags.Public | BindingFlags.Static);
|
||||||
|
|||||||
@@ -127,6 +127,7 @@
|
|||||||
<Compile Include="Converters\DataSetConverter.cs" />
|
<Compile Include="Converters\DataSetConverter.cs" />
|
||||||
<Compile Include="Converters\DataTableConverter.cs" />
|
<Compile Include="Converters\DataTableConverter.cs" />
|
||||||
<Compile Include="Converters\DateTimeConverterBase.cs" />
|
<Compile Include="Converters\DateTimeConverterBase.cs" />
|
||||||
|
<Compile Include="Converters\DiscriminatedUnionConverter.cs" />
|
||||||
<Compile Include="Converters\EntityKeyMemberConverter.cs" />
|
<Compile Include="Converters\EntityKeyMemberConverter.cs" />
|
||||||
<Compile Include="Converters\ExpandoObjectConverter.cs" />
|
<Compile Include="Converters\ExpandoObjectConverter.cs" />
|
||||||
<Compile Include="Converters\IsoDateTimeConverter.cs" />
|
<Compile Include="Converters\IsoDateTimeConverter.cs" />
|
||||||
@@ -178,11 +179,19 @@
|
|||||||
<Compile Include="Linq\JContainer.cs" />
|
<Compile Include="Linq\JContainer.cs" />
|
||||||
<Compile Include="Linq\JEnumerable.cs" />
|
<Compile Include="Linq\JEnumerable.cs" />
|
||||||
<Compile Include="Linq\JObject.cs" />
|
<Compile Include="Linq\JObject.cs" />
|
||||||
<Compile Include="Linq\JPath.cs" />
|
|
||||||
<Compile Include="Linq\JProperty.cs" />
|
<Compile Include="Linq\JProperty.cs" />
|
||||||
<Compile Include="Linq\JPropertyDescriptor.cs" />
|
<Compile Include="Linq\JPropertyDescriptor.cs" />
|
||||||
<Compile Include="Linq\JPropertyKeyedCollection.cs" />
|
<Compile Include="Linq\JPropertyKeyedCollection.cs" />
|
||||||
<Compile Include="Linq\JRaw.cs" />
|
<Compile Include="Linq\JRaw.cs" />
|
||||||
|
<Compile Include="Linq\JsonPath\ArrayIndexFilter.cs" />
|
||||||
|
<Compile Include="Linq\JsonPath\ArrayMultipleIndexFilter.cs" />
|
||||||
|
<Compile Include="Linq\JsonPath\ArraySliceFilter.cs" />
|
||||||
|
<Compile Include="Linq\JsonPath\FieldFilter.cs" />
|
||||||
|
<Compile Include="Linq\JsonPath\JPath.cs" />
|
||||||
|
<Compile Include="Linq\JsonPath\PathFilter.cs" />
|
||||||
|
<Compile Include="Linq\JsonPath\QueryExpression.cs" />
|
||||||
|
<Compile Include="Linq\JsonPath\QueryFilter.cs" />
|
||||||
|
<Compile Include="Linq\JsonPath\ScanFilter.cs" />
|
||||||
<Compile Include="Linq\JToken.cs" />
|
<Compile Include="Linq\JToken.cs" />
|
||||||
<Compile Include="Linq\JTokenEqualityComparer.cs" />
|
<Compile Include="Linq\JTokenEqualityComparer.cs" />
|
||||||
<Compile Include="Linq\JTokenReader.cs" />
|
<Compile Include="Linq\JTokenReader.cs" />
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ using System.Reflection;
|
|||||||
using Newtonsoft.Json.Utilities.LinqBridge;
|
using Newtonsoft.Json.Utilities.LinqBridge;
|
||||||
#else
|
#else
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Newtonsoft.Json.Utilities
|
namespace Newtonsoft.Json.Utilities
|
||||||
@@ -151,6 +150,15 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Assembly Assembly(this Type type)
|
||||||
|
{
|
||||||
|
#if !(NETFX_CORE || PORTABLE)
|
||||||
|
return type.Assembly;
|
||||||
|
#else
|
||||||
|
return type.GetTypeInfo().Assembly;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
public static bool IsEnum(this Type type)
|
public static bool IsEnum(this Type type)
|
||||||
{
|
{
|
||||||
#if !(NETFX_CORE || PORTABLE)
|
#if !(NETFX_CORE || PORTABLE)
|
||||||
|
|||||||
Reference in New Issue
Block a user