added an abstraction layer for json serializer, should work in mono.

This commit is contained in:
Keivan Beigi 2013-04-16 17:24:49 -07:00
commit 65ae894410
14 changed files with 94 additions and 98 deletions

View file

@ -1,10 +1,11 @@
using NUnit.Framework;
using Newtonsoft.Json;
using NzbDrone.Common;
using NzbDrone.Test.Common;
namespace NzbDrone.Libraries.Test.Json
{
[TestFixture]
public class JsonFixture
public class JsonFixture : TestBase<JsonSerializer>
{
public class TypeWithNumbers
{
@ -16,9 +17,9 @@ namespace NzbDrone.Libraries.Test.Json
{
var quality = new TypeWithNumbers { Id = 12 };
var json = JsonConvert.SerializeObject(quality);
var json = Subject.Serialize(quality);
JsonConvert.DeserializeObject(json);
Subject.Deserialize<TypeWithNumbers>(json);
}
}
}

View file

@ -22,6 +22,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -32,9 +33,6 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.5.0.2\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.2.6.2\lib\nunit.framework.dll</HintPath>
</Reference>
@ -54,10 +52,18 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NzbDrone.Common\NzbDrone.Common.csproj">
<Project>{F2BE0FDF-6E47-4827-A420-DD4EF82407F8}</Project>
<Name>NzbDrone.Common</Name>
</ProjectReference>
<ProjectReference Include="..\NzbDrone.Core\NzbDrone.Core.csproj">
<Project>{FF5EE3B6-913B-47CE-9CEB-11C51B4E1205}</Project>
<Name>NzbDrone.Core</Name>
</ProjectReference>
<ProjectReference Include="..\NzbDrone.Test.Common\NzbDrone.Test.Common.csproj">
<Project>{CADDFCE0-7509-4430-8364-2074E1EEFCA2}</Project>
<Name>NzbDrone.Test.Common</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />

View file

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="5.0.2" targetFramework="net40" />
<package id="NUnit" version="2.6.2" targetFramework="net40" />
</packages>