Move more classes to files under TestObjects

This commit is contained in:
Pyit Phyo Aung
2016-10-13 12:29:26 +13:00
parent e74d6c5a4b
commit 42d6225acd
74 changed files with 1499 additions and 488 deletions
@@ -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
@@ -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);
}
@@ -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;
@@ -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
{
@@ -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;
@@ -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;
@@ -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
@@ -124,24 +124,38 @@
<Compile Include="TestObjects\Car.cs" />
<Compile Include="TestObjects\Component.cs" />
<Compile Include="TestObjects\Computer.cs" />
<Compile Include="TestObjects\ConsoleWriter.cs" />
<Compile Include="TestObjects\ConstructorReadonlyFields.cs" />
<Compile Include="TestObjects\Container.cs" />
<Compile Include="TestObjects\Content.cs" />
<Compile Include="TestObjects\ContentBaseClass.cs" />
<Compile Include="TestObjects\ContentSubClass.cs" />
<Compile Include="TestObjects\Currency.cs" />
<Compile Include="TestObjects\CustomerDataSet.cs" />
<Compile Include="TestObjects\DataContractSerializationAttributesClass.cs" />
<Compile Include="TestObjects\DateTimeWrapper.cs" />
<Compile Include="TestObjects\DecimalTestClass.cs" />
<Compile Include="TestObjects\DerivedSerializationEventTestObject.cs" />
<Compile Include="TestObjects\DictionaryInterfaceClass.cs" />
<Compile Include="Serialization\EntitiesSerializationTests.cs" />
<Compile Include="TestObjects\DirectoryAccount.cs" />
<Compile Include="TestObjects\Event.cs" />
<Compile Include="TestObjects\Event1.cs" />
<Compile Include="TestObjects\Events\Event.cs" />
<Compile Include="TestObjects\Events\Event1.cs" />
<Compile Include="TestObjects\Events\EventType.cs" />
<Compile Include="TestObjects\Foo.cs" />
<Compile Include="TestObjects\GameObject.cs" />
<Compile Include="TestObjects\GoogleMapGeocoderStructure.cs" />
<Compile Include="TestObjects\GeoCoding\AddressDetails.cs" />
<Compile Include="TestObjects\GeoCoding\AdministrativeArea.cs" />
<Compile Include="TestObjects\GeoCoding\Country.cs" />
<Compile Include="TestObjects\GeoCoding\GoogleMapGeocoderStructure.cs" />
<Compile Include="TestObjects\GeoCoding\Locality.cs" />
<Compile Include="TestObjects\GeoCoding\Placemark.cs" />
<Compile Include="TestObjects\GeoCoding\Point.cs" />
<Compile Include="TestObjects\GeoCoding\PostalCode.cs" />
<Compile Include="TestObjects\GeoCoding\Status.cs" />
<Compile Include="TestObjects\GeoCoding\SubAdministrativeArea.cs" />
<Compile Include="TestObjects\GeoCoding\Thoroughfare.cs" />
<Compile Include="TestObjects\GeometricForms\Shape.cs" />
<Compile Include="TestObjects\GeometricForms\Tags.cs" />
<Compile Include="TestObjects\HolderClass.cs" />
<Compile Include="TestObjects\IdReferenceResolver.cs" />
<Compile Include="TestObjects\IMyInterface.cs" />
@@ -159,14 +173,25 @@
<Compile Include="Serialization\MissingMemberHandlingTests.cs" />
<Compile Include="TestObjects\MetroPropertyNameResolver.cs" />
<Compile Include="TestObjects\MetroStringConverter.cs" />
<Compile Include="TestObjects\Money\Currency.cs" />
<Compile Include="TestObjects\Money\Tags.cs" />
<Compile Include="TestObjects\Movie.cs" />
<Compile Include="TestObjects\MyEnum.cs" />
<Compile Include="TestObjects\MyInterfaceConverter.cs" />
<Compile Include="TestObjects\NameContainer.cs" />
<Compile Include="TestObjects\NameContainerConverter.cs" />
<Compile Include="TestObjects\NonRequest.cs" />
<Compile Include="TestObjects\NullableGuid.cs" />
<Compile Include="TestObjects\ObjectArrayPropertyTest.cs" />
<Compile Include="Serialization\PopulateTests.cs" />
<Compile Include="TestObjects\Organization\Employee.cs" />
<Compile Include="TestObjects\Organization\IPerson.cs" />
<Compile Include="TestObjects\Organization\Manager.cs" />
<Compile Include="TestObjects\Organization\Person.cs" />
<Compile Include="TestObjects\Organization\PersonPropertyClass.cs" />
<Compile Include="TestObjects\Organization\WagePerson.cs" />
<Compile Include="TestObjects\ParticipantEntity.cs" />
<Compile Include="TestObjects\PersonError.cs" />
<Compile Include="TestObjects\PersonPropertyClass.cs" />
<Compile Include="TestObjects\PersonReference.cs" />
<Compile Include="TestObjects\PersonSerializable.cs" />
<Compile Include="TestObjects\PersonWithPrivateConstructor.cs" />
@@ -178,9 +203,12 @@
<Compile Include="TestObjects\PropertyCase.cs" />
<Compile Include="TestObjects\PropertyItemConverter.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorRequiringConverterTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorRequiringConverterWithParameterAttributeTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorRequiringConverterWithPropertyAttributeTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorWithNonPropertyParameterTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorWithPropertyNameConflict.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorWithPropertyNameConflictWithAttribute.cs" />
<Compile Include="TestObjects\Ratio.cs" />
<Compile Include="TestObjects\RequestOnly.cs" />
<Compile Include="TestObjects\RequiredObject.cs" />
@@ -192,10 +220,11 @@
<Compile Include="Schema\JsonSchemaNodeTests.cs" />
<Compile Include="Serialization\CamelCasePropertyNamesContractResolverTests.cs" />
<Compile Include="Serialization\PreserveReferencesHandlingTests.cs" />
<Compile Include="TestObjects\RoleTransferDirection.cs" />
<Compile Include="TestObjects\RoleTransferOperation.cs" />
<Compile Include="TestObjects\SearchResult.cs" />
<Compile Include="TestObjects\SelectListItem.cs" />
<Compile Include="TestObjects\SetOnlyPropertyClass2.cs" />
<Compile Include="TestObjects\Shape.cs" />
<Compile Include="TestObjects\StructTest.cs" />
<Compile Include="TestObjects\SubKlass.cs" />
<Compile Include="TestObjects\SuperKlass.cs" />
@@ -253,7 +282,6 @@
<Compile Include="TestObjects\Shortie.cs" />
<Compile Include="TestObjects\Store.cs" />
<Compile Include="TestObjects\StoreColor.cs" />
<Compile Include="TestObjects\Person.cs" />
<Compile Include="Schema\JsonSchemaBuilderTests.cs" />
<Compile Include="Schema\JsonSchemaGeneratorTests.cs" />
<Compile Include="Schema\JsonSchemaTests.cs" />
@@ -278,12 +306,13 @@
<Compile Include="TestObjects\TestComponent.cs" />
<Compile Include="TestObjects\TestComponentSimple.cs" />
<Compile Include="TestObjects\TestObject.cs" />
<Compile Include="TestObjects\TraceWriter.cs" />
<Compile Include="TestObjects\TypeClass.cs" />
<Compile Include="TestObjects\TypeConverterJsonConverter.cs" />
<Compile Include="TestObjects\TypedSubHashtable.cs" />
<Compile Include="TestObjects\UriGuidTimeSpanTestClass.cs" />
<Compile Include="TestObjects\UserNullable.cs" />
<Compile Include="TestObjects\VersionKeyedCollection.cs" />
<Compile Include="TestObjects\WagePerson.cs" />
<Compile Include="TestObjects\Widget.cs" />
<Compile Include="TestObjects\Widget1.cs" />
<Compile Include="TestObjects\WidgetId.cs" />
@@ -167,21 +167,35 @@
<Compile Include="TestObjects\Car.cs" />
<Compile Include="TestObjects\Component.cs" />
<Compile Include="TestObjects\Computer.cs" />
<Compile Include="TestObjects\ConsoleWriter.cs" />
<Compile Include="TestObjects\ConstructorReadonlyFields.cs" />
<Compile Include="TestObjects\Container.cs" />
<Compile Include="TestObjects\ContentBaseClass.cs" />
<Compile Include="TestObjects\ContentSubClass.cs" />
<Compile Include="TestObjects\Currency.cs" />
<Compile Include="TestObjects\CustomerDataSet.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="TestObjects\CustomerDataSet.cs" />
<Compile Include="TestObjects\DataContractSerializationAttributesClass.cs" />
<Compile Include="TestObjects\DateTimeWrapper.cs" />
<Compile Include="TestObjects\DecimalTestClass.cs" />
<Compile Include="TestObjects\DerivedSerializationEventTestObject.cs" />
<Compile Include="TestObjects\DirectoryAccount.cs" />
<Compile Include="TestObjects\Event1.cs" />
<Compile Include="TestObjects\Events\Event.cs" />
<Compile Include="TestObjects\Events\Event1.cs" />
<Compile Include="TestObjects\Events\EventType.cs" />
<Compile Include="TestObjects\Foo.cs" />
<Compile Include="TestObjects\GameObject.cs" />
<Compile Include="TestObjects\GeoCoding\AddressDetails.cs" />
<Compile Include="TestObjects\GeoCoding\AdministrativeArea.cs" />
<Compile Include="TestObjects\GeoCoding\Country.cs" />
<Compile Include="TestObjects\GeoCoding\GoogleMapGeocoderStructure.cs" />
<Compile Include="TestObjects\GeoCoding\Locality.cs" />
<Compile Include="TestObjects\GeoCoding\Placemark.cs" />
<Compile Include="TestObjects\GeoCoding\Point.cs" />
<Compile Include="TestObjects\GeoCoding\PostalCode.cs" />
<Compile Include="TestObjects\GeoCoding\Status.cs" />
<Compile Include="TestObjects\GeoCoding\SubAdministrativeArea.cs" />
<Compile Include="TestObjects\GeoCoding\Thoroughfare.cs" />
<Compile Include="TestObjects\GeometricForms\Shape.cs" />
<Compile Include="TestObjects\GeometricForms\Tags.cs" />
<Compile Include="TestObjects\HolderClass.cs" />
<Compile Include="TestObjects\IdReferenceResolver.cs" />
<Compile Include="TestObjects\IMyInterface.cs" />
@@ -193,8 +207,20 @@
<Compile Include="TestObjects\ListOfIds.cs" />
<Compile Include="TestObjects\MetroPropertyNameResolver.cs" />
<Compile Include="TestObjects\MetroStringConverter.cs" />
<Compile Include="TestObjects\Money\Currency.cs" />
<Compile Include="TestObjects\Money\Tags.cs" />
<Compile Include="TestObjects\Movie.cs" />
<Compile Include="TestObjects\MyEnum.cs" />
<Compile Include="TestObjects\MyInterfaceConverter.cs" />
<Compile Include="TestObjects\NameContainer.cs" />
<Compile Include="TestObjects\NameContainerConverter.cs" />
<Compile Include="TestObjects\NullableGuid.cs" />
<Compile Include="TestObjects\Organization\Employee.cs" />
<Compile Include="TestObjects\Organization\IPerson.cs" />
<Compile Include="TestObjects\Organization\Manager.cs" />
<Compile Include="TestObjects\Organization\Person.cs" />
<Compile Include="TestObjects\Organization\PersonPropertyClass.cs" />
<Compile Include="TestObjects\Organization\WagePerson.cs" />
<Compile Include="TestObjects\ParticipantEntity.cs" />
<Compile Include="TestObjects\PersonReference.cs" />
<Compile Include="TestObjects\PersonSerializable.cs" />
@@ -204,17 +230,16 @@
<Compile Include="TestObjects\PrivateImplementationBClass.cs" />
<Compile Include="TestObjects\PropertyItemConverter.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorRequiringConverterTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorRequiringConverterWithParameterAttributeTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorRequiringConverterWithPropertyAttributeTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorTestClass.cs" />
<Compile Include="TestObjects\PersonError.cs" />
<Compile Include="TestObjects\PersonPropertyClass.cs" />
<Compile Include="TestObjects\PrivateConstructorTestClass.cs" />
<Compile Include="TestObjects\PrivateConstructorWithPublicParameterizedConstructorTestClass.cs" />
<Compile Include="TestObjects\Content.cs" />
<Compile Include="TestObjects\DateTimeErrorObjectCollection.cs" />
<Compile Include="Serialization\EntitiesSerializationTests.cs" />
<Compile Include="TestObjects\DictionaryInterfaceClass.cs" />
<Compile Include="TestObjects\Event.cs" />
<Compile Include="TestObjects\GoogleMapGeocoderStructure.cs" />
<Compile Include="TestObjects\InterfacePropertyTestClass.cs" />
<Compile Include="TestObjects\JsonPropertyClass.cs" />
<Compile Include="TestObjects\ListErrorObject.cs" />
@@ -235,11 +260,13 @@
<Compile Include="TestObjects\ObjectArrayPropertyTest.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorWithNonPropertyParameterTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorWithPropertyNameConflict.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorWithPropertyNameConflictWithAttribute.cs" />
<Compile Include="TestObjects\Ratio.cs" />
<Compile Include="TestObjects\RequiredObject.cs" />
<Compile Include="TestObjects\RoleTransferDirection.cs" />
<Compile Include="TestObjects\RoleTransferOperation.cs" />
<Compile Include="TestObjects\SearchResult.cs" />
<Compile Include="TestObjects\SelectListItem.cs" />
<Compile Include="TestObjects\Shape.cs" />
<Compile Include="TestObjects\SqlTypesDataSet.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
@@ -249,8 +276,9 @@
<Compile Include="TestObjects\TestComponent.cs" />
<Compile Include="TestObjects\TestComponentSimple.cs" />
<Compile Include="TestObjects\TestObject.cs" />
<Compile Include="TestObjects\TraceWriter.cs" />
<Compile Include="TestObjects\TypeConverterJsonConverter.cs" />
<Compile Include="TestObjects\UriGuidTimeSpanTestClass.cs" />
<Compile Include="TestObjects\WagePerson.cs" />
<Compile Include="TestObjects\PropertyCase.cs" />
<Compile Include="TestObjects\RequestOnly.cs" />
<Compile Include="TestObjects\RoleTransfer.cs" />
@@ -307,7 +335,6 @@
<Compile Include="TestObjects\Shortie.cs" />
<Compile Include="TestObjects\Store.cs" />
<Compile Include="TestObjects\StoreColor.cs" />
<Compile Include="TestObjects\Person.cs" />
<Compile Include="Schema\JsonSchemaBuilderTests.cs" />
<Compile Include="Schema\JsonSchemaGeneratorTests.cs" />
<Compile Include="Schema\JsonSchemaTests.cs" />
@@ -285,19 +285,35 @@
<Compile Include="TestObjects\Car.cs" />
<Compile Include="TestObjects\Component.cs" />
<Compile Include="TestObjects\Computer.cs" />
<Compile Include="TestObjects\ConsoleWriter.cs" />
<Compile Include="TestObjects\ConstructorReadonlyFields.cs" />
<Compile Include="TestObjects\Container.cs" />
<Compile Include="TestObjects\ContentBaseClass.cs" />
<Compile Include="TestObjects\ContentSubClass.cs" />
<Compile Include="TestObjects\Currency.cs" />
<Compile Include="TestObjects\CustomerDataSet.cs" />
<Compile Include="TestObjects\DataContractSerializationAttributesClass.cs" />
<Compile Include="TestObjects\DateTimeWrapper.cs" />
<Compile Include="TestObjects\DecimalTestClass.cs" />
<Compile Include="TestObjects\DerivedSerializationEventTestObject.cs" />
<Compile Include="TestObjects\DirectoryAccount.cs" />
<Compile Include="TestObjects\Event1.cs" />
<Compile Include="TestObjects\Events\Event.cs" />
<Compile Include="TestObjects\Events\Event1.cs" />
<Compile Include="TestObjects\Events\EventType.cs" />
<Compile Include="TestObjects\Foo.cs" />
<Compile Include="TestObjects\GameObject.cs" />
<Compile Include="TestObjects\GeoCoding\AddressDetails.cs" />
<Compile Include="TestObjects\GeoCoding\AdministrativeArea.cs" />
<Compile Include="TestObjects\GeoCoding\Country.cs" />
<Compile Include="TestObjects\GeoCoding\GoogleMapGeocoderStructure.cs" />
<Compile Include="TestObjects\GeoCoding\Locality.cs" />
<Compile Include="TestObjects\GeoCoding\Placemark.cs" />
<Compile Include="TestObjects\GeoCoding\Point.cs" />
<Compile Include="TestObjects\GeoCoding\PostalCode.cs" />
<Compile Include="TestObjects\GeoCoding\Status.cs" />
<Compile Include="TestObjects\GeoCoding\SubAdministrativeArea.cs" />
<Compile Include="TestObjects\GeoCoding\Thoroughfare.cs" />
<Compile Include="TestObjects\GeometricForms\Shape.cs" />
<Compile Include="TestObjects\GeometricForms\Tags.cs" />
<Compile Include="TestObjects\HolderClass.cs" />
<Compile Include="TestObjects\IdReferenceResolver.cs" />
<Compile Include="TestObjects\IMyInterface.cs" />
@@ -309,11 +325,22 @@
<Compile Include="TestObjects\ListOfIds.cs" />
<Compile Include="TestObjects\MetroPropertyNameResolver.cs" />
<Compile Include="TestObjects\MetroStringConverter.cs" />
<Compile Include="TestObjects\Money\Currency.cs" />
<Compile Include="TestObjects\Money\Tags.cs" />
<Compile Include="TestObjects\Movie.cs" />
<Compile Include="TestObjects\MyEnum.cs" />
<Compile Include="TestObjects\MyInterfaceConverter.cs" />
<Compile Include="TestObjects\NameContainer.cs" />
<Compile Include="TestObjects\NameContainerConverter.cs" />
<Compile Include="TestObjects\NullableGuid.cs" />
<Compile Include="TestObjects\Organization\Employee.cs" />
<Compile Include="TestObjects\Organization\IPerson.cs" />
<Compile Include="TestObjects\Organization\Manager.cs" />
<Compile Include="TestObjects\Organization\Person.cs" />
<Compile Include="TestObjects\Organization\PersonPropertyClass.cs" />
<Compile Include="TestObjects\Organization\WagePerson.cs" />
<Compile Include="TestObjects\ParticipantEntity.cs" />
<Compile Include="TestObjects\PersonError.cs" />
<Compile Include="TestObjects\PersonPropertyClass.cs" />
<Compile Include="TestObjects\PersonReference.cs" />
<Compile Include="TestObjects\PersonSerializable.cs" />
<Compile Include="TestObjects\PersonWithPrivateConstructor.cs" />
@@ -324,8 +351,6 @@
<Compile Include="TestObjects\DateTimeErrorObjectCollection.cs" />
<Compile Include="Serialization\EntitiesSerializationTests.cs" />
<Compile Include="TestObjects\DictionaryInterfaceClass.cs" />
<Compile Include="TestObjects\Event.cs" />
<Compile Include="TestObjects\GoogleMapGeocoderStructure.cs" />
<Compile Include="TestObjects\InterfacePropertyTestClass.cs" />
<Compile Include="TestObjects\JsonPropertyClass.cs" />
<Compile Include="TestObjects\ListErrorObject.cs" />
@@ -348,14 +373,18 @@
<Compile Include="TestObjects\PrivateImplementationBClass.cs" />
<Compile Include="TestObjects\PropertyItemConverter.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorRequiringConverterTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorRequiringConverterWithParameterAttributeTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorRequiringConverterWithPropertyAttributeTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorWithNonPropertyParameterTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorWithPropertyNameConflict.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorWithPropertyNameConflictWithAttribute.cs" />
<Compile Include="TestObjects\Ratio.cs" />
<Compile Include="TestObjects\RequiredObject.cs" />
<Compile Include="TestObjects\RoleTransferDirection.cs" />
<Compile Include="TestObjects\RoleTransferOperation.cs" />
<Compile Include="TestObjects\SearchResult.cs" />
<Compile Include="TestObjects\SelectListItem.cs" />
<Compile Include="TestObjects\Shape.cs" />
<Compile Include="TestObjects\SqlTypesDataSet.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
@@ -365,8 +394,9 @@
<Compile Include="TestObjects\TestComponent.cs" />
<Compile Include="TestObjects\TestComponentSimple.cs" />
<Compile Include="TestObjects\TestObject.cs" />
<Compile Include="TestObjects\TraceWriter.cs" />
<Compile Include="TestObjects\TypeConverterJsonConverter.cs" />
<Compile Include="TestObjects\UriGuidTimeSpanTestClass.cs" />
<Compile Include="TestObjects\WagePerson.cs" />
<Compile Include="TestObjects\PropertyCase.cs" />
<Compile Include="TestObjects\RequestOnly.cs" />
<Compile Include="TestObjects\RoleTransfer.cs" />
@@ -423,7 +453,6 @@
<Compile Include="TestObjects\Shortie.cs" />
<Compile Include="TestObjects\Store.cs" />
<Compile Include="TestObjects\StoreColor.cs" />
<Compile Include="TestObjects\Person.cs" />
<Compile Include="Schema\JsonSchemaBuilderTests.cs" />
<Compile Include="Schema\JsonSchemaGeneratorTests.cs" />
<Compile Include="Schema\JsonSchemaTests.cs" />
@@ -160,19 +160,35 @@
<Compile Include="TestObjects\Car.cs" />
<Compile Include="TestObjects\Component.cs" />
<Compile Include="TestObjects\Computer.cs" />
<Compile Include="TestObjects\ConsoleWriter.cs" />
<Compile Include="TestObjects\ConstructorReadonlyFields.cs" />
<Compile Include="TestObjects\Container.cs" />
<Compile Include="TestObjects\ContentBaseClass.cs" />
<Compile Include="TestObjects\ContentSubClass.cs" />
<Compile Include="TestObjects\Currency.cs" />
<Compile Include="TestObjects\CustomerDataSet.cs" />
<Compile Include="TestObjects\DataContractSerializationAttributesClass.cs" />
<Compile Include="TestObjects\DateTimeWrapper.cs" />
<Compile Include="TestObjects\DecimalTestClass.cs" />
<Compile Include="TestObjects\DerivedSerializationEventTestObject.cs" />
<Compile Include="TestObjects\DirectoryAccount.cs" />
<Compile Include="TestObjects\Event1.cs" />
<Compile Include="TestObjects\Events\Event.cs" />
<Compile Include="TestObjects\Events\Event1.cs" />
<Compile Include="TestObjects\Events\EventType.cs" />
<Compile Include="TestObjects\Foo.cs" />
<Compile Include="TestObjects\GameObject.cs" />
<Compile Include="TestObjects\GeoCoding\AddressDetails.cs" />
<Compile Include="TestObjects\GeoCoding\AdministrativeArea.cs" />
<Compile Include="TestObjects\GeoCoding\Country.cs" />
<Compile Include="TestObjects\GeoCoding\GoogleMapGeocoderStructure.cs" />
<Compile Include="TestObjects\GeoCoding\Locality.cs" />
<Compile Include="TestObjects\GeoCoding\Placemark.cs" />
<Compile Include="TestObjects\GeoCoding\Point.cs" />
<Compile Include="TestObjects\GeoCoding\PostalCode.cs" />
<Compile Include="TestObjects\GeoCoding\Status.cs" />
<Compile Include="TestObjects\GeoCoding\SubAdministrativeArea.cs" />
<Compile Include="TestObjects\GeoCoding\Thoroughfare.cs" />
<Compile Include="TestObjects\GeometricForms\Shape.cs" />
<Compile Include="TestObjects\GeometricForms\Tags.cs" />
<Compile Include="TestObjects\HolderClass.cs" />
<Compile Include="TestObjects\IdReferenceResolver.cs" />
<Compile Include="TestObjects\IMyInterface.cs" />
@@ -184,11 +200,22 @@
<Compile Include="TestObjects\ListOfIds.cs" />
<Compile Include="TestObjects\MetroPropertyNameResolver.cs" />
<Compile Include="TestObjects\MetroStringConverter.cs" />
<Compile Include="TestObjects\Money\Currency.cs" />
<Compile Include="TestObjects\Money\Tags.cs" />
<Compile Include="TestObjects\Movie.cs" />
<Compile Include="TestObjects\MyEnum.cs" />
<Compile Include="TestObjects\MyInterfaceConverter.cs" />
<Compile Include="TestObjects\NameContainer.cs" />
<Compile Include="TestObjects\NameContainerConverter.cs" />
<Compile Include="TestObjects\NullableGuid.cs" />
<Compile Include="TestObjects\Organization\Employee.cs" />
<Compile Include="TestObjects\Organization\IPerson.cs" />
<Compile Include="TestObjects\Organization\Manager.cs" />
<Compile Include="TestObjects\Organization\Person.cs" />
<Compile Include="TestObjects\Organization\PersonPropertyClass.cs" />
<Compile Include="TestObjects\Organization\WagePerson.cs" />
<Compile Include="TestObjects\ParticipantEntity.cs" />
<Compile Include="TestObjects\PersonError.cs" />
<Compile Include="TestObjects\PersonPropertyClass.cs" />
<Compile Include="TestObjects\PersonReference.cs" />
<Compile Include="TestObjects\PersonSerializable.cs" />
<Compile Include="TestObjects\PersonWithPrivateConstructor.cs" />
@@ -199,8 +226,6 @@
<Compile Include="TestObjects\DateTimeErrorObjectCollection.cs" />
<Compile Include="Serialization\EntitiesSerializationTests.cs" />
<Compile Include="TestObjects\DictionaryInterfaceClass.cs" />
<Compile Include="TestObjects\Event.cs" />
<Compile Include="TestObjects\GoogleMapGeocoderStructure.cs" />
<Compile Include="TestObjects\InterfacePropertyTestClass.cs" />
<Compile Include="TestObjects\JsonPropertyClass.cs" />
<Compile Include="TestObjects\ListErrorObject.cs" />
@@ -223,20 +248,25 @@
<Compile Include="TestObjects\PrivateImplementationBClass.cs" />
<Compile Include="TestObjects\PropertyItemConverter.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorRequiringConverterTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorRequiringConverterWithParameterAttributeTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorRequiringConverterWithPropertyAttributeTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorWithNonPropertyParameterTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorWithPropertyNameConflict.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorWithPropertyNameConflictWithAttribute.cs" />
<Compile Include="TestObjects\Ratio.cs" />
<Compile Include="TestObjects\RequiredObject.cs" />
<Compile Include="TestObjects\RoleTransferDirection.cs" />
<Compile Include="TestObjects\RoleTransferOperation.cs" />
<Compile Include="TestObjects\SearchResult.cs" />
<Compile Include="TestObjects\SelectListItem.cs" />
<Compile Include="TestObjects\Shape.cs" />
<Compile Include="TestObjects\StructTest.cs" />
<Compile Include="TestObjects\TestComponent.cs" />
<Compile Include="TestObjects\TestComponentSimple.cs" />
<Compile Include="TestObjects\TestObject.cs" />
<Compile Include="TestObjects\TraceWriter.cs" />
<Compile Include="TestObjects\TypeConverterJsonConverter.cs" />
<Compile Include="TestObjects\UriGuidTimeSpanTestClass.cs" />
<Compile Include="TestObjects\WagePerson.cs" />
<Compile Include="TestObjects\PropertyCase.cs" />
<Compile Include="TestObjects\RequestOnly.cs" />
<Compile Include="TestObjects\RoleTransfer.cs" />
@@ -293,7 +323,6 @@
<Compile Include="TestObjects\Shortie.cs" />
<Compile Include="TestObjects\Store.cs" />
<Compile Include="TestObjects\StoreColor.cs" />
<Compile Include="TestObjects\Person.cs" />
<Compile Include="Schema\JsonSchemaBuilderTests.cs" />
<Compile Include="Schema\JsonSchemaGeneratorTests.cs" />
<Compile Include="Schema\JsonSchemaTests.cs" />
@@ -164,19 +164,35 @@
<Compile Include="TestObjects\Car.cs" />
<Compile Include="TestObjects\Component.cs" />
<Compile Include="TestObjects\Computer.cs" />
<Compile Include="TestObjects\ConsoleWriter.cs" />
<Compile Include="TestObjects\ConstructorReadonlyFields.cs" />
<Compile Include="TestObjects\Container.cs" />
<Compile Include="TestObjects\ContentBaseClass.cs" />
<Compile Include="TestObjects\ContentSubClass.cs" />
<Compile Include="TestObjects\Currency.cs" />
<Compile Include="TestObjects\CustomerDataSet.cs" />
<Compile Include="TestObjects\DataContractSerializationAttributesClass.cs" />
<Compile Include="TestObjects\DateTimeWrapper.cs" />
<Compile Include="TestObjects\DecimalTestClass.cs" />
<Compile Include="TestObjects\DerivedSerializationEventTestObject.cs" />
<Compile Include="TestObjects\DirectoryAccount.cs" />
<Compile Include="TestObjects\Event1.cs" />
<Compile Include="TestObjects\Events\Event.cs" />
<Compile Include="TestObjects\Events\Event1.cs" />
<Compile Include="TestObjects\Events\EventType.cs" />
<Compile Include="TestObjects\Foo.cs" />
<Compile Include="TestObjects\GameObject.cs" />
<Compile Include="TestObjects\GeoCoding\AddressDetails.cs" />
<Compile Include="TestObjects\GeoCoding\AdministrativeArea.cs" />
<Compile Include="TestObjects\GeoCoding\Country.cs" />
<Compile Include="TestObjects\GeoCoding\GoogleMapGeocoderStructure.cs" />
<Compile Include="TestObjects\GeoCoding\Locality.cs" />
<Compile Include="TestObjects\GeoCoding\Placemark.cs" />
<Compile Include="TestObjects\GeoCoding\Point.cs" />
<Compile Include="TestObjects\GeoCoding\PostalCode.cs" />
<Compile Include="TestObjects\GeoCoding\Status.cs" />
<Compile Include="TestObjects\GeoCoding\SubAdministrativeArea.cs" />
<Compile Include="TestObjects\GeoCoding\Thoroughfare.cs" />
<Compile Include="TestObjects\GeometricForms\Shape.cs" />
<Compile Include="TestObjects\GeometricForms\Tags.cs" />
<Compile Include="TestObjects\HolderClass.cs" />
<Compile Include="TestObjects\IdReferenceResolver.cs" />
<Compile Include="TestObjects\IMyInterface.cs" />
@@ -188,11 +204,22 @@
<Compile Include="TestObjects\ListOfIds.cs" />
<Compile Include="TestObjects\MetroPropertyNameResolver.cs" />
<Compile Include="TestObjects\MetroStringConverter.cs" />
<Compile Include="TestObjects\Money\Currency.cs" />
<Compile Include="TestObjects\Money\Tags.cs" />
<Compile Include="TestObjects\Movie.cs" />
<Compile Include="TestObjects\MyEnum.cs" />
<Compile Include="TestObjects\MyInterfaceConverter.cs" />
<Compile Include="TestObjects\NameContainer.cs" />
<Compile Include="TestObjects\NameContainerConverter.cs" />
<Compile Include="TestObjects\NullableGuid.cs" />
<Compile Include="TestObjects\Organization\Employee.cs" />
<Compile Include="TestObjects\Organization\IPerson.cs" />
<Compile Include="TestObjects\Organization\Manager.cs" />
<Compile Include="TestObjects\Organization\Person.cs" />
<Compile Include="TestObjects\Organization\PersonPropertyClass.cs" />
<Compile Include="TestObjects\Organization\WagePerson.cs" />
<Compile Include="TestObjects\ParticipantEntity.cs" />
<Compile Include="TestObjects\PersonError.cs" />
<Compile Include="TestObjects\PersonPropertyClass.cs" />
<Compile Include="TestObjects\PersonReference.cs" />
<Compile Include="TestObjects\PersonSerializable.cs" />
<Compile Include="TestObjects\PersonWithPrivateConstructor.cs" />
@@ -203,8 +230,6 @@
<Compile Include="TestObjects\DateTimeErrorObjectCollection.cs" />
<Compile Include="Serialization\EntitiesSerializationTests.cs" />
<Compile Include="TestObjects\DictionaryInterfaceClass.cs" />
<Compile Include="TestObjects\Event.cs" />
<Compile Include="TestObjects\GoogleMapGeocoderStructure.cs" />
<Compile Include="TestObjects\InterfacePropertyTestClass.cs" />
<Compile Include="TestObjects\JsonPropertyClass.cs" />
<Compile Include="TestObjects\ListErrorObject.cs" />
@@ -227,20 +252,25 @@
<Compile Include="TestObjects\PrivateImplementationBClass.cs" />
<Compile Include="TestObjects\PropertyItemConverter.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorRequiringConverterTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorRequiringConverterWithParameterAttributeTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorRequiringConverterWithPropertyAttributeTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorWithNonPropertyParameterTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorWithPropertyNameConflict.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorWithPropertyNameConflictWithAttribute.cs" />
<Compile Include="TestObjects\Ratio.cs" />
<Compile Include="TestObjects\RequiredObject.cs" />
<Compile Include="TestObjects\RoleTransferDirection.cs" />
<Compile Include="TestObjects\RoleTransferOperation.cs" />
<Compile Include="TestObjects\SearchResult.cs" />
<Compile Include="TestObjects\SelectListItem.cs" />
<Compile Include="TestObjects\Shape.cs" />
<Compile Include="TestObjects\StructTest.cs" />
<Compile Include="TestObjects\TestComponent.cs" />
<Compile Include="TestObjects\TestComponentSimple.cs" />
<Compile Include="TestObjects\TestObject.cs" />
<Compile Include="TestObjects\TraceWriter.cs" />
<Compile Include="TestObjects\TypeConverterJsonConverter.cs" />
<Compile Include="TestObjects\UriGuidTimeSpanTestClass.cs" />
<Compile Include="TestObjects\WagePerson.cs" />
<Compile Include="TestObjects\PropertyCase.cs" />
<Compile Include="TestObjects\RequestOnly.cs" />
<Compile Include="TestObjects\RoleTransfer.cs" />
@@ -297,7 +327,6 @@
<Compile Include="TestObjects\Shortie.cs" />
<Compile Include="TestObjects\Store.cs" />
<Compile Include="TestObjects\StoreColor.cs" />
<Compile Include="TestObjects\Person.cs" />
<Compile Include="Schema\JsonSchemaBuilderTests.cs" />
<Compile Include="Schema\JsonSchemaGeneratorTests.cs" />
<Compile Include="Schema\JsonSchemaTests.cs" />
@@ -316,6 +316,7 @@
<Compile Include="TestObjects\ClassWithGuid.cs" />
<Compile Include="TestObjects\Component.cs" />
<Compile Include="TestObjects\Computer.cs" />
<Compile Include="TestObjects\ConsoleWriter.cs" />
<Compile Include="TestObjects\ConstructorCaseSensitivityClass.cs" />
<Compile Include="TestObjects\ConstructorReadonlyFields.cs" />
<Compile Include="TestObjects\Container.cs" />
@@ -325,7 +326,19 @@
<Compile Include="TestObjects\ConverableMembers.cs" />
<Compile Include="TestObjects\ConverterPrecedenceClass.cs" />
<Compile Include="TestObjects\ConverterPrecedenceClassConverter.cs" />
<Compile Include="TestObjects\Currency.cs" />
<Compile Include="TestObjects\DerivedSerializationEventTestObject.cs" />
<Compile Include="TestObjects\Events\EventType.cs" />
<Compile Include="TestObjects\GeoCoding\AddressDetails.cs" />
<Compile Include="TestObjects\GeoCoding\AdministrativeArea.cs" />
<Compile Include="TestObjects\GeoCoding\Country.cs" />
<Compile Include="TestObjects\GeoCoding\Locality.cs" />
<Compile Include="TestObjects\GeoCoding\Placemark.cs" />
<Compile Include="TestObjects\GeoCoding\Point.cs" />
<Compile Include="TestObjects\GeoCoding\PostalCode.cs" />
<Compile Include="TestObjects\GeoCoding\Status.cs" />
<Compile Include="TestObjects\GeoCoding\SubAdministrativeArea.cs" />
<Compile Include="TestObjects\GeoCoding\Thoroughfare.cs" />
<Compile Include="TestObjects\Money\Currency.cs" />
<Compile Include="TestObjects\CustomerDataSet.cs" />
<Compile Include="TestObjects\DataContractSerializationAttributesClass.cs" />
<Compile Include="TestObjects\DateTimeErrorObjectCollection.cs" />
@@ -337,14 +350,14 @@
<Compile Include="TestObjects\DirectoryAccount.cs" />
<Compile Include="TestObjects\DoubleClass.cs" />
<Compile Include="TestObjects\EmployeeReference.cs" />
<Compile Include="TestObjects\Event.cs" />
<Compile Include="TestObjects\Event1.cs" />
<Compile Include="TestObjects\Events\Event.cs" />
<Compile Include="TestObjects\Events\Event1.cs" />
<Compile Include="TestObjects\Foo.cs" />
<Compile Include="TestObjects\GameObject.cs" />
<Compile Include="TestObjects\GenericImpl.cs" />
<Compile Include="TestObjects\GenericListAndDictionaryInterfaceProperties.cs" />
<Compile Include="TestObjects\GetOnlyPropertyClass.cs" />
<Compile Include="TestObjects\GoogleMapGeocoderStructure.cs" />
<Compile Include="TestObjects\GeoCoding\GoogleMapGeocoderStructure.cs" />
<Compile Include="TestObjects\HolderClass.cs" />
<Compile Include="TestObjects\IdReferenceResolver.cs" />
<Compile Include="TestObjects\IMyInterface.cs" />
@@ -371,17 +384,25 @@
<Compile Include="TestObjects\MethodExecutorObject.cs" />
<Compile Include="TestObjects\MetroPropertyNameResolver.cs" />
<Compile Include="TestObjects\MetroStringConverter.cs" />
<Compile Include="TestObjects\Money\Tags.cs" />
<Compile Include="TestObjects\Movie.cs" />
<Compile Include="TestObjects\MyClass.cs" />
<Compile Include="TestObjects\MyEnum.cs" />
<Compile Include="TestObjects\MyInterfaceConverter.cs" />
<Compile Include="TestObjects\Name.cs" />
<Compile Include="TestObjects\NameContainer.cs" />
<Compile Include="TestObjects\NameContainerConverter.cs" />
<Compile Include="TestObjects\NonRequest.cs" />
<Compile Include="TestObjects\NullableDateTimeTestClass.cs" />
<Compile Include="TestObjects\NullableGuid.cs" />
<Compile Include="TestObjects\ObjectArrayPropertyTest.cs" />
<Compile Include="TestObjects\Organization\Employee.cs" />
<Compile Include="TestObjects\Organization\IPerson.cs" />
<Compile Include="TestObjects\Organization\Manager.cs" />
<Compile Include="TestObjects\ParticipantEntity.cs" />
<Compile Include="TestObjects\Person.cs" />
<Compile Include="TestObjects\Organization\Person.cs" />
<Compile Include="TestObjects\PersonError.cs" />
<Compile Include="TestObjects\PersonPropertyClass.cs" />
<Compile Include="TestObjects\Organization\PersonPropertyClass.cs" />
<Compile Include="TestObjects\PersonRaw.cs" />
<Compile Include="TestObjects\PersonReference.cs" />
<Compile Include="TestObjects\PersonSerializable.cs" />
@@ -399,14 +420,19 @@
<Compile Include="TestObjects\PropertyCase.cs" />
<Compile Include="TestObjects\PropertyItemConverter.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorRequiringConverterTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorRequiringConverterWithParameterAttributeTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorRequiringConverterWithPropertyAttributeTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorWithNonPropertyParameterTestClass.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorWithPropertyNameConflict.cs" />
<Compile Include="TestObjects\PublicParameterizedConstructorWithPropertyNameConflictWithAttribute.cs" />
<Compile Include="TestObjects\Ratio.cs" />
<Compile Include="TestObjects\RequestOnly.cs" />
<Compile Include="TestObjects\RequiredMembersClass.cs" />
<Compile Include="TestObjects\RequiredObject.cs" />
<Compile Include="TestObjects\RoleTransfer.cs" />
<Compile Include="TestObjects\RoleTransferDirection.cs" />
<Compile Include="TestObjects\RoleTransferOperation.cs" />
<Compile Include="TestObjects\SearchResult.cs" />
<Compile Include="TestObjects\SelectListItem.cs" />
<Compile Include="TestObjects\SerializationEventTestDictionary.cs" />
@@ -415,7 +441,7 @@
<Compile Include="TestObjects\SerializationEventTestObjectWithConstructor.cs" />
<Compile Include="TestObjects\SetOnlyPropertyClass.cs" />
<Compile Include="TestObjects\SetOnlyPropertyClass2.cs" />
<Compile Include="TestObjects\Shape.cs" />
<Compile Include="TestObjects\GeometricForms\Shape.cs" />
<Compile Include="TestObjects\Shortie.cs" />
<Compile Include="TestObjects\SqlTypesDataSet.Designer.cs">
<AutoGen>True</AutoGen>
@@ -427,15 +453,18 @@
<Compile Include="TestObjects\StructTest.cs" />
<Compile Include="TestObjects\SubKlass.cs" />
<Compile Include="TestObjects\SuperKlass.cs" />
<Compile Include="TestObjects\GeometricForms\Tags.cs" />
<Compile Include="TestObjects\TestComponent.cs" />
<Compile Include="TestObjects\TestComponentSimple.cs" />
<Compile Include="TestObjects\TestObject.cs" />
<Compile Include="TestObjects\TraceWriter.cs" />
<Compile Include="TestObjects\TypeClass.cs" />
<Compile Include="TestObjects\TypeConverterJsonConverter.cs" />
<Compile Include="TestObjects\TypedSubHashtable.cs" />
<Compile Include="TestObjects\UriGuidTimeSpanTestClass.cs" />
<Compile Include="TestObjects\UserNullable.cs" />
<Compile Include="TestObjects\VersionKeyedCollection.cs" />
<Compile Include="TestObjects\WagePerson.cs" />
<Compile Include="TestObjects\Organization\WagePerson.cs" />
<Compile Include="TestObjects\Widget.cs" />
<Compile Include="TestObjects\Widget1.cs" />
<Compile Include="TestObjects\WidgetId.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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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"",
@@ -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<Event1[,]>), 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
@@ -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<JsonSerializationException>(() => { JsonConvert.DeserializeObject<TestObjects.Event>(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<JsonSerializationException>(() => { JsonConvert.DeserializeObject<Event>(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<JsonSerializationException>(() => { JsonConvert.DeserializeObject<Person>(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<JsonSerializationException>(() => { JsonConvert.DeserializeObject<Person>(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<T> 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<JsonSerializationException>(() => { JsonConvert.DeserializeObject<Person>(json); }, @"Error converting value ""Constructor"" to type 'Newtonsoft.Json.Tests.TestObjects.Person'. Path '', line 1, position 16.");
ExceptionAssert.Throws<JsonSerializationException>(() => { JsonConvert.DeserializeObject<Person>(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<JsonSerializationException>(() => { JsonConvert.DeserializeObject<List<Person>>(json); }, @"Error converting value ""Constructor"" to type 'Newtonsoft.Json.Tests.TestObjects.Person'. Path '[0]', line 1, position 17.");
ExceptionAssert.Throws<JsonSerializationException>(() => { JsonConvert.DeserializeObject<List<Person>>(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<T>) 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<JsonSerializationException>(() => { JsonConvert.PopulateObject(json, new Person()); }, @"Cannot populate JSON array onto type 'Newtonsoft.Json.Tests.TestObjects.Person'. Path '', line 1, position 1.");
ExceptionAssert.Throws<JsonSerializationException>(() => { 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<JsonSerializationException>(() => { JsonConvert.PopulateObject(json, new List<Person>()); }, @"Cannot populate JSON object onto type 'System.Collections.Generic.List`1[Newtonsoft.Json.Tests.TestObjects.Person]'. Path '', line 1, position 2.");
ExceptionAssert.Throws<JsonSerializationException>(() => { JsonConvert.PopulateObject(json, new List<Person>()); }, @"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<Dictionary<Person, int>>(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']'"));
}
}
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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]
@@ -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"",
@@ -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
}
@@ -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)
{
}
}
}
@@ -25,20 +25,8 @@
using System;
namespace Newtonsoft.Json.Tests.TestObjects
namespace Newtonsoft.Json.Tests.TestObjects.Events
{
/// <summary>
/// What types of events are there? Just sticking to a basic set of four for now.
/// </summary>
/// <remarks></remarks>
public enum EventType
{
Debug = 0,
Info = 1,
Warning = 2,
Error = 3
}
public sealed class Event
{
/// <summary>
@@ -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
{
@@ -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
{
/// <summary>
/// What types of events are there? Just sticking to a basic set of four for now.
/// </summary>
/// <remarks></remarks>
public enum EventType
{
Debug = 0,
Info = 1,
Warning = 2,
Error = 3
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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> 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<decimal> Coordinates;
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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<decimal> Coordinates;
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
}
@@ -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;
}
}
}
@@ -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
@@ -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<IMyInterface> _writers = new List<IMyInterface>
{
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
}
@@ -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
@@ -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
@@ -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
}
}
@@ -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<IMyInterface> _writers = new List<IMyInterface>
{
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
}
@@ -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; }
}
}
@@ -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);
}
}
}
@@ -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; }
}
}
@@ -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; }
}
}
@@ -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<Employee> Employees { get; set; }
}
}
@@ -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<Employee> Employees { get; set; }
}
}
@@ -23,7 +23,7 @@
// OTHER DEALINGS IN THE SOFTWARE.
#endregion
namespace Newtonsoft.Json.Tests.TestObjects
namespace Newtonsoft.Json.Tests.TestObjects.Organization
{
public class PersonPropertyClass
{
@@ -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
{
@@ -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; }
}
}
}
@@ -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; }
}
}
}
@@ -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; }
}
}
}
@@ -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; }
}
}
}
@@ -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; }
}
}
}
@@ -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
@@ -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
}
}
@@ -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
}
}
@@ -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)
{
}
}
}
@@ -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
}
@@ -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
}
@@ -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
{
@@ -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
}
}
@@ -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<object, object> setter = DynamicReflectionDelegateFactory.Instance.CreateGet<object>(typeof(Movie).GetProperty("Name"));
setter(p);
}, "Unable to cast object of type 'Newtonsoft.Json.Tests.TestObjects.Person' to type 'Newtonsoft.Json.Tests.TestObjects.Movie'.");
}, "Unable to cast object of type 'Newtonsoft.Json.Tests.TestObjects.Organization.Person' to type 'Newtonsoft.Json.Tests.TestObjects.Movie'.");
}
[Test]
@@ -127,7 +128,7 @@ namespace Newtonsoft.Json.Tests.Utilities
setter(p, "Hi");
Assert.AreEqual(p.Name, "Hi");
}, "Unable to cast object of type 'Newtonsoft.Json.Tests.TestObjects.Person' to type 'Newtonsoft.Json.Tests.TestObjects.Movie'.");
}, "Unable to cast object of type 'Newtonsoft.Json.Tests.TestObjects.Organization.Person' to type 'Newtonsoft.Json.Tests.TestObjects.Movie'.");
}
[Test]
@@ -43,6 +43,7 @@ using NUnit.Framework;
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json.Utilities;
using Newtonsoft.Json.Tests.TestObjects;
using Newtonsoft.Json.Tests.TestObjects.Organization;
using Newtonsoft.Json.Tests.Serialization;
namespace Newtonsoft.Json.Tests.Utilities
@@ -298,7 +299,7 @@ namespace Newtonsoft.Json.Tests.Utilities
},
new[]
{
"Unable to cast object of type 'Newtonsoft.Json.Tests.TestObjects.Person' to type 'Newtonsoft.Json.Tests.TestObjects.Movie'.",
"Unable to cast object of type 'Newtonsoft.Json.Tests.TestObjects.Organization.Person' to type 'Newtonsoft.Json.Tests.TestObjects.Movie'.",
"Cannot cast from source type to destination type." // mono
});
}
@@ -324,7 +325,7 @@ namespace Newtonsoft.Json.Tests.Utilities
},
new[]
{
"Unable to cast object of type 'Newtonsoft.Json.Tests.TestObjects.Person' to type 'Newtonsoft.Json.Tests.TestObjects.Movie'.",
"Unable to cast object of type 'Newtonsoft.Json.Tests.TestObjects.Organization.Person' to type 'Newtonsoft.Json.Tests.TestObjects.Movie'.",
"Cannot cast from source type to destination type." // mono
});
}