diff --git a/Build/build.ps1 b/Build/build.ps1 index d95c7029..41c47533 100644 --- a/Build/build.ps1 +++ b/Build/build.ps1 @@ -60,7 +60,7 @@ task Build -depends Clean { Write-Host -ForegroundColor Green "Building " $name Write-Host -ForegroundColor Green "Signed " $sign Write-Host - exec { msbuild "/t:Clean;Rebuild" /p:Configuration=Release "/p:Platform=Any CPU" /p:OutputPath=bin\Release\$finalDir\ /p:AssemblyOriginatorKeyFile=$signKeyPath "/p:SignAssembly=$sign" "/p:TreatWarningsAsErrors=$treatWarningsAsErrors" (GetConstants $build.Constants $sign) ".\Src\$name.sln" | Out-Default } "Error building $name" + exec { msbuild "/t:Clean;Rebuild" /p:Configuration=Release "/p:Platform=Any CPU" /p:OutputPath=bin\Release\$finalDir\ /p:AssemblyOriginatorKeyFile=$signKeyPath "/p:SignAssembly=$sign" "/p:TreatWarningsAsErrors=$treatWarningsAsErrors" "/p:VisualStudioVersion=12.0" (GetConstants $build.Constants $sign) ".\Src\$name.sln" | Out-Default } "Error building $name" } } diff --git a/Src/Newtonsoft.Json.Portable.sln b/Src/Newtonsoft.Json.Portable.sln index f7ad1865..15307c10 100644 --- a/Src/Newtonsoft.Json.Portable.sln +++ b/Src/Newtonsoft.Json.Portable.sln @@ -1,6 +1,8 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.30324.0 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lib", "Lib", "{620042D9-2753-48F5-BEDE-3905248781D2}" ProjectSection(SolutionItems) = preProject Lib\NUnit\DotNet\nunit.framework.dll = Lib\NUnit\DotNet\nunit.framework.dll diff --git a/Src/Newtonsoft.Json.Tests/JsonArrayAttributeTests.cs b/Src/Newtonsoft.Json.Tests/JsonArrayAttributeTests.cs index a04aec1b..efdb42f3 100644 --- a/Src/Newtonsoft.Json.Tests/JsonArrayAttributeTests.cs +++ b/Src/Newtonsoft.Json.Tests/JsonArrayAttributeTests.cs @@ -25,7 +25,6 @@ #if !NETFX_CORE using NUnit.Framework; - #else using Microsoft.VisualStudio.TestPlatform.UnitTestFramework; using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute; diff --git a/Src/Newtonsoft.Json.Tests/Linq/JsonPath/JPathExecuteTests.cs b/Src/Newtonsoft.Json.Tests/Linq/JsonPath/JPathExecuteTests.cs index 45dd8f30..7775f243 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/JsonPath/JPathExecuteTests.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/JsonPath/JPathExecuteTests.cs @@ -290,7 +290,7 @@ namespace Newtonsoft.Json.Tests.Linq.JsonPath new JProperty("Blah", 1)); JValue v = (JValue)o.SelectToken("Blah", true); - Assert.AreEqual(1L, v.Value); + Assert.AreEqual(1, v.Value); } [Test] diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable.csproj index 667ead78..500ef5b2 100644 --- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable.csproj +++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable.csproj @@ -76,9 +76,8 @@ ..\packages\NUnit.2.6.2\lib\nunit.framework.dll - - False - ..\packages\Microsoft.Bcl.Immutable.1.0.27\lib\portable-net45+win8+wp8\System.Collections.Immutable.dll + + ..\packages\Microsoft.Bcl.Immutable.1.1.20-beta\lib\portable-net45+win8\System.Collections.Immutable.dll 3.5 diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WinRT.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WinRT.csproj index bb080827..b945a3ce 100644 --- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WinRT.csproj +++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WinRT.csproj @@ -166,8 +166,11 @@ + + + @@ -176,16 +179,22 @@ + + + + + + @@ -193,6 +202,7 @@ + @@ -204,25 +214,35 @@ + + + + + + + + + + @@ -236,17 +256,25 @@ + + + + + + + + @@ -256,14 +284,18 @@ + + + + @@ -276,12 +308,22 @@ + + + + + + + + + + @@ -318,7 +360,7 @@ - ..\packages\Microsoft.Bcl.Immutable.1.0.27\lib\portable-net45+win8+wp8\System.Collections.Immutable.dll + ..\packages\Microsoft.Bcl.Immutable.1.1.20-beta\lib\portable-net45+win8\System.Collections.Immutable.dll diff --git a/Src/Newtonsoft.Json.Tests/Serialization/ExtensionDataTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/ExtensionDataTests.cs index f9f3535a..3b3fc4d3 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/ExtensionDataTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/ExtensionDataTests.cs @@ -28,7 +28,13 @@ using System.Collections.Generic; using System.Text; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Tests.TestObjects; +#if !NETFX_CORE 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.Serialization { diff --git a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerCollectionsTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerCollectionsTests.cs index 68e9fd31..cfe56f93 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerCollectionsTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerCollectionsTests.cs @@ -40,7 +40,13 @@ using System.Linq; using System.Text; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Tests.TestObjects; +#if !NETFX_CORE 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.Serialization { diff --git a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs index 57cb2976..8a69a8e4 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs @@ -228,7 +228,7 @@ namespace Newtonsoft.Json.Tests.Serialization var json = JsonConvert.SerializeObject(input); var deserialized = JsonConvert.DeserializeObject>>(json); - Assert.AreEqual(input.Data, deserialized.Data); + CollectionAssert.AreEqual(input.Data, deserialized.Data); Assert.AreEqual(input.Message, deserialized.Message); Assert.AreEqual(input.Result, deserialized.Result); } @@ -651,6 +651,7 @@ namespace Newtonsoft.Json.Tests.Serialization Assert.AreEqual("value", deserialized.foo.bar); } +#if !NETFX_CORE [Test] public void ConversionOperator() { @@ -676,6 +677,7 @@ namespace Newtonsoft.Json.Tests.Serialization Console.WriteLine("Time elapsed: " + stopWatch.ElapsedMilliseconds); } +#endif internal class DictionaryKeyCast { diff --git a/Src/Newtonsoft.Json.Tests/Serialization/ShouldSerializeTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/ShouldSerializeTests.cs index 3de92f04..f383ddeb 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/ShouldSerializeTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/ShouldSerializeTests.cs @@ -29,7 +29,13 @@ using System.Globalization; using System.IO; using System.Text; using Newtonsoft.Json.Serialization; +#if !NETFX_CORE 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.Serialization { @@ -93,9 +99,9 @@ namespace Newtonsoft.Json.Tests.Serialization var deserializedSetFoo = JsonConvert.DeserializeObject(setFooJson); Assert.AreEqual(setFoo.name, deserializedSetFoo.name); - Assert.NotNull(deserializedSetFoo.myBar); + Assert.IsNotNull(deserializedSetFoo.myBar); Assert.AreEqual(setFoo.myBar.name, deserializedSetFoo.myBar.name); - Assert.NotNull(deserializedSetFoo.myBar.myBaz); + Assert.IsNotNull(deserializedSetFoo.myBar.myBaz); Assert.AreEqual(setFoo.myBar.myBaz.Length, deserializedSetFoo.myBar.myBaz.Length); Assert.AreEqual(setFoo.myBar.myBaz[0].name, deserializedSetFoo.myBar.myBaz[0].name); Assert.IsNotNull(deserializedSetFoo.myBar.myBaz[0].myFrob[0]); @@ -125,7 +131,7 @@ namespace Newtonsoft.Json.Tests.Serialization jsonSerializer.Serialize(jsonWriter, f, typeof(Foo1)); } - Console.Out.WriteLine("Trace output:\n{0}", traceWriter.ToString()); + Console.WriteLine("Trace output:\n{0}", traceWriter.ToString()); return sw.ToString(); } diff --git a/Src/Newtonsoft.Json.Tests/Serialization/SpecialPropertyHandlingTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/SpecialPropertyHandlingTests.cs index da3cc244..9282ddc9 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/SpecialPropertyHandlingTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/SpecialPropertyHandlingTests.cs @@ -1,11 +1,42 @@ -using System; +#region License +// Copyright (c) 2007 James Newton-King +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#endregion + +using System; using System.Collections.Generic; using System.Runtime.Serialization.Formatters; using System.Text; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Tests.TestObjects; using Newtonsoft.Json.Utilities; +#if !NETFX_CORE 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.Serialization { diff --git a/Src/Newtonsoft.Json.Tests/Serialization/TypeNameHandlingTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/TypeNameHandlingTests.cs index 93fa0877..f88f26fc 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/TypeNameHandlingTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/TypeNameHandlingTests.cs @@ -1765,7 +1765,7 @@ namespace Newtonsoft.Json.Tests.Serialization }); ReportItemKeys item = (ReportItemKeys)g.ItemIdentifier; - Assert.AreEqual(1, item.WantedUnitID); + Assert.AreEqual(1UL, item.WantedUnitID); } #endif } diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.Portable.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.Portable.csproj index 1fa28ba7..ed0a2329 100644 --- a/Src/Newtonsoft.Json/Newtonsoft.Json.Portable.csproj +++ b/Src/Newtonsoft.Json/Newtonsoft.Json.Portable.csproj @@ -9,10 +9,10 @@ Newtonsoft.Json Newtonsoft.Json v4.5 - Profile225 + Profile259 512 {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 10.0 + 11.0 true diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.WinRT.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.WinRT.csproj index 686537b1..a0aea4c6 100644 --- a/Src/Newtonsoft.Json/Newtonsoft.Json.WinRT.csproj +++ b/Src/Newtonsoft.Json/Newtonsoft.Json.WinRT.csproj @@ -263,6 +263,7 @@ + diff --git a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs index 9b84991f..c290b1d7 100644 --- a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs +++ b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs @@ -411,7 +411,7 @@ namespace Newtonsoft.Json.Serialization JsonObjectContract objectContract = (JsonObjectContract)contract; object targetObject; // check that if type name handling is being used that the existing value is compatible with the specified type - if (existingValue != null && (resolvedObjectType == objectType || resolvedObjectType.IsInstanceOfType(existingValue))) + if (existingValue != null && (resolvedObjectType == objectType || resolvedObjectType.IsAssignableFrom(existingValue.GetType()))) targetObject = existingValue; else targetObject = CreateNewObject(reader, objectContract, member, containerMember, id, out createdFromNonDefaultConstructor);