added custom IntConverter to get around the mono bug

http://json.codeplex.com/workitem/24176
This commit is contained in:
Keivan Beigi
2013-09-18 17:24:50 -07:00
parent 904061c2f0
commit 41c5619d1b
15 changed files with 122 additions and 56 deletions
@@ -1,3 +1,5 @@
using System;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Common.Serializer;
using NzbDrone.Test.Common;
@@ -9,15 +11,19 @@ namespace NzbDrone.Libraries.Test.JsonTests
{
public class TypeWithNumbers
{
public int Id { get; set; }
public int Int32 { get; set; }
public Int64 Int64 { get; set; }
public int? nullableIntIsNull { get; set; }
public int? nullableWithValue { get; set; }
}
[Test]
public void should_be_able_to_deserialize_numbers()
{
var quality = new TypeWithNumbers { Id = 12 };
var quality = new TypeWithNumbers { Int32 = Int32.MaxValue, Int64 = Int64.MaxValue, nullableWithValue = 12 };
var result = Json.Deserialize<TypeWithNumbers>(quality.ToJson());
Json.Deserialize<TypeWithNumbers>(quality.ToJson());
result.ShouldHave().AllProperties().EqualTo(quality);
}
}
}
@@ -33,6 +33,14 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="FluentAssertions, Version=2.1.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\FluentAssertions.2.1.0.0\lib\net40\FluentAssertions.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.5.0.6\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.2.6.2\lib\nunit.framework.dll</HintPath>
</Reference>
@@ -65,9 +73,7 @@
<Name>NzbDrone.Test.Common</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Json\" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+2
View File
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FluentAssertions" version="2.1.0.0" targetFramework="net40" />
<package id="Newtonsoft.Json" version="5.0.6" targetFramework="net40" />
<package id="NUnit" version="2.6.2" targetFramework="net40" />
</packages>