diff --git a/Src/Newtonsoft.Json.Tests/Bson/BsonWriterTests.cs b/Src/Newtonsoft.Json.Tests/Bson/BsonWriterTests.cs
index e0ca4cf6..7dc9ebf2 100644
--- a/Src/Newtonsoft.Json.Tests/Bson/BsonWriterTests.cs
+++ b/Src/Newtonsoft.Json.Tests/Bson/BsonWriterTests.cs
@@ -47,6 +47,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 c9b81b5d..d70f279a 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 NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
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 31010e1b..3b399e6b 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 NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
diff --git a/Src/Newtonsoft.Json.Tests/Linq/JObjectTests.cs b/Src/Newtonsoft.Json.Tests/Linq/JObjectTests.cs
index 753acf87..d84a940b 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 NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
diff --git a/Src/Newtonsoft.Json.Tests/Linq/LinqToJsonTest.cs b/Src/Newtonsoft.Json.Tests/Linq/LinqToJsonTest.cs
index ebd12a0b..a9ee30c2 100644
--- a/Src/Newtonsoft.Json.Tests/Linq/LinqToJsonTest.cs
+++ b/Src/Newtonsoft.Json.Tests/Linq/LinqToJsonTest.cs
@@ -42,6 +42,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 4fa4587a..07ed2716 100644
--- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj
+++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj
@@ -124,24 +124,38 @@
+
-
+
-
-
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -159,14 +173,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -178,9 +203,12 @@
+
+
+
@@ -192,10 +220,11 @@
+
+
-
@@ -253,7 +282,6 @@
-
@@ -278,12 +306,13 @@
+
+
-
diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net35.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net35.csproj
index a1f79940..fb0c88da 100644
--- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net35.csproj
+++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net35.csproj
@@ -167,21 +167,35 @@
+
-
-
- Component
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -193,8 +207,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
@@ -204,17 +230,16 @@
+
+
-
-
-
@@ -235,11 +260,13 @@
+
+
+
- TrueTrue
@@ -249,8 +276,9 @@
+
+
-
@@ -307,7 +335,6 @@
-
diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net40.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net40.csproj
index e9635d0e..7b88241e 100644
--- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net40.csproj
+++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net40.csproj
@@ -285,19 +285,35 @@
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -309,11 +325,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -324,8 +351,6 @@
-
-
@@ -348,14 +373,18 @@
+
+
+
+
+
- TrueTrue
@@ -365,8 +394,9 @@
+
+
-
@@ -423,7 +453,6 @@
-
diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable.csproj
index 2be23499..376496b0 100644
--- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable.csproj
+++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable.csproj
@@ -160,19 +160,35 @@
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -184,11 +200,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -199,8 +226,6 @@
-
-
@@ -223,20 +248,25 @@
+
+
+
+
+
-
+
+
-
@@ -293,7 +323,6 @@
-
diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable40.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable40.csproj
index 2eda8590..b140a99b 100644
--- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable40.csproj
+++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable40.csproj
@@ -164,19 +164,35 @@
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -188,11 +204,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -203,8 +230,6 @@
-
-
@@ -227,20 +252,25 @@
+
+
+
+
+
-
+
+
-
@@ -297,7 +327,6 @@
-
diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj
index 1ae55cff..c6e25668 100644
--- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj
+++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj
@@ -316,6 +316,7 @@
+
@@ -325,7 +326,19 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -337,14 +350,14 @@
-
-
+
+
-
+
@@ -371,17 +384,25 @@
+
+
+
+
+
+
+
+
-
+
-
+
@@ -399,14 +420,19 @@
+
+
+
+
+
@@ -415,7 +441,7 @@
-
+ True
@@ -427,15 +453,18 @@
+
+
+
-
+
diff --git a/Src/Newtonsoft.Json.Tests/Schema/ExtensionsTests.cs b/Src/Newtonsoft.Json.Tests/Schema/ExtensionsTests.cs
index 42acfd49..690f9d39 100644
--- a/Src/Newtonsoft.Json.Tests/Schema/ExtensionsTests.cs
+++ b/Src/Newtonsoft.Json.Tests/Schema/ExtensionsTests.cs
@@ -41,6 +41,7 @@ using Newtonsoft.Json.Schema;
using Newtonsoft.Json.Linq;
using System.IO;
using Newtonsoft.Json.Tests.TestObjects;
+using Newtonsoft.Json.Tests.TestObjects.Organization;
#if !(NETFX_CORE || DNXCORE50)
using System.Data;
diff --git a/Src/Newtonsoft.Json.Tests/Schema/JsonSchemaGeneratorTests.cs b/Src/Newtonsoft.Json.Tests/Schema/JsonSchemaGeneratorTests.cs
index e935400a..9c0152e1 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 NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
diff --git a/Src/Newtonsoft.Json.Tests/Serialization/CamelCaseNamingStrategyTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/CamelCaseNamingStrategyTests.cs
index d0822a3b..09d506a2 100644
--- a/Src/Newtonsoft.Json.Tests/Serialization/CamelCaseNamingStrategyTests.cs
+++ b/Src/Newtonsoft.Json.Tests/Serialization/CamelCaseNamingStrategyTests.cs
@@ -38,6 +38,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 0efad3e6..0bbe1844 100644
--- a/Src/Newtonsoft.Json.Tests/Serialization/CamelCasePropertyNamesContractResolverTests.cs
+++ b/Src/Newtonsoft.Json.Tests/Serialization/CamelCasePropertyNamesContractResolverTests.cs
@@ -38,6 +38,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 f0b9ed75..9f5eb359 100644
--- a/Src/Newtonsoft.Json.Tests/Serialization/ContractResolverTests.cs
+++ b/Src/Newtonsoft.Json.Tests/Serialization/ContractResolverTests.cs
@@ -46,6 +46,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 3fb8f06c..8a05b60e 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 NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
diff --git a/Src/Newtonsoft.Json.Tests/Serialization/ExtensionDataTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/ExtensionDataTests.cs
index 0a366552..1be1dddf 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 NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
@@ -610,7 +611,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"",
@@ -638,7 +639,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"",
@@ -685,7 +686,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 b0c481b8..7f95a646 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 NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
@@ -1566,17 +1569,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
@@ -1584,13 +1587,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
@@ -1599,17 +1602,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
@@ -1617,13 +1620,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 66e2cf46..997403af 100644
--- a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs
+++ b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs
@@ -69,6 +69,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;
@@ -3868,7 +3871,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]
@@ -3907,7 +3910,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.");
}
@@ -3977,7 +3980,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]
@@ -3985,7 +3988,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]
@@ -4000,7 +4003,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 ''"));
}
@@ -4011,7 +4014,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]
@@ -4019,7 +4022,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]
@@ -4202,8 +4205,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);
}
@@ -4214,8 +4217,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);
@@ -4223,7 +4226,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 2317362f..b820bc1e 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 NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
diff --git a/Src/Newtonsoft.Json.Tests/Serialization/PopulateTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/PopulateTests.cs
index 438b0676..19d243ac 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 NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
diff --git a/Src/Newtonsoft.Json.Tests/Serialization/PreserveReferencesHandlingTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/PreserveReferencesHandlingTests.cs
index 3ea9915d..da197a6b 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 NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
diff --git a/Src/Newtonsoft.Json.Tests/Serialization/SnakeCaseNamingStrategyTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/SnakeCaseNamingStrategyTests.cs
index 9c254b7d..62c165a2 100644
--- a/Src/Newtonsoft.Json.Tests/Serialization/SnakeCaseNamingStrategyTests.cs
+++ b/Src/Newtonsoft.Json.Tests/Serialization/SnakeCaseNamingStrategyTests.cs
@@ -38,6 +38,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 7619c716..157886ad 100644
--- a/Src/Newtonsoft.Json.Tests/Serialization/TraceWriterTests.cs
+++ b/Src/Newtonsoft.Json.Tests/Serialization/TraceWriterTests.cs
@@ -24,6 +24,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;
@@ -714,9 +715,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 239f3230..4a4475e3 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 NETFX_CORE
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using TestFixture = Microsoft.VisualStudio.TestPlatform.UnitTestFramework.TestClassAttribute;
@@ -212,7 +213,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"",
@@ -237,7 +238,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"",
@@ -254,7 +255,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"",
@@ -270,7 +271,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
@@ -1385,7 +1386,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 dc097338..82350e0e 100644
--- a/Src/Newtonsoft.Json.Tests/TestObjects/Shape.cs
+++ b/Src/Newtonsoft.Json.Tests/TestObjects/GeometricForms/Shape.cs
@@ -23,18 +23,13 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
-#if !(NET35 || NET20 || NETFX_CORE || DNXCORE50)
+#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 c99aaae2..4d72a87f 100644
--- a/Src/Newtonsoft.Json.Tests/TestObjects/IMyInterface.cs
+++ b/Src/Newtonsoft.Json.Tests/TestObjects/IMyInterface.cs
@@ -23,22 +23,11 @@
// 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
{
-#if !(NETFX_CORE || NET35 || NET20 || PORTABLE || PORTABLE40)
+#if !(NET35 || NET20 || PORTABLE || PORTABLE40)
[TypeConverter(typeof(MyInterfaceConverter))]
internal interface IMyInterface
{
@@ -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 93%
rename from Src/Newtonsoft.Json.Tests/TestObjects/Currency.cs
rename to Src/Newtonsoft.Json.Tests/TestObjects/Money/Currency.cs
index 0f6706c2..3e2ad1a0 100644
--- a/Src/Newtonsoft.Json.Tests/TestObjects/Currency.cs
+++ b/Src/Newtonsoft.Json.Tests/TestObjects/Money/Currency.cs
@@ -23,14 +23,13 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
-#if !(NET35 || NET20 || NETFX_CORE || DNXCORE50)
-using Microsoft.FSharp.Core;
+#if !(NET35 || NET20 || DNXCORE50)
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 74%
rename from Src/Newtonsoft.Json.Tests/TestObjects/Person.cs
rename to Src/Newtonsoft.Json.Tests/TestObjects/Organization/Person.cs
index abc6f331..25b80612 100644
--- a/Src/Newtonsoft.Json.Tests/TestObjects/Person.cs
+++ b/Src/Newtonsoft.Json.Tests/TestObjects/Organization/Person.cs
@@ -24,14 +24,12 @@
#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 !(NETFX_CORE || DNXCORE50)
+#if !(DNXCORE50)
[Description("DescriptionAttribute description!")]
#endif
public class Person
@@ -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 f11ff2cb..4791c355 100644
--- a/Src/Newtonsoft.Json.Tests/Utilities/DynamicReflectionDelegateFactoryTests.cs
+++ b/Src/Newtonsoft.Json.Tests/Utilities/DynamicReflectionDelegateFactoryTests.cs
@@ -41,6 +41,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;
@@ -107,7 +108,7 @@ namespace Newtonsoft.Json.Tests.Utilities
Func