diff --git a/Src/Newtonsoft.Json.Tests/Bson/BsonWriterTests.cs b/Src/Newtonsoft.Json.Tests/Bson/BsonWriterTests.cs index 3b73ab44..772af120 100644 --- a/Src/Newtonsoft.Json.Tests/Bson/BsonWriterTests.cs +++ b/Src/Newtonsoft.Json.Tests/Bson/BsonWriterTests.cs @@ -43,6 +43,7 @@ using Newtonsoft.Json.Linq; using Newtonsoft.Json.Utilities; using Newtonsoft.Json.Tests.TestObjects; using System.Globalization; +using Newtonsoft.Json.Tests.TestObjects.GeoCoding; #if NET20 using Newtonsoft.Json.Utilities.LinqBridge; #else diff --git a/Src/Newtonsoft.Json.Tests/Converters/DiscriminatedUnionConverterTests.cs b/Src/Newtonsoft.Json.Tests/Converters/DiscriminatedUnionConverterTests.cs index 3e586218..54b09adc 100644 --- a/Src/Newtonsoft.Json.Tests/Converters/DiscriminatedUnionConverterTests.cs +++ b/Src/Newtonsoft.Json.Tests/Converters/DiscriminatedUnionConverterTests.cs @@ -34,6 +34,8 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json.Tests.TestObjects; +using Newtonsoft.Json.Tests.TestObjects.GeometricForms; +using Newtonsoft.Json.Tests.TestObjects.Money; using NUnit.Framework; namespace Newtonsoft.Json.Tests.Converters @@ -238,7 +240,7 @@ namespace Newtonsoft.Json.Tests.Converters 10.0, 5.0 }); - Assert.AreEqual("Newtonsoft.Json.Tests.TestObjects.Shape+Rectangle", value.ToString()); + Assert.AreEqual("Newtonsoft.Json.Tests.TestObjects.GeometricForms.Shape+Rectangle", value.ToString()); Assert.AreEqual(10, value.width); Assert.AreEqual(5, value.length); } diff --git a/Src/Newtonsoft.Json.Tests/Converters/IsoDateTimeConverterTests.cs b/Src/Newtonsoft.Json.Tests/Converters/IsoDateTimeConverterTests.cs index 01835668..a17d5981 100644 --- a/Src/Newtonsoft.Json.Tests/Converters/IsoDateTimeConverterTests.cs +++ b/Src/Newtonsoft.Json.Tests/Converters/IsoDateTimeConverterTests.cs @@ -25,6 +25,7 @@ using System; using Newtonsoft.Json.Tests.TestObjects; +using Newtonsoft.Json.Tests.TestObjects.Organization; #if DNXCORE50 using Xunit; using Test = Xunit.FactAttribute; diff --git a/Src/Newtonsoft.Json.Tests/Documentation/Samples/Serializer/DefaultSettings.cs b/Src/Newtonsoft.Json.Tests/Documentation/Samples/Serializer/DefaultSettings.cs index a9d2bd9e..175d14d4 100644 --- a/Src/Newtonsoft.Json.Tests/Documentation/Samples/Serializer/DefaultSettings.cs +++ b/Src/Newtonsoft.Json.Tests/Documentation/Samples/Serializer/DefaultSettings.cs @@ -37,7 +37,7 @@ using System.Runtime.Serialization; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Tests.Serialization; -using Staff = Newtonsoft.Json.Tests.TestObjects.Employee; +using Staff = Newtonsoft.Json.Tests.TestObjects.Organization.Employee; namespace Newtonsoft.Json.Tests.Documentation.Samples.Serializer { diff --git a/Src/Newtonsoft.Json.Tests/JsonConvertTest.cs b/Src/Newtonsoft.Json.Tests/JsonConvertTest.cs index a246ff93..4591e20c 100644 --- a/Src/Newtonsoft.Json.Tests/JsonConvertTest.cs +++ b/Src/Newtonsoft.Json.Tests/JsonConvertTest.cs @@ -42,6 +42,7 @@ using Newtonsoft.Json.Linq; using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Tests.Serialization; using Newtonsoft.Json.Tests.TestObjects; +using Newtonsoft.Json.Tests.TestObjects.Organization; using Newtonsoft.Json.Utilities; #if DNXCORE50 using Xunit; diff --git a/Src/Newtonsoft.Json.Tests/Linq/JObjectTests.cs b/Src/Newtonsoft.Json.Tests/Linq/JObjectTests.cs index 76051e07..b39c7ca3 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/JObjectTests.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/JObjectTests.cs @@ -32,6 +32,7 @@ using System.Numerics; #endif using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Tests.TestObjects; +using Newtonsoft.Json.Tests.TestObjects.Organization; #if DNXCORE50 using Xunit; using Test = Xunit.FactAttribute; diff --git a/Src/Newtonsoft.Json.Tests/Linq/LinqToJsonTest.cs b/Src/Newtonsoft.Json.Tests/Linq/LinqToJsonTest.cs index ba0f6094..6105664d 100644 --- a/Src/Newtonsoft.Json.Tests/Linq/LinqToJsonTest.cs +++ b/Src/Newtonsoft.Json.Tests/Linq/LinqToJsonTest.cs @@ -38,6 +38,7 @@ using Newtonsoft.Json.Converters; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Tests.Serialization; using Newtonsoft.Json.Tests.TestObjects; +using Newtonsoft.Json.Tests.TestObjects.Organization; #if NET20 using Newtonsoft.Json.Utilities.LinqBridge; #else diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj index 705105fb..ce6141ed 100644 --- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj +++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj @@ -123,24 +123,38 @@ + - + - - + + + - + + + + + + + + + + + + + @@ -158,14 +172,25 @@ + + + + + + + + + + + + - @@ -177,9 +202,12 @@ + + + @@ -191,10 +219,11 @@ + + - @@ -252,7 +281,6 @@ - @@ -277,12 +305,13 @@ + + - diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net35.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net35.csproj index 30529bb5..bc967a39 100644 --- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net35.csproj +++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net35.csproj @@ -166,19 +166,35 @@ + - + - + + + + + + + + + + + + + + + + @@ -190,8 +206,20 @@ + + + + + + + + + + + + @@ -201,17 +229,16 @@ + + - - - @@ -232,11 +259,13 @@ + + + - True True @@ -246,8 +275,9 @@ + + - @@ -304,7 +334,6 @@ - diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net40.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net40.csproj index aeed9981..12b12842 100644 --- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net40.csproj +++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net40.csproj @@ -283,19 +283,35 @@ + - + - + + + + + + + + + + + + + + + + @@ -307,11 +323,22 @@ + + + + + + + + + + + + - @@ -322,8 +349,6 @@ - - @@ -346,14 +371,18 @@ + + + + + - True True @@ -363,8 +392,9 @@ + + - @@ -421,7 +451,6 @@ - diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable.csproj index fb563d75..871157fd 100644 --- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable.csproj +++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable.csproj @@ -159,19 +159,35 @@ + - + - + + + + + + + + + + + + + + + + @@ -183,11 +199,22 @@ + + + + + + + + + + + + - @@ -198,8 +225,6 @@ - - @@ -222,20 +247,25 @@ + + + + + - + + - @@ -292,7 +322,6 @@ - diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable40.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable40.csproj index b7bf48c1..04e62fe5 100644 --- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable40.csproj +++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable40.csproj @@ -163,19 +163,35 @@ + - + - + + + + + + + + + + + + + + + + @@ -187,11 +203,22 @@ + + + + + + + + + + + + - @@ -202,8 +229,6 @@ - - @@ -226,20 +251,25 @@ + + + + + - + + - @@ -296,7 +326,6 @@ - diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj index 78106ea2..11fe27a7 100644 --- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj +++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj @@ -314,6 +314,7 @@ + @@ -323,7 +324,19 @@ - + + + + + + + + + + + + + @@ -335,14 +348,14 @@ - - + + - + @@ -369,17 +382,25 @@ + + + + + + + + - + - + @@ -397,14 +418,19 @@ + + + + + @@ -413,7 +439,7 @@ - + True @@ -425,15 +451,18 @@ + + + - + diff --git a/Src/Newtonsoft.Json.Tests/Schema/ExtensionsTests.cs b/Src/Newtonsoft.Json.Tests/Schema/ExtensionsTests.cs index 9c135d90..c2d25ab2 100644 --- a/Src/Newtonsoft.Json.Tests/Schema/ExtensionsTests.cs +++ b/Src/Newtonsoft.Json.Tests/Schema/ExtensionsTests.cs @@ -37,6 +37,7 @@ using Newtonsoft.Json.Schema; using Newtonsoft.Json.Linq; using System.IO; using Newtonsoft.Json.Tests.TestObjects; +using Newtonsoft.Json.Tests.TestObjects.Organization; #if !(DNXCORE50) using System.Data; diff --git a/Src/Newtonsoft.Json.Tests/Schema/JsonSchemaGeneratorTests.cs b/Src/Newtonsoft.Json.Tests/Schema/JsonSchemaGeneratorTests.cs index 6a39a70c..e820434e 100644 --- a/Src/Newtonsoft.Json.Tests/Schema/JsonSchemaGeneratorTests.cs +++ b/Src/Newtonsoft.Json.Tests/Schema/JsonSchemaGeneratorTests.cs @@ -31,6 +31,7 @@ using System.Globalization; using Newtonsoft.Json.Converters; using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Tests.TestObjects; +using Newtonsoft.Json.Tests.TestObjects.Organization; using Newtonsoft.Json.Utilities; #if DNXCORE50 using Xunit; diff --git a/Src/Newtonsoft.Json.Tests/Serialization/CamelCaseNamingStrategyTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/CamelCaseNamingStrategyTests.cs index 563f5cff..ee13c53d 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/CamelCaseNamingStrategyTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/CamelCaseNamingStrategyTests.cs @@ -34,6 +34,7 @@ using Assert = Newtonsoft.Json.Tests.XUnitAssert; using NUnit.Framework; #endif using Newtonsoft.Json.Tests.TestObjects; +using Newtonsoft.Json.Tests.TestObjects.Organization; using Newtonsoft.Json.Linq; using System.Reflection; using Newtonsoft.Json.Utilities; diff --git a/Src/Newtonsoft.Json.Tests/Serialization/CamelCasePropertyNamesContractResolverTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/CamelCasePropertyNamesContractResolverTests.cs index 119fc123..8f5bc406 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/CamelCasePropertyNamesContractResolverTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/CamelCasePropertyNamesContractResolverTests.cs @@ -34,6 +34,7 @@ using Assert = Newtonsoft.Json.Tests.XUnitAssert; using NUnit.Framework; #endif using Newtonsoft.Json.Tests.TestObjects; +using Newtonsoft.Json.Tests.TestObjects.Organization; using Newtonsoft.Json.Linq; using System.Reflection; using Newtonsoft.Json.Utilities; diff --git a/Src/Newtonsoft.Json.Tests/Serialization/ContractResolverTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/ContractResolverTests.cs index 516a56f3..249b8775 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/ContractResolverTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/ContractResolverTests.cs @@ -42,6 +42,7 @@ using System.Linq; #endif using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Tests.TestObjects; +using Newtonsoft.Json.Tests.TestObjects.Organization; using System.Reflection; using Newtonsoft.Json.Utilities; using System.Globalization; diff --git a/Src/Newtonsoft.Json.Tests/Serialization/DependencyInjectionTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/DependencyInjectionTests.cs index c899d347..06306b76 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/DependencyInjectionTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/DependencyInjectionTests.cs @@ -36,6 +36,7 @@ using System.Threading.Tasks; using Autofac.Core; using Autofac.Core.Activators.Reflection; using Microsoft.FSharp.Collections; +using Newtonsoft.Json.Tests.TestObjects.Organization; #if DNXCORE50 using Xunit; using Test = Xunit.FactAttribute; diff --git a/Src/Newtonsoft.Json.Tests/Serialization/ExtensionDataTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/ExtensionDataTests.cs index 5d3467ee..8b3b79a8 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/ExtensionDataTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/ExtensionDataTests.cs @@ -29,6 +29,7 @@ using System.IO; using System.Text; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Tests.TestObjects; +using Newtonsoft.Json.Tests.TestObjects.Organization; #if DNXCORE50 using Xunit; using Test = Xunit.FactAttribute; @@ -606,7 +607,7 @@ namespace Newtonsoft.Json.Tests.Serialization ""Name"": ""Name!"", ""Test"": 1, ""Self"": { - ""$type"": ""Newtonsoft.Json.Tests.TestObjects.WagePerson, Newtonsoft.Json.Tests"", + ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Organization.WagePerson, Newtonsoft.Json.Tests"", ""HourlyWage"": 2.0, ""Name"": null, ""BirthDate"": ""0001-01-01T00:00:00"", @@ -634,7 +635,7 @@ namespace Newtonsoft.Json.Tests.Serialization ""Name"": ""Name!"", ""Test"": 1, ""Self"": { - ""$type"": ""Newtonsoft.Json.Tests.TestObjects.WagePerson, Newtonsoft.Json.Tests"", + ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Organization.WagePerson, Newtonsoft.Json.Tests"", ""HourlyWage"": 2.0, ""Name"": null, ""BirthDate"": ""0001-01-01T00:00:00"", @@ -681,7 +682,7 @@ namespace Newtonsoft.Json.Tests.Serialization ""$type"": ""Newtonsoft.Json.Tests.Serialization.ExtensionDataTests+PublicExtensionDataAttributeTestClass, Newtonsoft.Json.Tests"", ""Name"": ""Name!"", ""Test"": { - ""$type"": ""Newtonsoft.Json.Tests.TestObjects.WagePerson, Newtonsoft.Json.Tests"", + ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Organization.WagePerson, Newtonsoft.Json.Tests"", ""HourlyWage"": 2.1, ""Name"": null, ""BirthDate"": ""0001-01-01T00:00:00"", diff --git a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerCollectionsTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerCollectionsTests.cs index 1a95b3c4..c1008172 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerCollectionsTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerCollectionsTests.cs @@ -40,9 +40,12 @@ using Newtonsoft.Json.Utilities.LinqBridge; using System.Linq; #endif using System.Text; +using System.Xml; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Tests.TestObjects; +using Newtonsoft.Json.Tests.TestObjects.Events; +using Newtonsoft.Json.Tests.TestObjects.Organization; using Newtonsoft.Json.Utilities; #if DNXCORE50 using Xunit; @@ -1562,17 +1565,17 @@ namespace Newtonsoft.Json.Tests.Serialization ""$type"": """ + ReflectionUtils.GetTypeName(typeof(List), 0, DefaultSerializationBinder.Instance) + @""", ""$values"": [ { - ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Event1[,], Newtonsoft.Json.Tests"", + ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Events.Event1[,], Newtonsoft.Json.Tests"", ""$values"": [ [ { - ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Event1, Newtonsoft.Json.Tests"", + ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Events.Event1, Newtonsoft.Json.Tests"", ""EventName"": ""EventName!"", ""Venue"": null, ""Performances"": null }, { - ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Event1, Newtonsoft.Json.Tests"", + ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Events.Event1, Newtonsoft.Json.Tests"", ""EventName"": ""EventName!"", ""Venue"": null, ""Performances"": null @@ -1580,13 +1583,13 @@ namespace Newtonsoft.Json.Tests.Serialization ], [ { - ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Event1, Newtonsoft.Json.Tests"", + ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Events.Event1, Newtonsoft.Json.Tests"", ""EventName"": ""EventName!"", ""Venue"": null, ""Performances"": null }, { - ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Event1, Newtonsoft.Json.Tests"", + ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Events.Event1, Newtonsoft.Json.Tests"", ""EventName"": ""EventName!"", ""Venue"": null, ""Performances"": null @@ -1595,17 +1598,17 @@ namespace Newtonsoft.Json.Tests.Serialization ] }, { - ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Event1[,], Newtonsoft.Json.Tests"", + ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Events.Event1[,], Newtonsoft.Json.Tests"", ""$values"": [ [ { - ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Event1, Newtonsoft.Json.Tests"", + ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Events.Event1, Newtonsoft.Json.Tests"", ""EventName"": ""EventName!"", ""Venue"": null, ""Performances"": null }, { - ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Event1, Newtonsoft.Json.Tests"", + ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Events.Event1, Newtonsoft.Json.Tests"", ""EventName"": ""EventName!"", ""Venue"": null, ""Performances"": null @@ -1613,13 +1616,13 @@ namespace Newtonsoft.Json.Tests.Serialization ], [ { - ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Event1, Newtonsoft.Json.Tests"", + ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Events.Event1, Newtonsoft.Json.Tests"", ""EventName"": ""EventName!"", ""Venue"": null, ""Performances"": null }, { - ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Event1, Newtonsoft.Json.Tests"", + ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Events.Event1, Newtonsoft.Json.Tests"", ""EventName"": ""EventName!"", ""Venue"": null, ""Performances"": null diff --git a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs index f945b971..ee3302b0 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs @@ -65,6 +65,9 @@ using System.Runtime.Serialization.Json; using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Tests.Linq; using Newtonsoft.Json.Tests.TestObjects; +using Newtonsoft.Json.Tests.TestObjects.Events; +using Newtonsoft.Json.Tests.TestObjects.GeoCoding; +using Newtonsoft.Json.Tests.TestObjects.Organization; using System.Runtime.Serialization; using System.Globalization; using Newtonsoft.Json.Utilities; @@ -3862,7 +3865,7 @@ keyword such as type of business."" { string json = @"{""sublocation"":""AlertEmailSender.Program.Main"",""userId"":0,""type"":0,""summary"":""Loading settings variables"",""details"":null,""stackTrace"":"" at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)\r\n at System.Environment.get_StackTrace()\r\n at mr.Logging.Event..ctor(String summary) in C:\\Projects\\MRUtils\\Logging\\Event.vb:line 71\r\n at AlertEmailSender.Program.Main(String[] args) in C:\\Projects\\AlertEmailSender\\AlertEmailSender\\Program.cs:line 25"",""tag"":null,""time"":""\/Date(1249591032026-0400)\/""}"; - ExceptionAssert.Throws(() => { JsonConvert.DeserializeObject(json); }, @"Unable to find a constructor to use for type Newtonsoft.Json.Tests.TestObjects.Event. A class should either have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute. Path 'sublocation', line 1, position 15."); + ExceptionAssert.Throws(() => { JsonConvert.DeserializeObject(json); }, @"Unable to find a constructor to use for type Newtonsoft.Json.Tests.TestObjects.Events.Event. A class should either have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute. Path 'sublocation', line 1, position 15."); } [Test] @@ -3901,7 +3904,7 @@ keyword such as type of business."" { string json = @"[]"; - ExceptionAssert.Throws(() => { JsonConvert.DeserializeObject(json); }, @"Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Newtonsoft.Json.Tests.TestObjects.Person' because the type requires a JSON object (e.g. {""name"":""value""}) to deserialize correctly. + ExceptionAssert.Throws(() => { JsonConvert.DeserializeObject(json); }, @"Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'Newtonsoft.Json.Tests.TestObjects.Organization.Person' because the type requires a JSON object (e.g. {""name"":""value""}) to deserialize correctly. To fix this error either change the JSON to a JSON object (e.g. {""name"":""value""}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array. Path '', line 1, position 1."); } @@ -3971,7 +3974,7 @@ Path '', line 1, position 1."); { string json = @"new Constructor(123)"; - ExceptionAssert.Throws(() => { JsonConvert.DeserializeObject(json); }, @"Error converting value ""Constructor"" to type 'Newtonsoft.Json.Tests.TestObjects.Person'. Path '', line 1, position 16."); + ExceptionAssert.Throws(() => { JsonConvert.DeserializeObject(json); }, @"Error converting value ""Constructor"" to type 'Newtonsoft.Json.Tests.TestObjects.Organization.Person'. Path '', line 1, position 16."); } [Test] @@ -3979,7 +3982,7 @@ Path '', line 1, position 1."); { string json = @"[new Constructor(123)]"; - ExceptionAssert.Throws(() => { JsonConvert.DeserializeObject>(json); }, @"Error converting value ""Constructor"" to type 'Newtonsoft.Json.Tests.TestObjects.Person'. Path '[0]', line 1, position 17."); + ExceptionAssert.Throws(() => { JsonConvert.DeserializeObject>(json); }, @"Error converting value ""Constructor"" to type 'Newtonsoft.Json.Tests.TestObjects.Organization.Person'. Path '[0]', line 1, position 17."); } [Test] @@ -3994,7 +3997,7 @@ Path '', line 1, position 1."); } catch (JsonSerializationException ex) { - Assert.IsTrue(ex.Message.StartsWith(@"Cannot deserialize the current JSON object (e.g. {""name"":""value""}) into type 'System.Collections.Generic.List`1[Newtonsoft.Json.Tests.TestObjects.Person]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly." + Environment.NewLine + + Assert.IsTrue(ex.Message.StartsWith(@"Cannot deserialize the current JSON object (e.g. {""name"":""value""}) into type 'System.Collections.Generic.List`1[Newtonsoft.Json.Tests.TestObjects.Organization.Person]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly." + Environment.NewLine + @"To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object." + Environment.NewLine + @"Path ''")); } @@ -4005,7 +4008,7 @@ Path '', line 1, position 1."); { string json = @"[]"; - ExceptionAssert.Throws(() => { JsonConvert.PopulateObject(json, new Person()); }, @"Cannot populate JSON array onto type 'Newtonsoft.Json.Tests.TestObjects.Person'. Path '', line 1, position 1."); + ExceptionAssert.Throws(() => { JsonConvert.PopulateObject(json, new Person()); }, @"Cannot populate JSON array onto type 'Newtonsoft.Json.Tests.TestObjects.Organization.Person'. Path '', line 1, position 1."); } [Test] @@ -4013,7 +4016,7 @@ Path '', line 1, position 1."); { string json = @"{}"; - ExceptionAssert.Throws(() => { JsonConvert.PopulateObject(json, new List()); }, @"Cannot populate JSON object onto type 'System.Collections.Generic.List`1[Newtonsoft.Json.Tests.TestObjects.Person]'. Path '', line 1, position 2."); + ExceptionAssert.Throws(() => { JsonConvert.PopulateObject(json, new List()); }, @"Cannot populate JSON object onto type 'System.Collections.Generic.List`1[Newtonsoft.Json.Tests.TestObjects.Organization.Person]'. Path '', line 1, position 2."); } [Test] @@ -4196,8 +4199,8 @@ Path '', line 1, position 1."); string json = JsonConvert.SerializeObject(dictionary, Formatting.Indented); StringAssert.AreEqual(@"{ - ""Newtonsoft.Json.Tests.TestObjects.Person"": 1, - ""Newtonsoft.Json.Tests.TestObjects.Person"": 2 + ""Newtonsoft.Json.Tests.TestObjects.Organization.Person"": 1, + ""Newtonsoft.Json.Tests.TestObjects.Organization.Person"": 2 }", json); } @@ -4208,8 +4211,8 @@ Path '', line 1, position 1."); { string json = @"{ - ""Newtonsoft.Json.Tests.TestObjects.Person"": 1, - ""Newtonsoft.Json.Tests.TestObjects.Person"": 2 + ""Newtonsoft.Json.Tests.TestObjects.Organization.Person"": 1, + ""Newtonsoft.Json.Tests.TestObjects.Organization.Person"": 2 }"; JsonConvert.DeserializeObject>(json); @@ -4217,7 +4220,7 @@ Path '', line 1, position 1."); } catch (JsonSerializationException ex) { - Assert.IsTrue(ex.Message.StartsWith("Could not convert string 'Newtonsoft.Json.Tests.TestObjects.Person' to dictionary key type 'Newtonsoft.Json.Tests.TestObjects.Person'. Create a TypeConverter to convert from the string to the key type object. Path '['Newtonsoft.Json.Tests.TestObjects.Person']'")); + Assert.IsTrue(ex.Message.StartsWith("Could not convert string 'Newtonsoft.Json.Tests.TestObjects.Organization.Person' to dictionary key type 'Newtonsoft.Json.Tests.TestObjects.Organization.Person'. Create a TypeConverter to convert from the string to the key type object. Path '['Newtonsoft.Json.Tests.TestObjects.Organization.Person']'")); } } diff --git a/Src/Newtonsoft.Json.Tests/Serialization/MetadataPropertyHandlingTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/MetadataPropertyHandlingTests.cs index b591d752..3ecd9794 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/MetadataPropertyHandlingTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/MetadataPropertyHandlingTests.cs @@ -30,6 +30,7 @@ using System.Text; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Tests.TestObjects; +using Newtonsoft.Json.Tests.TestObjects.Organization; using Newtonsoft.Json.Utilities; #if DNXCORE50 using Xunit; diff --git a/Src/Newtonsoft.Json.Tests/Serialization/PopulateTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/PopulateTests.cs index ba2a5377..dd9a2024 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/PopulateTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/PopulateTests.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; using System.IO; using Newtonsoft.Json.Tests.TestObjects; +using Newtonsoft.Json.Tests.TestObjects.Organization; #if DNXCORE50 using Xunit; using Test = Xunit.FactAttribute; diff --git a/Src/Newtonsoft.Json.Tests/Serialization/PreserveReferencesHandlingTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/PreserveReferencesHandlingTests.cs index e63b073f..b6eda3eb 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/PreserveReferencesHandlingTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/PreserveReferencesHandlingTests.cs @@ -31,6 +31,7 @@ using System.Text; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Tests.TestObjects; +using Newtonsoft.Json.Tests.TestObjects.Organization; using Newtonsoft.Json.Utilities; #if DNXCORE50 using Xunit; diff --git a/Src/Newtonsoft.Json.Tests/Serialization/SnakeCaseNamingStrategyTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/SnakeCaseNamingStrategyTests.cs index d858b11c..d1584693 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/SnakeCaseNamingStrategyTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/SnakeCaseNamingStrategyTests.cs @@ -34,6 +34,7 @@ using Assert = Newtonsoft.Json.Tests.XUnitAssert; using NUnit.Framework; #endif using Newtonsoft.Json.Tests.TestObjects; +using Newtonsoft.Json.Tests.TestObjects.Organization; using Newtonsoft.Json.Linq; using System.Reflection; using Newtonsoft.Json.Utilities; diff --git a/Src/Newtonsoft.Json.Tests/Serialization/TraceWriterTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/TraceWriterTests.cs index bcd6532a..8326c9a0 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/TraceWriterTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/TraceWriterTests.cs @@ -20,6 +20,7 @@ using NUnit.Framework; using Newtonsoft.Json.Converters; using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Tests.TestObjects; +using Newtonsoft.Json.Tests.TestObjects.Organization; using Newtonsoft.Json.Utilities; #if NET20 using Newtonsoft.Json.Utilities.LinqBridge; @@ -710,9 +711,9 @@ Newtonsoft.Json Error: 0 : Error! TraceWriter = traceWriter }); - Assert.AreEqual("Started deserializing Newtonsoft.Json.Tests.TestObjects.Person. Path 'MissingMemberProperty', line 1, position 25.", traceWriter.TraceRecords[0].Message); - Assert.AreEqual("Could not find member 'MissingMemberProperty' on Newtonsoft.Json.Tests.TestObjects.Person. Path 'MissingMemberProperty', line 1, position 25.", traceWriter.TraceRecords[1].Message); - Assert.IsTrue(traceWriter.TraceRecords[2].Message.StartsWith("Finished deserializing Newtonsoft.Json.Tests.TestObjects.Person. Path ''")); + Assert.AreEqual("Started deserializing Newtonsoft.Json.Tests.TestObjects.Organization.Person. Path 'MissingMemberProperty', line 1, position 25.", traceWriter.TraceRecords[0].Message); + Assert.AreEqual("Could not find member 'MissingMemberProperty' on Newtonsoft.Json.Tests.TestObjects.Organization.Person. Path 'MissingMemberProperty', line 1, position 25.", traceWriter.TraceRecords[1].Message); + Assert.IsTrue(traceWriter.TraceRecords[2].Message.StartsWith("Finished deserializing Newtonsoft.Json.Tests.TestObjects.Organization.Person. Path ''")); } [Test] diff --git a/Src/Newtonsoft.Json.Tests/Serialization/TypeNameHandlingTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/TypeNameHandlingTests.cs index 6199926f..08ee8878 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/TypeNameHandlingTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/TypeNameHandlingTests.cs @@ -43,6 +43,7 @@ using System.Runtime.Serialization.Formatters; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Tests.TestObjects; +using Newtonsoft.Json.Tests.TestObjects.Organization; #if DNXCORE50 using Xunit; using Test = Xunit.FactAttribute; @@ -208,7 +209,7 @@ namespace Newtonsoft.Json.Tests.Serialization var result = sw.ToString(); StringAssert.AreEqual(@"{ - ""$type"": ""Newtonsoft.Json.Tests.TestObjects.WagePerson, Newtonsoft.Json.Tests"", + ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Organization.WagePerson, Newtonsoft.Json.Tests"", ""HourlyWage"": 0.0, ""Name"": null, ""BirthDate"": ""0001-01-01T00:00:00"", @@ -233,7 +234,7 @@ namespace Newtonsoft.Json.Tests.Serialization }); StringAssert.AreEqual(@"{ - ""$type"": ""Newtonsoft.Json.Tests.TestObjects.WagePerson, Newtonsoft.Json.Tests"", + ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Organization.WagePerson, Newtonsoft.Json.Tests"", ""HourlyWage"": 0.0, ""Name"": null, ""BirthDate"": ""0001-01-01T00:00:00"", @@ -250,7 +251,7 @@ namespace Newtonsoft.Json.Tests.Serialization }); StringAssert.AreEqual(@"{ - ""$type"": ""Newtonsoft.Json.Tests.TestObjects.WagePerson, Newtonsoft.Json.Tests"", + ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Organization.WagePerson, Newtonsoft.Json.Tests"", ""HourlyWage"": 0.0, ""Name"": null, ""BirthDate"": ""0001-01-01T00:00:00"", @@ -266,7 +267,7 @@ namespace Newtonsoft.Json.Tests.Serialization TypeNameHandling = TypeNameHandling.Auto }); - StringAssert.AreEqual(@"{""$type"":""Newtonsoft.Json.Tests.TestObjects.WagePerson, Newtonsoft.Json.Tests"",""HourlyWage"":0.0,""Name"":null,""BirthDate"":""0001-01-01T00:00:00"",""LastModified"":""0001-01-01T00:00:00""}", json); + StringAssert.AreEqual(@"{""$type"":""Newtonsoft.Json.Tests.TestObjects.Organization.WagePerson, Newtonsoft.Json.Tests"",""HourlyWage"":0.0,""Name"":null,""BirthDate"":""0001-01-01T00:00:00"",""LastModified"":""0001-01-01T00:00:00""}", json); } public class Wrapper @@ -1381,7 +1382,7 @@ namespace Newtonsoft.Json.Tests.Serialization ""MyProperty"": 0 }, { - ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Employee, Newtonsoft.Json.Tests"", + ""$type"": ""Newtonsoft.Json.Tests.TestObjects.Organization.Employee, Newtonsoft.Json.Tests"", ""FirstName"": null, ""LastName"": null, ""BirthDate"": ""2000-12-12T12:12:12Z"", diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/ConsoleWriter.cs b/Src/Newtonsoft.Json.Tests/TestObjects/ConsoleWriter.cs new file mode 100644 index 00000000..6807dbbb --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/ConsoleWriter.cs @@ -0,0 +1,50 @@ +#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.ComponentModel; + +namespace Newtonsoft.Json.Tests.TestObjects +{ +#if !(NET35 || NET20 || PORTABLE || PORTABLE40) + [TypeConverter(typeof(MyInterfaceConverter))] + internal class ConsoleWriter : IMyInterface + { + public string Name + { + get { return "Console Writer"; } + } + + public string PrintTest() + { + return "ConsoleWriter"; + } + + public override string ToString() + { + return Name; + } + } +#endif +} diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/DerivedSerializationEventTestObject.cs b/Src/Newtonsoft.Json.Tests/TestObjects/DerivedSerializationEventTestObject.cs new file mode 100644 index 00000000..9bf09f8d --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/DerivedSerializationEventTestObject.cs @@ -0,0 +1,66 @@ +#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.Runtime.Serialization; +using Newtonsoft.Json.Serialization; + +namespace Newtonsoft.Json.Tests.TestObjects +{ + public class DerivedSerializationEventTestObject : SerializationEventTestObject + { + // This field is set to null, but populated after deserialization, only + // in the derived class + [JsonIgnore] + public string Member7 { get; set; } + + // These empty methods exist to make sure we're not covering up the base + // methods + [OnSerializing] + internal void OnDerivedSerializingMethod(StreamingContext context) + { + } + + [OnSerialized] + internal void OnDerivedSerializedMethod(StreamingContext context) + { + } + + [OnDeserializing] + internal void OnDerivedDeserializingMethod(StreamingContext context) + { + } + + [OnDeserialized] + internal void OnDerivedDeserializedMethod(StreamingContext context) + { + Member7 = "This value was set after deserialization."; + } + + [OnError] + internal void OnDerivedErrorMethod(StreamingContext context, ErrorContext errorContext) + { + } + } +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/Event.cs b/Src/Newtonsoft.Json.Tests/TestObjects/Events/Event.cs similarity index 93% rename from Src/Newtonsoft.Json.Tests/TestObjects/Event.cs rename to Src/Newtonsoft.Json.Tests/TestObjects/Events/Event.cs index 9486d555..e9dbabfe 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/Event.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/Events/Event.cs @@ -25,20 +25,8 @@ using System; -namespace Newtonsoft.Json.Tests.TestObjects +namespace Newtonsoft.Json.Tests.TestObjects.Events { - /// - /// What types of events are there? Just sticking to a basic set of four for now. - /// - /// - public enum EventType - { - Debug = 0, - Info = 1, - Warning = 2, - Error = 3 - } - public sealed class Event { /// diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/Event1.cs b/Src/Newtonsoft.Json.Tests/TestObjects/Events/Event1.cs similarity index 96% rename from Src/Newtonsoft.Json.Tests/TestObjects/Event1.cs rename to Src/Newtonsoft.Json.Tests/TestObjects/Events/Event1.cs index ddd78f39..c3709e86 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/Event1.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/Events/Event1.cs @@ -27,7 +27,7 @@ using System; using System.Collections.Generic; using Newtonsoft.Json.Converters; -namespace Newtonsoft.Json.Tests.TestObjects +namespace Newtonsoft.Json.Tests.TestObjects.Events { public class Event1 { diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/Events/EventType.cs b/Src/Newtonsoft.Json.Tests/TestObjects/Events/EventType.cs new file mode 100644 index 00000000..f50ef901 --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/Events/EventType.cs @@ -0,0 +1,39 @@ +#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 + +namespace Newtonsoft.Json.Tests.TestObjects.Events +{ + /// + /// What types of events are there? Just sticking to a basic set of four for now. + /// + /// + public enum EventType + { + Debug = 0, + Info = 1, + Warning = 2, + Error = 3 + } +} diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/AddressDetails.cs b/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/AddressDetails.cs new file mode 100644 index 00000000..f0e2a8e0 --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/AddressDetails.cs @@ -0,0 +1,33 @@ +#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 + +namespace Newtonsoft.Json.Tests.TestObjects.GeoCoding +{ + public class AddressDetails + { + public int Accuracy; + public Country Country; + } +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/AdministrativeArea.cs b/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/AdministrativeArea.cs new file mode 100644 index 00000000..1d7ceabc --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/AdministrativeArea.cs @@ -0,0 +1,33 @@ +#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 + +namespace Newtonsoft.Json.Tests.TestObjects.GeoCoding +{ + public class AdministrativeArea + { + public string AdministrativeAreaName; + public SubAdministrativeArea SubAdministrativeArea; + } +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/Country.cs b/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/Country.cs new file mode 100644 index 00000000..989558e5 --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/Country.cs @@ -0,0 +1,33 @@ +#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 + +namespace Newtonsoft.Json.Tests.TestObjects.GeoCoding +{ + public class Country + { + public string CountryNameCode; + public AdministrativeArea AdministrativeArea; + } +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/GoogleMapGeocoderStructure.cs b/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/GoogleMapGeocoderStructure.cs similarity index 52% rename from Src/Newtonsoft.Json.Tests/TestObjects/GoogleMapGeocoderStructure.cs rename to Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/GoogleMapGeocoderStructure.cs index 23242893..d9c4915a 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/GoogleMapGeocoderStructure.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/GoogleMapGeocoderStructure.cs @@ -25,7 +25,7 @@ using System.Collections.Generic; -namespace Newtonsoft.Json.Tests.TestObjects +namespace Newtonsoft.Json.Tests.TestObjects.GeoCoding { public class GoogleMapGeocoderStructure { @@ -33,63 +33,4 @@ namespace Newtonsoft.Json.Tests.TestObjects public Status Status; public List Placemark; } - - public class Status - { - public string Request; - public string Code; - } - - public class Placemark - { - public string Address; - public AddressDetails AddressDetails; - public Point Point; - } - - public class AddressDetails - { - public int Accuracy; - public Country Country; - } - - public class Country - { - public string CountryNameCode; - public AdministrativeArea AdministrativeArea; - } - - public class AdministrativeArea - { - public string AdministrativeAreaName; - public SubAdministrativeArea SubAdministrativeArea; - } - - public class SubAdministrativeArea - { - public string SubAdministrativeAreaName; - public Locality Locality; - } - - public class Locality - { - public string LocalityName; - public Thoroughfare Thoroughfare; - public PostalCode PostalCode; - } - - public class Thoroughfare - { - public string ThoroughfareName; - } - - public class PostalCode - { - public string PostalCodeNumber; - } - - public class Point - { - public List Coordinates; - } } \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/Locality.cs b/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/Locality.cs new file mode 100644 index 00000000..912f5310 --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/Locality.cs @@ -0,0 +1,34 @@ +#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 + +namespace Newtonsoft.Json.Tests.TestObjects.GeoCoding +{ + public class Locality + { + public string LocalityName; + public Thoroughfare Thoroughfare; + public PostalCode PostalCode; + } +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/Placemark.cs b/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/Placemark.cs new file mode 100644 index 00000000..582fc3de --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/Placemark.cs @@ -0,0 +1,34 @@ +#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 + +namespace Newtonsoft.Json.Tests.TestObjects.GeoCoding +{ + public class Placemark + { + public string Address; + public AddressDetails AddressDetails; + public Point Point; + } +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/Point.cs b/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/Point.cs new file mode 100644 index 00000000..8d03cf13 --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/Point.cs @@ -0,0 +1,34 @@ +#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.Collections.Generic; + +namespace Newtonsoft.Json.Tests.TestObjects.GeoCoding +{ + public class Point + { + public List Coordinates; + } +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/PostalCode.cs b/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/PostalCode.cs new file mode 100644 index 00000000..7467e20f --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/PostalCode.cs @@ -0,0 +1,32 @@ +#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 + +namespace Newtonsoft.Json.Tests.TestObjects.GeoCoding +{ + public class PostalCode + { + public string PostalCodeNumber; + } +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/Status.cs b/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/Status.cs new file mode 100644 index 00000000..551214c4 --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/Status.cs @@ -0,0 +1,33 @@ +#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 + +namespace Newtonsoft.Json.Tests.TestObjects.GeoCoding +{ + public class Status + { + public string Request; + public string Code; + } +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/SubAdministrativeArea.cs b/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/SubAdministrativeArea.cs new file mode 100644 index 00000000..bda9407a --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/SubAdministrativeArea.cs @@ -0,0 +1,33 @@ +#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 + +namespace Newtonsoft.Json.Tests.TestObjects.GeoCoding +{ + public class SubAdministrativeArea + { + public string SubAdministrativeAreaName; + public Locality Locality; + } +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/Thoroughfare.cs b/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/Thoroughfare.cs new file mode 100644 index 00000000..d8ee9ab5 --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/GeoCoding/Thoroughfare.cs @@ -0,0 +1,32 @@ +#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 + +namespace Newtonsoft.Json.Tests.TestObjects.GeoCoding +{ + public class Thoroughfare + { + public string ThoroughfareName; + } +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/Shape.cs b/Src/Newtonsoft.Json.Tests/TestObjects/GeometricForms/Shape.cs similarity index 94% rename from Src/Newtonsoft.Json.Tests/TestObjects/Shape.cs rename to Src/Newtonsoft.Json.Tests/TestObjects/GeometricForms/Shape.cs index cf508a3c..82350e0e 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/Shape.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/GeometricForms/Shape.cs @@ -25,16 +25,11 @@ #if !(NET35 || NET20 || DNXCORE50) using System; -using System.Collections; -using System.Collections.Generic; using System.Diagnostics; -using System.Linq; using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; using Microsoft.FSharp.Core; -namespace Newtonsoft.Json.Tests.TestObjects +namespace Newtonsoft.Json.Tests.TestObjects.GeometricForms { [Serializable, DebuggerDisplay("{__DebugDisplay(),nq}"), CompilationMapping(SourceConstructFlags.SumType)] public class Shape @@ -212,15 +207,6 @@ namespace Newtonsoft.Json.Tests.TestObjects get { return this._width; } } } - - public static class Tags - { - // Fields - public const int Circle = 1; - public const int Empty = 3; - public const int Prism = 2; - public const int Rectangle = 0; - } } } diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/GeometricForms/Tags.cs b/Src/Newtonsoft.Json.Tests/TestObjects/GeometricForms/Tags.cs new file mode 100644 index 00000000..2e2d690e --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/GeometricForms/Tags.cs @@ -0,0 +1,38 @@ +#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 + +#if !(NET35 || NET20 || DNXCORE50) +namespace Newtonsoft.Json.Tests.TestObjects.GeometricForms +{ + public static class Tags + { + // Fields + public const int Circle = 1; + public const int Empty = 3; + public const int Prism = 2; + public const int Rectangle = 0; + } +} +#endif \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/IMyInterface.cs b/Src/Newtonsoft.Json.Tests/TestObjects/IMyInterface.cs index 1a3f7e57..4d72a87f 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/IMyInterface.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/IMyInterface.cs @@ -23,18 +23,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -using System; -using System.Collections.Generic; using System.ComponentModel; -using System.Globalization; -using System.Text; -using System.Reflection; -#if NET20 -using Newtonsoft.Json.Utilities.LinqBridge; -#else -using System.Linq; -#endif -using Newtonsoft.Json.Utilities; namespace Newtonsoft.Json.Tests.TestObjects { @@ -46,120 +35,5 @@ namespace Newtonsoft.Json.Tests.TestObjects string PrintTest(); } - - internal class MyInterfaceConverter : TypeConverter - { - private readonly List _writers = new List - { - new ConsoleWriter(), - new TraceWriter() - }; - - public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) - { - return destinationType == typeof(string); - } - - public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) - { - return sourceType == typeof(string); - } - - public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) - { - if (value == null) - { - return null; - } - - return (from w in _writers where w.Name == value.ToString() select w).FirstOrDefault(); - } - - public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, - Type destinationType) - { - if (value == null) - { - return null; - } - return ((IMyInterface)value).Name; - } - } - - [TypeConverter(typeof(MyInterfaceConverter))] - internal class ConsoleWriter : IMyInterface - { - public string Name - { - get { return "Console Writer"; } - } - - public string PrintTest() - { - return "ConsoleWriter"; - } - - public override string ToString() - { - return Name; - } - } - - internal class TraceWriter : IMyInterface - { - public string Name - { - get { return "Trace Writer"; } - } - - public override string ToString() - { - return Name; - } - - public string PrintTest() - { - return "TraceWriter"; - } - } - - internal class TypeConverterJsonConverter : JsonConverter - { - private TypeConverter GetConverter(Type type) - { - var converters = ReflectionUtils.GetAttributes(type, typeof(TypeConverterAttribute), true).Union( - from t in type.GetInterfaces() - from c in ReflectionUtils.GetAttributes(t, typeof(TypeConverterAttribute), true) - select c).Distinct(); - - return - (from c in converters - let converter = - (TypeConverter)Activator.CreateInstance(Type.GetType(((TypeConverterAttribute)c).ConverterTypeName)) - where converter.CanConvertFrom(typeof(string)) - && converter.CanConvertTo(typeof(string)) - select converter) - .FirstOrDefault(); - } - - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - var converter = GetConverter(value.GetType()); - var text = converter.ConvertToInvariantString(value); - - writer.WriteValue(text); - } - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - var converter = GetConverter(objectType); - return converter.ConvertFromInvariantString(reader.Value.ToString()); - } - - public override bool CanConvert(Type objectType) - { - return GetConverter(objectType) != null; - } - } #endif } \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/Currency.cs b/Src/Newtonsoft.Json.Tests/TestObjects/Money/Currency.cs similarity index 94% rename from Src/Newtonsoft.Json.Tests/TestObjects/Currency.cs rename to Src/Newtonsoft.Json.Tests/TestObjects/Money/Currency.cs index 9c6af0f7..3e2ad1a0 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/Currency.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/Money/Currency.cs @@ -24,13 +24,12 @@ #endregion #if !(NET35 || NET20 || DNXCORE50) -using Microsoft.FSharp.Core; using System; -using System.Collections; using System.Diagnostics; using System.Runtime.CompilerServices; +using Microsoft.FSharp.Core; -namespace Newtonsoft.Json.Tests.TestObjects +namespace Newtonsoft.Json.Tests.TestObjects.Money { [Serializable, DebuggerDisplay("{__DebugDisplay(),nq}"), CompilationMapping(SourceConstructFlags.SumType)] public class Currency @@ -158,17 +157,6 @@ namespace Newtonsoft.Json.Tests.TestObjects [CompilationMapping(SourceConstructFlags.UnionCase, 3)] get { return _unique_USD; } } - - public static class Tags - { - public const int AUD = 1; - public const int EUR = 4; - public const int JPY = 5; - public const int LocalCurrency = 0; - public const int NZD = 2; - public const int USD = 3; - } } } - #endif \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/Money/Tags.cs b/Src/Newtonsoft.Json.Tests/TestObjects/Money/Tags.cs new file mode 100644 index 00000000..ea52309d --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/Money/Tags.cs @@ -0,0 +1,40 @@ +#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 + +#if !(NET35 || NET20 || DNXCORE50) + +namespace Newtonsoft.Json.Tests.TestObjects.Money +{ + public static class Tags + { + public const int AUD = 1; + public const int EUR = 4; + public const int JPY = 5; + public const int LocalCurrency = 0; + public const int NZD = 2; + public const int USD = 3; + } +} +#endif \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/MyEnum.cs b/Src/Newtonsoft.Json.Tests/TestObjects/MyEnum.cs new file mode 100644 index 00000000..4832910d --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/MyEnum.cs @@ -0,0 +1,34 @@ +#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 + +namespace Newtonsoft.Json.Tests.TestObjects +{ + public enum MyEnum + { + Value1, + Value2, + Value3 + } +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/MyInterfaceConverter.cs b/Src/Newtonsoft.Json.Tests/TestObjects/MyInterfaceConverter.cs new file mode 100644 index 00000000..7994dd7b --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/MyInterfaceConverter.cs @@ -0,0 +1,78 @@ +#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.ComponentModel; +using System.Globalization; +#if NET20 +using Newtonsoft.Json.Utilities.LinqBridge; +#else +using System.Linq; +#endif + +namespace Newtonsoft.Json.Tests.TestObjects +{ +#if !(NET35 || NET20 || PORTABLE || PORTABLE40) + internal class MyInterfaceConverter : TypeConverter + { + private readonly List _writers = new List + { + new ConsoleWriter(), + new TraceWriter() + }; + + public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) + { + return destinationType == typeof(string); + } + + public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + { + return sourceType == typeof(string); + } + + public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) + { + if (value == null) + { + return null; + } + + return (from w in _writers where w.Name == value.ToString() select w).FirstOrDefault(); + } + + public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, + Type destinationType) + { + if (value == null) + { + return null; + } + return ((IMyInterface)value).Name; + } + } +#endif +} diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/NameContainer.cs b/Src/Newtonsoft.Json.Tests/TestObjects/NameContainer.cs new file mode 100644 index 00000000..ba1a9a66 --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/NameContainer.cs @@ -0,0 +1,32 @@ +#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 + +namespace Newtonsoft.Json.Tests.TestObjects +{ + public class NameContainer + { + public string Value { get; set; } + } +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/NameContainerConverter.cs b/Src/Newtonsoft.Json.Tests/TestObjects/NameContainerConverter.cs new file mode 100644 index 00000000..4c20b9c8 --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/NameContainerConverter.cs @@ -0,0 +1,59 @@ +#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; + +namespace Newtonsoft.Json.Tests.TestObjects +{ + public class NameContainerConverter : JsonConverter + { + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + NameContainer nameContainer = value as NameContainer; + + if (nameContainer != null) + { + writer.WriteValue(nameContainer.Value); + } + else + { + writer.WriteNull(); + } + } + + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + NameContainer nameContainer = new NameContainer(); + nameContainer.Value = (string)reader.Value; + + return nameContainer; + } + + public override bool CanConvert(Type objectType) + { + return objectType == typeof(NameContainer); + } + } +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/Organization/Employee.cs b/Src/Newtonsoft.Json.Tests/TestObjects/Organization/Employee.cs new file mode 100644 index 00000000..722aa35f --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/Organization/Employee.cs @@ -0,0 +1,39 @@ +#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; + +namespace Newtonsoft.Json.Tests.TestObjects.Organization +{ + public class Employee : IPerson + { + public string FirstName { get; set; } + public string LastName { get; set; } + public DateTime BirthDate { get; set; } + + public string Department { get; set; } + public string JobTitle { get; set; } + } +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/Organization/IPerson.cs b/Src/Newtonsoft.Json.Tests/TestObjects/Organization/IPerson.cs new file mode 100644 index 00000000..002606fa --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/Organization/IPerson.cs @@ -0,0 +1,36 @@ +#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; + +namespace Newtonsoft.Json.Tests.TestObjects.Organization +{ + public interface IPerson + { + string FirstName { get; set; } + string LastName { get; set; } + DateTime BirthDate { get; set; } + } +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/Organization/Manager.cs b/Src/Newtonsoft.Json.Tests/TestObjects/Organization/Manager.cs new file mode 100644 index 00000000..a143dd8b --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/Organization/Manager.cs @@ -0,0 +1,34 @@ +#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.Collections.Generic; + +namespace Newtonsoft.Json.Tests.TestObjects.Organization +{ + public class Manager : Employee + { + public IList Employees { get; set; } + } +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/Person.cs b/Src/Newtonsoft.Json.Tests/TestObjects/Organization/Person.cs similarity index 75% rename from Src/Newtonsoft.Json.Tests/TestObjects/Person.cs rename to Src/Newtonsoft.Json.Tests/TestObjects/Organization/Person.cs index b92f9aa8..25b80612 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/Person.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/Organization/Person.cs @@ -24,11 +24,9 @@ #endregion using System; -using System.Collections; -using System.Collections.Generic; using System.ComponentModel; -namespace Newtonsoft.Json.Tests.TestObjects +namespace Newtonsoft.Json.Tests.TestObjects.Organization { [JsonObject(Id = "Person", Title = "Title!", Description = "JsonObjectAttribute description!", MemberSerialization = MemberSerialization.OptIn)] #if !(DNXCORE50) @@ -53,26 +51,4 @@ namespace Newtonsoft.Json.Tests.TestObjects // not serialized public string Department { get; set; } } - - public interface IPerson - { - string FirstName { get; set; } - string LastName { get; set; } - DateTime BirthDate { get; set; } - } - - public class Employee : IPerson - { - public string FirstName { get; set; } - public string LastName { get; set; } - public DateTime BirthDate { get; set; } - - public string Department { get; set; } - public string JobTitle { get; set; } - } - - public class Manager : Employee - { - public IList Employees { get; set; } - } } \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/PersonPropertyClass.cs b/Src/Newtonsoft.Json.Tests/TestObjects/Organization/PersonPropertyClass.cs similarity index 95% rename from Src/Newtonsoft.Json.Tests/TestObjects/PersonPropertyClass.cs rename to Src/Newtonsoft.Json.Tests/TestObjects/Organization/PersonPropertyClass.cs index f46988d0..1e58b09f 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/PersonPropertyClass.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/Organization/PersonPropertyClass.cs @@ -23,7 +23,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -namespace Newtonsoft.Json.Tests.TestObjects +namespace Newtonsoft.Json.Tests.TestObjects.Organization { public class PersonPropertyClass { diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/WagePerson.cs b/Src/Newtonsoft.Json.Tests/TestObjects/Organization/WagePerson.cs similarity index 95% rename from Src/Newtonsoft.Json.Tests/TestObjects/WagePerson.cs rename to Src/Newtonsoft.Json.Tests/TestObjects/Organization/WagePerson.cs index f4e05ce7..417cd851 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/WagePerson.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/Organization/WagePerson.cs @@ -23,7 +23,7 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -namespace Newtonsoft.Json.Tests.TestObjects +namespace Newtonsoft.Json.Tests.TestObjects.Organization { public class WagePerson : Person { diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/PublicParameterizedConstructorRequiringConverterTestClass.cs b/Src/Newtonsoft.Json.Tests/TestObjects/PublicParameterizedConstructorRequiringConverterTestClass.cs index e1e3d3eb..4a061111 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/PublicParameterizedConstructorRequiringConverterTestClass.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/PublicParameterizedConstructorRequiringConverterTestClass.cs @@ -23,45 +23,8 @@ // OTHER DEALINGS IN THE SOFTWARE. #endregion -using System; - namespace Newtonsoft.Json.Tests.TestObjects { - public class NameContainer - { - public string Value { get; set; } - } - - public class NameContainerConverter : JsonConverter - { - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - NameContainer nameContainer = value as NameContainer; - - if (nameContainer != null) - { - writer.WriteValue(nameContainer.Value); - } - else - { - writer.WriteNull(); - } - } - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - NameContainer nameContainer = new NameContainer(); - nameContainer.Value = (string)reader.Value; - - return nameContainer; - } - - public override bool CanConvert(Type objectType) - { - return objectType == typeof(NameContainer); - } - } - public class PublicParameterizedConstructorRequiringConverterTestClass { private readonly NameContainer _nameContainer; @@ -76,35 +39,4 @@ namespace Newtonsoft.Json.Tests.TestObjects get { return _nameContainer; } } } - - public class PublicParameterizedConstructorRequiringConverterWithParameterAttributeTestClass - { - private readonly NameContainer _nameContainer; - - public PublicParameterizedConstructorRequiringConverterWithParameterAttributeTestClass([JsonConverter(typeof(NameContainerConverter))] NameContainer nameParameter) - { - _nameContainer = nameParameter; - } - - public NameContainer Name - { - get { return _nameContainer; } - } - } - - public class PublicParameterizedConstructorRequiringConverterWithPropertyAttributeTestClass - { - private readonly NameContainer _nameContainer; - - public PublicParameterizedConstructorRequiringConverterWithPropertyAttributeTestClass(NameContainer name) - { - _nameContainer = name; - } - - [JsonConverter(typeof(NameContainerConverter))] - public NameContainer Name - { - get { return _nameContainer; } - } - } } \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/PublicParameterizedConstructorRequiringConverterWithParameterAttributeTestClass.cs b/Src/Newtonsoft.Json.Tests/TestObjects/PublicParameterizedConstructorRequiringConverterWithParameterAttributeTestClass.cs new file mode 100644 index 00000000..29591216 --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/PublicParameterizedConstructorRequiringConverterWithParameterAttributeTestClass.cs @@ -0,0 +1,42 @@ +#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 + +namespace Newtonsoft.Json.Tests.TestObjects +{ + public class PublicParameterizedConstructorRequiringConverterWithParameterAttributeTestClass + { + private readonly NameContainer _nameContainer; + + public PublicParameterizedConstructorRequiringConverterWithParameterAttributeTestClass([JsonConverter(typeof(NameContainerConverter))] NameContainer nameParameter) + { + _nameContainer = nameParameter; + } + + public NameContainer Name + { + get { return _nameContainer; } + } + } +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/PublicParameterizedConstructorRequiringConverterWithPropertyAttributeTestClass.cs b/Src/Newtonsoft.Json.Tests/TestObjects/PublicParameterizedConstructorRequiringConverterWithPropertyAttributeTestClass.cs new file mode 100644 index 00000000..3849b3d2 --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/PublicParameterizedConstructorRequiringConverterWithPropertyAttributeTestClass.cs @@ -0,0 +1,43 @@ +#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 + +namespace Newtonsoft.Json.Tests.TestObjects +{ + public class PublicParameterizedConstructorRequiringConverterWithPropertyAttributeTestClass + { + private readonly NameContainer _nameContainer; + + public PublicParameterizedConstructorRequiringConverterWithPropertyAttributeTestClass(NameContainer name) + { + _nameContainer = name; + } + + [JsonConverter(typeof(NameContainerConverter))] + public NameContainer Name + { + get { return _nameContainer; } + } + } +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/PublicParameterizedConstructorWithPropertyNameConflict.cs b/Src/Newtonsoft.Json.Tests/TestObjects/PublicParameterizedConstructorWithPropertyNameConflict.cs index 5bee1a6c..5371c29b 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/PublicParameterizedConstructorWithPropertyNameConflict.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/PublicParameterizedConstructorWithPropertyNameConflict.cs @@ -41,19 +41,4 @@ namespace Newtonsoft.Json.Tests.TestObjects get { return _value; } } } - - public class PublicParameterizedConstructorWithPropertyNameConflictWithAttribute - { - private readonly int _value; - - public PublicParameterizedConstructorWithPropertyNameConflictWithAttribute([JsonProperty("name")] string nameParameter) - { - _value = Convert.ToInt32(nameParameter); - } - - public int Name - { - get { return _value; } - } - } } \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/PublicParameterizedConstructorWithPropertyNameConflictWithAttribute.cs b/Src/Newtonsoft.Json.Tests/TestObjects/PublicParameterizedConstructorWithPropertyNameConflictWithAttribute.cs new file mode 100644 index 00000000..dc6f442a --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/PublicParameterizedConstructorWithPropertyNameConflictWithAttribute.cs @@ -0,0 +1,44 @@ +#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; + +namespace Newtonsoft.Json.Tests.TestObjects +{ + public class PublicParameterizedConstructorWithPropertyNameConflictWithAttribute + { + private readonly int _value; + + public PublicParameterizedConstructorWithPropertyNameConflictWithAttribute([JsonProperty("name")] string nameParameter) + { + _value = Convert.ToInt32(nameParameter); + } + + public int Name + { + get { return _value; } + } + } +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/RoleTransfer.cs b/Src/Newtonsoft.Json.Tests/TestObjects/RoleTransfer.cs index 8db468b3..552e7520 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/RoleTransfer.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/RoleTransfer.cs @@ -25,18 +25,6 @@ namespace Newtonsoft.Json.Tests.TestObjects { - public enum RoleTransferOperation - { - First, - Second - } - - public enum RoleTransferDirection - { - First, - Second - } - public class RoleTransfer { public RoleTransferOperation Operation { get; set; } //This is enum type diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/RoleTransferDirection.cs b/Src/Newtonsoft.Json.Tests/TestObjects/RoleTransferDirection.cs new file mode 100644 index 00000000..1bd66818 --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/RoleTransferDirection.cs @@ -0,0 +1,33 @@ +#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 + +namespace Newtonsoft.Json.Tests.TestObjects +{ + public enum RoleTransferDirection + { + First, + Second + } +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/RoleTransferOperation.cs b/Src/Newtonsoft.Json.Tests/TestObjects/RoleTransferOperation.cs new file mode 100644 index 00000000..f065938d --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/RoleTransferOperation.cs @@ -0,0 +1,33 @@ +#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 + +namespace Newtonsoft.Json.Tests.TestObjects +{ + public enum RoleTransferOperation + { + First, + Second + } +} \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/SerializationEventTestObject.cs b/Src/Newtonsoft.Json.Tests/TestObjects/SerializationEventTestObject.cs index 9f1371d2..49d459e9 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/SerializationEventTestObject.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/SerializationEventTestObject.cs @@ -96,40 +96,4 @@ namespace Newtonsoft.Json.Tests.TestObjects errorContext.Handled = true; } } - - public class DerivedSerializationEventTestObject : SerializationEventTestObject - { - // This field is set to null, but populated after deserialization, only - // in the derived class - [JsonIgnore] - public string Member7 { get; set; } - - // These empty methods exist to make sure we're not covering up the base - // methods - [OnSerializing] - internal void OnDerivedSerializingMethod(StreamingContext context) - { - } - - [OnSerialized] - internal void OnDerivedSerializedMethod(StreamingContext context) - { - } - - [OnDeserializing] - internal void OnDerivedDeserializingMethod(StreamingContext context) - { - } - - [OnDeserialized] - internal void OnDerivedDeserializedMethod(StreamingContext context) - { - Member7 = "This value was set after deserialization."; - } - - [OnError] - internal void OnDerivedErrorMethod(StreamingContext context, ErrorContext errorContext) - { - } - } } \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/TraceWriter.cs b/Src/Newtonsoft.Json.Tests/TestObjects/TraceWriter.cs new file mode 100644 index 00000000..17f5014a --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/TraceWriter.cs @@ -0,0 +1,47 @@ +#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 + +namespace Newtonsoft.Json.Tests.TestObjects +{ +#if !(NET35 || NET20 || PORTABLE || PORTABLE40) + internal class TraceWriter : IMyInterface + { + public string Name + { + get { return "Trace Writer"; } + } + + public override string ToString() + { + return Name; + } + + public string PrintTest() + { + return "TraceWriter"; + } + } +#endif +} diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/TypeConverterJsonConverter.cs b/Src/Newtonsoft.Json.Tests/TestObjects/TypeConverterJsonConverter.cs new file mode 100644 index 00000000..956c480c --- /dev/null +++ b/Src/Newtonsoft.Json.Tests/TestObjects/TypeConverterJsonConverter.cs @@ -0,0 +1,77 @@ +#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.ComponentModel; +#if NET20 +using Newtonsoft.Json.Utilities.LinqBridge; +#else +using System.Linq; +#endif +using Newtonsoft.Json.Utilities; + +namespace Newtonsoft.Json.Tests.TestObjects +{ +#if !(NET35 || NET20 || PORTABLE || PORTABLE40) + internal class TypeConverterJsonConverter : JsonConverter + { + private TypeConverter GetConverter(Type type) + { + var converters = ReflectionUtils.GetAttributes(type, typeof(TypeConverterAttribute), true).Union( + from t in type.GetInterfaces() + from c in ReflectionUtils.GetAttributes(t, typeof(TypeConverterAttribute), true) + select c).Distinct(); + + return + (from c in converters + let converter = + (TypeConverter)Activator.CreateInstance(Type.GetType(((TypeConverterAttribute)c).ConverterTypeName)) + where converter.CanConvertFrom(typeof(string)) + && converter.CanConvertTo(typeof(string)) + select converter) + .FirstOrDefault(); + } + + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + var converter = GetConverter(value.GetType()); + var text = converter.ConvertToInvariantString(value); + + writer.WriteValue(text); + } + + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + var converter = GetConverter(objectType); + return converter.ConvertFromInvariantString(reader.Value.ToString()); + } + + public override bool CanConvert(Type objectType) + { + return GetConverter(objectType) != null; + } + } +#endif +} diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/VersionKeyedCollection.cs b/Src/Newtonsoft.Json.Tests/TestObjects/VersionKeyedCollection.cs index 90632abe..67aae097 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/VersionKeyedCollection.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/VersionKeyedCollection.cs @@ -30,6 +30,7 @@ using System.Collections.ObjectModel; using System.Runtime.Serialization; using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Tests.TestObjects; +using Newtonsoft.Json.Tests.TestObjects.Organization; namespace Newtonsoft.Json.Tests.TestObjects { diff --git a/Src/Newtonsoft.Json.Tests/TestObjects/WithEnums.cs b/Src/Newtonsoft.Json.Tests/TestObjects/WithEnums.cs index 47ef663e..b09b5828 100644 --- a/Src/Newtonsoft.Json.Tests/TestObjects/WithEnums.cs +++ b/Src/Newtonsoft.Json.Tests/TestObjects/WithEnums.cs @@ -30,11 +30,4 @@ namespace Newtonsoft.Json.Tests.TestObjects public int Id { get; set; } public MyEnum? NullableEnum { get; set; } } - - public enum MyEnum - { - Value1, - Value2, - Value3 - } } \ No newline at end of file diff --git a/Src/Newtonsoft.Json.Tests/Utilities/DynamicReflectionDelegateFactoryTests.cs b/Src/Newtonsoft.Json.Tests/Utilities/DynamicReflectionDelegateFactoryTests.cs index 949c5c35..451de357 100644 --- a/Src/Newtonsoft.Json.Tests/Utilities/DynamicReflectionDelegateFactoryTests.cs +++ b/Src/Newtonsoft.Json.Tests/Utilities/DynamicReflectionDelegateFactoryTests.cs @@ -37,6 +37,7 @@ using NUnit.Framework; using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Utilities; using Newtonsoft.Json.Tests.TestObjects; +using Newtonsoft.Json.Tests.TestObjects.Organization; using Newtonsoft.Json.Tests.Serialization; #if NET20 using Newtonsoft.Json.Utilities.LinqBridge; @@ -103,7 +104,7 @@ namespace Newtonsoft.Json.Tests.Utilities Func setter = DynamicReflectionDelegateFactory.Instance.CreateGet(typeof(Movie).GetProperty("Name")); setter(p); - }, "Unable to cast object of type 'Newtonsoft.Json.Tests.TestObjects.Person' to type 'Newtonsoft.Json.Tests.TestObjects.Movie'."); + }, "Unable to cast object of type 'Newtonsoft.Json.Tests.TestObjects.Organization.Person' to type 'Newtonsoft.Json.Tests.TestObjects.Movie'."); } [Test] @@ -123,7 +124,7 @@ namespace Newtonsoft.Json.Tests.Utilities setter(p, "Hi"); Assert.AreEqual(p.Name, "Hi"); - }, "Unable to cast object of type 'Newtonsoft.Json.Tests.TestObjects.Person' to type 'Newtonsoft.Json.Tests.TestObjects.Movie'."); + }, "Unable to cast object of type 'Newtonsoft.Json.Tests.TestObjects.Organization.Person' to type 'Newtonsoft.Json.Tests.TestObjects.Movie'."); } [Test] diff --git a/Src/Newtonsoft.Json.Tests/Utilities/ExpressionReflectionDelegateFactoryTests.cs b/Src/Newtonsoft.Json.Tests/Utilities/ExpressionReflectionDelegateFactoryTests.cs index 1e2fcf5a..c5656b3c 100644 --- a/Src/Newtonsoft.Json.Tests/Utilities/ExpressionReflectionDelegateFactoryTests.cs +++ b/Src/Newtonsoft.Json.Tests/Utilities/ExpressionReflectionDelegateFactoryTests.cs @@ -39,6 +39,7 @@ using NUnit.Framework; using Newtonsoft.Json.Serialization; using Newtonsoft.Json.Utilities; using Newtonsoft.Json.Tests.TestObjects; +using Newtonsoft.Json.Tests.TestObjects.Organization; using Newtonsoft.Json.Tests.Serialization; namespace Newtonsoft.Json.Tests.Utilities @@ -294,7 +295,7 @@ namespace Newtonsoft.Json.Tests.Utilities }, new[] { - "Unable to cast object of type 'Newtonsoft.Json.Tests.TestObjects.Person' to type 'Newtonsoft.Json.Tests.TestObjects.Movie'.", + "Unable to cast object of type 'Newtonsoft.Json.Tests.TestObjects.Organization.Person' to type 'Newtonsoft.Json.Tests.TestObjects.Movie'.", "Cannot cast from source type to destination type." // mono }); } @@ -320,7 +321,7 @@ namespace Newtonsoft.Json.Tests.Utilities }, new[] { - "Unable to cast object of type 'Newtonsoft.Json.Tests.TestObjects.Person' to type 'Newtonsoft.Json.Tests.TestObjects.Movie'.", + "Unable to cast object of type 'Newtonsoft.Json.Tests.TestObjects.Organization.Person' to type 'Newtonsoft.Json.Tests.TestObjects.Movie'.", "Cannot cast from source type to destination type." // mono }); }