-Added compact framework support
-Refactored JavaScriptConvert to not rely on DateTimeOffset when converting dates -Refactored JsonSerializer to use new CreateInstance on ReflectionUtils -Deleted JsonHandler
This commit is contained in:
@@ -260,8 +260,10 @@ now brown cow?", '"', true);
|
||||
int i = JavaScriptConvert.DeserializeObject<int>("1");
|
||||
Assert.AreEqual(1, i);
|
||||
|
||||
#if !PocketPC
|
||||
DateTimeOffset d = JavaScriptConvert.DeserializeObject<DateTimeOffset>(@"""\/Date(-59011455539000+0000)\/""");
|
||||
Assert.AreEqual(new DateTimeOffset(new DateTime(100, 1, 1, 1, 1, 1, DateTimeKind.Utc)), d);
|
||||
#endif
|
||||
|
||||
bool b = JavaScriptConvert.DeserializeObject<bool>("true");
|
||||
Assert.AreEqual(true, b);
|
||||
|
||||
@@ -36,7 +36,9 @@ using System.Collections.ObjectModel;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json.Converters;
|
||||
#if !PocketPC
|
||||
using System.Runtime.Serialization.Json;
|
||||
#endif
|
||||
using Newtonsoft.Json.Utilities;
|
||||
using System.Globalization;
|
||||
using System.ComponentModel;
|
||||
@@ -742,6 +744,7 @@ keyword such as type of business.""
|
||||
Assert.AreEqual("Large", deserializedProductShort.Sizes[2]);
|
||||
}
|
||||
|
||||
#if !PocketPC
|
||||
[Test]
|
||||
public void Unicode()
|
||||
{
|
||||
@@ -781,6 +784,7 @@ keyword such as type of business.""
|
||||
result = JavaScriptConvert.SerializeObject(testDates);
|
||||
Assert.AreEqual(expected, result);
|
||||
}
|
||||
#endif
|
||||
|
||||
[Test]
|
||||
public void DateTimeOffset()
|
||||
@@ -1319,5 +1323,13 @@ keyword such as type of business.""
|
||||
new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore });
|
||||
Assert.AreEqual(@"{}", json);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DeserializeStringDate()
|
||||
{
|
||||
string dateText = @"""\/Date(1221644506800-0700)\/""";
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -159,7 +159,11 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
public void Casting()
|
||||
{
|
||||
Assert.AreEqual(new DateTime(2000, 12, 20), (DateTime)new JValue(new DateTime(2000, 12, 20)));
|
||||
#if !PocketPC
|
||||
Assert.AreEqual(new DateTimeOffset(2000, 12, 20, 23, 50, 10, TimeSpan.Zero), (DateTimeOffset)new JValue(new DateTimeOffset(2000, 12, 20, 23, 50, 10, TimeSpan.Zero)));
|
||||
Assert.AreEqual(null, (DateTimeOffset?)new JValue((DateTimeOffset?)null));
|
||||
Assert.AreEqual(null, (DateTimeOffset?)(JValue)null);
|
||||
#endif
|
||||
Assert.AreEqual(true, (bool)new JValue(true));
|
||||
Assert.AreEqual(true, (bool?)new JValue(true));
|
||||
Assert.AreEqual(null, (bool?)((JValue)null));
|
||||
@@ -170,9 +174,7 @@ namespace Newtonsoft.Json.Tests.Linq
|
||||
Assert.AreEqual(null, (int?)new JValue((int?)null));
|
||||
Assert.AreEqual(null, (int?)(JValue)null);
|
||||
Assert.AreEqual(null, (DateTime?)new JValue((DateTime?)null));
|
||||
Assert.AreEqual(null, (DateTimeOffset?)new JValue((DateTimeOffset?)null));
|
||||
Assert.AreEqual(null, (DateTime?)(JValue)null);
|
||||
Assert.AreEqual(null, (DateTimeOffset?)(JValue)null);
|
||||
Assert.AreEqual(null, (short?)new JValue((short?)null));
|
||||
Assert.AreEqual(null, (short?)(JValue)null);
|
||||
Assert.AreEqual(null, (float?)new JValue((float?)null));
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{32EA9694-4FB3-43E9-A6AD-050F1D35EA0A}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Newtonsoft.Json.Tests.Compact</RootNamespace>
|
||||
<AssemblyName>Newtonsoft.Json.Tests.Compact</AssemblyName>
|
||||
<ProjectTypeGuids>{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<PlatformFamilyName>PocketPC</PlatformFamilyName>
|
||||
<PlatformID>b2c48bd2-963d-4549-9169-1fa021dce484</PlatformID>
|
||||
<OSVersion>5.2</OSVersion>
|
||||
<DeployDirSuffix>Newtonsoft.Json.Tests.Compact</DeployDirSuffix>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<NativePlatformName>Windows Mobile 6 Professional SDK</NativePlatformName>
|
||||
<FormFactorID>
|
||||
</FormFactorID>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;$(PlatformFamilyName)</DefineConstants>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;$(PlatformFamilyName)</DefineConstants>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="NUnitLite, Version=2.4.7.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Lib\NUnitLite.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Converters\IsoDateTimeConverterTests.cs" />
|
||||
<Compile Include="Converters\JavaScriptDateTimeConverterTests.cs" />
|
||||
<Compile Include="Converters\XmlNodeConverterTest.cs" />
|
||||
<Compile Include="DateTimeTestClass.cs" />
|
||||
<Compile Include="JavaScriptConvertTest.cs" />
|
||||
<Compile Include="JsonSerializerTest.cs" />
|
||||
<Compile Include="JsonTextReaderTest.cs" />
|
||||
<Compile Include="JsonTextWriterTest.cs" />
|
||||
<Compile Include="JsonTokenReaderTest.cs" />
|
||||
<Compile Include="JsonTokenWriterTest.cs" />
|
||||
<Compile Include="Linq\JArrayTests.cs" />
|
||||
<Compile Include="Linq\JObjectTests.cs" />
|
||||
<Compile Include="Linq\JTokenEqualityComparerTests.cs" />
|
||||
<Compile Include="Linq\JTokenTests.cs" />
|
||||
<Compile Include="Linq\JValueTests.cs" />
|
||||
<Compile Include="Linq\LinqToJsonTest.cs" />
|
||||
<Compile Include="PerformanceTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SilverlightTests.cs" />
|
||||
<Compile Include="TestFixtureBase.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Newtonsoft.Json\Newtonsoft.Json.Compact.csproj">
|
||||
<Project>{256AA604-F61B-4B6D-8D51-C8E6AB11E435}</Project>
|
||||
<Name>Newtonsoft.Json.Compact</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}">
|
||||
<HostingProcess disable="1" />
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,4 +1,4 @@
|
||||
#if !SILVERLIGHT
|
||||
#if !SILVERLIGHT && !PocketPC
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
||||
@@ -6,10 +6,12 @@ using System.Runtime.InteropServices;
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
|
||||
#if !SILVERLIGHT
|
||||
[assembly: AssemblyTitle("Newtonsoft Json.NET Tests")]
|
||||
#else
|
||||
#if SILVERLIGHT
|
||||
[assembly: AssemblyTitle("Newtonsoft Json.NET Tests Silverlight")]
|
||||
#elif PocketPC
|
||||
[assembly: AssemblyTitle("Newtonsoft Json.NET Tests Compact")]
|
||||
#else
|
||||
[assembly: AssemblyTitle("Newtonsoft Json.NET Tests")]
|
||||
#endif
|
||||
|
||||
[assembly: AssemblyDescription("")]
|
||||
@@ -38,4 +40,6 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("3.0.0.0")]
|
||||
#if !PocketPC
|
||||
[assembly: AssemblyFileVersion("3.0.0.0")]
|
||||
#endif
|
||||
Reference in New Issue
Block a user