From 2f42e7dd83ddcd8cd71dea3211236b08abf1f1c0 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Wed, 10 Apr 2013 22:08:55 -0700 Subject: [PATCH] fixed some broken tests. --- .../JobTests/AppUpdateJobFixture.cs | 32 +++++++++---------- .../ParserTests/QualityParserFixture.cs | 3 +- NzbDrone.Core/Lifecycle/AppUpdateJob.cs | 2 +- NzbDrone.Core/Organizer/FileNameBuilder.cs | 2 +- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/NzbDrone.Core.Test/JobTests/AppUpdateJobFixture.cs b/NzbDrone.Core.Test/JobTests/AppUpdateJobFixture.cs index 3d6a4773a..62921746a 100644 --- a/NzbDrone.Core.Test/JobTests/AppUpdateJobFixture.cs +++ b/NzbDrone.Core.Test/JobTests/AppUpdateJobFixture.cs @@ -44,10 +44,10 @@ namespace NzbDrone.Core.Test.JobTests { Mocker.GetMock().Setup(c => c.FolderExists(SANDBOX_FOLDER)).Returns(true); - + StartUpdate(); - + Mocker.GetMock().Verify(c => c.DeleteFolder(SANDBOX_FOLDER, true)); } @@ -56,10 +56,10 @@ namespace NzbDrone.Core.Test.JobTests { Mocker.GetMock().Setup(c => c.FolderExists(SANDBOX_FOLDER)).Returns(false); - + StartUpdate(); - + Mocker.GetMock().Verify(c => c.DeleteFolder(SANDBOX_FOLDER, true), Times.Never()); } @@ -69,10 +69,10 @@ namespace NzbDrone.Core.Test.JobTests { var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName); - + StartUpdate(); - + Mocker.GetMock().Verify( c => c.DownloadFile(updatePackage.Url, updateArchive)); } @@ -82,10 +82,10 @@ namespace NzbDrone.Core.Test.JobTests { var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName); - + StartUpdate(); - + Mocker.GetMock().Verify( c => c.ExtractArchive(updateArchive, SANDBOX_FOLDER)); } @@ -95,10 +95,10 @@ namespace NzbDrone.Core.Test.JobTests { var updateClientFolder = Mocker.GetMock().Object.GetUpdateClientFolder(); - + StartUpdate(); - + Mocker.GetMock().Verify( c => c.MoveDirectory(updateClientFolder, SANDBOX_FOLDER)); } @@ -106,16 +106,16 @@ namespace NzbDrone.Core.Test.JobTests [Test] public void should_start_update_client() { - + var updateClientPath = Mocker.GetMock().Object.GetUpdateClientExePath(); Mocker.GetMock() .SetupGet(c => c.NzbDroneProcessIdFromEnvironment).Returns(12); - + StartUpdate(); - + Mocker.GetMock().Verify( c => c.Start(It.Is(p => p.FileName == updateClientPath && @@ -143,15 +143,15 @@ namespace NzbDrone.Core.Test.JobTests var updateSubFolder = new DirectoryInfo(Mocker.GetMock().Object.GetUpdateSandboxFolder()); - + updateSubFolder.Exists.Should().BeFalse(); - Mocker.Resolve(); + Mocker.SetConstant(new HttpProvider(new EnvironmentProvider())); Mocker.Resolve(); Mocker.Resolve(); StartUpdate(); updateSubFolder.Refresh(); - + updateSubFolder.Exists.Should().BeTrue(); updateSubFolder.GetDirectories("nzbdrone").Should().HaveCount(1); diff --git a/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs b/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs index ae2914fb4..00c1d2621 100644 --- a/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs +++ b/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs @@ -20,7 +20,7 @@ namespace NzbDrone.Core.Test.ParserTests new object[] { "WEEDS.S03E01-06.DUAL.BDRip.X-viD.AC3.-HELLYWOOD", Quality.DVD, false }, new object[] { "WEEDS.S03E01-06.DUAL.BDRip.AC3.-HELLYWOOD", Quality.DVD, false }, new object[] { "Two.and.a.Half.Men.S08E05.720p.HDTV.X264-DIMENSION", Quality.HDTV720p, false }, - new object[] { "this has no extention or periods HDTV", Quality.SDTV, false }, + new object[] { "Chuck S11E03 has no periods or extention HDTV", Quality.SDTV, false }, new object[] { "Chuck.S04E05.HDTV.XviD-LOL", Quality.SDTV, false }, new object[] { "The.Girls.Next.Door.S03E06.DVDRip.XviD-WiDE", Quality.DVD, false }, new object[] { "The.Girls.Next.Door.S03E06.DVD.Rip.XviD-WiDE", Quality.DVD, false }, @@ -41,7 +41,6 @@ namespace NzbDrone.Core.Test.ParserTests new object[] { "WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", Quality.DVD, false }, new object[] { "WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", Quality.DVD, false }, new object[] { "Law & Order: Special Victims Unit - 11x11 - Quickie", Quality.Unknown, false }, - new object[] { "(NZB)", Quality.Unknown, false }, new object[] { "S07E23 - [HDTV-720p].mkv ", Quality.HDTV720p, false }, new object[] { "S07E23 - [WEBDL].mkv ", Quality.WEBDL720p, false }, new object[] { "S07E23.mkv ", Quality.HDTV720p, false }, diff --git a/NzbDrone.Core/Lifecycle/AppUpdateJob.cs b/NzbDrone.Core/Lifecycle/AppUpdateJob.cs index ee94d5c0a..2583bf191 100644 --- a/NzbDrone.Core/Lifecycle/AppUpdateJob.cs +++ b/NzbDrone.Core/Lifecycle/AppUpdateJob.cs @@ -23,7 +23,7 @@ namespace NzbDrone.Core.Lifecycle private static readonly Logger logger = LogManager.GetCurrentClassLogger(); public AppUpdateJob(UpdateProvider updateProvider, EnvironmentProvider environmentProvider, DiskProvider diskProvider, - HttpProvider httpProvider, ProcessProvider processProvider, ArchiveProvider archiveProvider, ConfigFileProvider configFileProvider) + IHttpProvider httpProvider, ProcessProvider processProvider, ArchiveProvider archiveProvider, ConfigFileProvider configFileProvider) { _updateProvider = updateProvider; _environmentProvider = environmentProvider; diff --git a/NzbDrone.Core/Organizer/FileNameBuilder.cs b/NzbDrone.Core/Organizer/FileNameBuilder.cs index fc10a8202..4d44ef5cc 100644 --- a/NzbDrone.Core/Organizer/FileNameBuilder.cs +++ b/NzbDrone.Core/Organizer/FileNameBuilder.cs @@ -116,7 +116,7 @@ namespace NzbDrone.Core.Organizer if (nameSpec.AppendQuality) { - result += String.Format(" [{0}]", episodeFile.Quality); + result += String.Format(" [{0}]", episodeFile.Quality.Quality); if (episodeFile.Quality.Proper) result += " [Proper]";