From 861c07b2faf68de5fe531136230650b041f429f3 Mon Sep 17 00:00:00 2001 From: Keivan Beigi Date: Tue, 16 Apr 2013 16:21:03 -0700 Subject: [PATCH] added json.net tests for mono. --- .../NzbgetProviderTests/QueueFixture.cs | 8 --- NzbDrone.Libraries.Test/Json/JsonFixture.cs | 24 +++++++ .../NzbDrone.Libraries.Test.csproj | 68 +++++++++++++++++++ .../Properties/AssemblyInfo.cs | 36 ++++++++++ NzbDrone.Libraries.Test/packages.config | 5 ++ NzbDrone.sln | 13 ++++ .../ServiceInstall/ServiceInstall.csproj | 2 +- .../ServiceUninstall/ServiceUninstall.csproj | 3 + 8 files changed, 150 insertions(+), 9 deletions(-) create mode 100644 NzbDrone.Libraries.Test/Json/JsonFixture.cs create mode 100644 NzbDrone.Libraries.Test/NzbDrone.Libraries.Test.csproj create mode 100644 NzbDrone.Libraries.Test/Properties/AssemblyInfo.cs create mode 100644 NzbDrone.Libraries.Test/packages.config diff --git a/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/QueueFixture.cs b/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/QueueFixture.cs index 5b815726f..b433b3a3a 100644 --- a/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/QueueFixture.cs +++ b/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetProviderTests/QueueFixture.cs @@ -66,13 +66,5 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetProviderTests .Should() .HaveCount(1); } - - [Test] - public void should_throw_when_error_is_returned() - { - WithFailResponse(); - - Assert.Throws(() => Mocker.Resolve().GetQueue()); - } } } diff --git a/NzbDrone.Libraries.Test/Json/JsonFixture.cs b/NzbDrone.Libraries.Test/Json/JsonFixture.cs new file mode 100644 index 000000000..e5a9cb148 --- /dev/null +++ b/NzbDrone.Libraries.Test/Json/JsonFixture.cs @@ -0,0 +1,24 @@ +using NUnit.Framework; +using Newtonsoft.Json; + +namespace NzbDrone.Libraries.Test.Json +{ + [TestFixture] + public class JsonFixture + { + public class TypeWithNumbers + { + public int Id { get; set; } + } + + [Test] + public void should_be_able_to_deserialize_numbers() + { + var quality = new TypeWithNumbers { Id = 12 }; + + var json = JsonConvert.SerializeObject(quality); + + JsonConvert.DeserializeObject(json); + } + } +} diff --git a/NzbDrone.Libraries.Test/NzbDrone.Libraries.Test.csproj b/NzbDrone.Libraries.Test/NzbDrone.Libraries.Test.csproj new file mode 100644 index 000000000..f5bb09190 --- /dev/null +++ b/NzbDrone.Libraries.Test/NzbDrone.Libraries.Test.csproj @@ -0,0 +1,68 @@ + + + + + Debug + AnyCPU + {CBF6B8B0-A015-413A-8C86-01238BB45770} + Library + Properties + NzbDrone.Libraries.Test + NzbDrone.Libraries.Test + v4.0 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Newtonsoft.Json.5.0.2\lib\net40\Newtonsoft.Json.dll + + + ..\packages\NUnit.2.6.2\lib\nunit.framework.dll + + + + + + + + + + + + + + + + + + + {FF5EE3B6-913B-47CE-9CEB-11C51B4E1205} + NzbDrone.Core + + + + + \ No newline at end of file diff --git a/NzbDrone.Libraries.Test/Properties/AssemblyInfo.cs b/NzbDrone.Libraries.Test/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..55a06132e --- /dev/null +++ b/NzbDrone.Libraries.Test/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("NzbDrone.Libraries.Test")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("NzbDrone.Libraries.Test")] +[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("32ec29e2-40ba-4050-917d-e295d85d4969")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/NzbDrone.Libraries.Test/packages.config b/NzbDrone.Libraries.Test/packages.config new file mode 100644 index 000000000..253df0920 --- /dev/null +++ b/NzbDrone.Libraries.Test/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/NzbDrone.sln b/NzbDrone.sln index 25aed946b..23e96d1fd 100644 --- a/NzbDrone.sln +++ b/NzbDrone.sln @@ -46,6 +46,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NzbDrone.Api.Test", "NzbDro EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Marr.Data", "Marr.Data\Marr.Data.csproj", "{F6FC6BE7-0847-4817-A1ED-223DC647C3D7}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NzbDrone.Libraries.Test", "NzbDrone.Libraries.Test\NzbDrone.Libraries.Test.csproj", "{CBF6B8B0-A015-413A-8C86-01238BB45770}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -246,6 +248,16 @@ Global {F6FC6BE7-0847-4817-A1ED-223DC647C3D7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {F6FC6BE7-0847-4817-A1ED-223DC647C3D7}.Release|Mixed Platforms.Build.0 = Release|Any CPU {F6FC6BE7-0847-4817-A1ED-223DC647C3D7}.Release|x86.ActiveCfg = Release|Any CPU + {CBF6B8B0-A015-413A-8C86-01238BB45770}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CBF6B8B0-A015-413A-8C86-01238BB45770}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CBF6B8B0-A015-413A-8C86-01238BB45770}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {CBF6B8B0-A015-413A-8C86-01238BB45770}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {CBF6B8B0-A015-413A-8C86-01238BB45770}.Debug|x86.ActiveCfg = Debug|Any CPU + {CBF6B8B0-A015-413A-8C86-01238BB45770}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CBF6B8B0-A015-413A-8C86-01238BB45770}.Release|Any CPU.Build.0 = Release|Any CPU + {CBF6B8B0-A015-413A-8C86-01238BB45770}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {CBF6B8B0-A015-413A-8C86-01238BB45770}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {CBF6B8B0-A015-413A-8C86-01238BB45770}.Release|x86.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -257,6 +269,7 @@ Global {35388E8E-0CDB-4A84-AD16-E4B6EFDA5D97} = {57A04B72-8088-4F75-A582-1158CF8291F7} {BEC74619-DDBB-4FBA-B517-D3E20AFC9997} = {57A04B72-8088-4F75-A582-1158CF8291F7} {D18A5DEB-5102-4775-A1AF-B75DAAA8907B} = {57A04B72-8088-4F75-A582-1158CF8291F7} + {CBF6B8B0-A015-413A-8C86-01238BB45770} = {57A04B72-8088-4F75-A582-1158CF8291F7} {FAFB5948-A222-4CF6-AD14-026BE7564802} = {47697CDB-27B6-4B05-B4F8-0CBE6F6EDF97} {CADDFCE0-7509-4430-8364-2074E1EEFCA2} = {47697CDB-27B6-4B05-B4F8-0CBE6F6EDF97} {6BCE712F-846D-4846-9D1B-A66B858DA755} = {F9E67978-5CD6-4A5F-827B-4249711C0B02} diff --git a/ServiceHelpers/ServiceInstall/ServiceInstall.csproj b/ServiceHelpers/ServiceInstall/ServiceInstall.csproj index 4b7634ee9..71ea64baf 100644 --- a/ServiceHelpers/ServiceInstall/ServiceInstall.csproj +++ b/ServiceHelpers/ServiceInstall/ServiceInstall.csproj @@ -39,7 +39,7 @@ app.manifest - OnOutputUpdated + OnBuildSuccess ServiceInstall.Program diff --git a/ServiceHelpers/ServiceUninstall/ServiceUninstall.csproj b/ServiceHelpers/ServiceUninstall/ServiceUninstall.csproj index a50a1495e..8fed7f3ab 100644 --- a/ServiceHelpers/ServiceUninstall/ServiceUninstall.csproj +++ b/ServiceHelpers/ServiceUninstall/ServiceUninstall.csproj @@ -62,6 +62,9 @@ prompt MinimumRecommendedRules.ruleset + + OnBuildSuccess +