From c5c7e1eb76c7c5a05d33cc0d350250846a95b636 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sun, 12 Jun 2011 21:20:29 -0700 Subject: [PATCH] Fixed multi testcase tests. --- NzbDrone.Core.Test/EpisodeSearchJobTest.cs | 2 +- NzbDrone.Core.Test/EpisodeStatusTest.cs | 6 ++--- NzbDrone.Core.Test/IndexerTests.cs | 6 ++--- .../InventoryProvider_QualityNeededTest.cs | 23 +++++++++--------- NzbDrone.Core.Test/ParserTest.cs | 23 +++++++----------- NzbDrone.Core.Test/SabProviderTest.cs | 2 +- NzbDrone.Core.Test/SeriesProviderTest.cs | Bin 6332 -> 6325 bytes NzbDrone.Core/Providers/RootDirProvider.cs | 4 +-- 8 files changed, 29 insertions(+), 37 deletions(-) diff --git a/NzbDrone.Core.Test/EpisodeSearchJobTest.cs b/NzbDrone.Core.Test/EpisodeSearchJobTest.cs index 4c69d505c..1faab1de6 100644 --- a/NzbDrone.Core.Test/EpisodeSearchJobTest.cs +++ b/NzbDrone.Core.Test/EpisodeSearchJobTest.cs @@ -199,7 +199,7 @@ namespace NzbDrone.Core.Test } - [Test] + [TestCase(0)] [TestCase(-1)] [TestCase(-100)] diff --git a/NzbDrone.Core.Test/EpisodeStatusTest.cs b/NzbDrone.Core.Test/EpisodeStatusTest.cs index 56bca1510..62ae0d2b1 100644 --- a/NzbDrone.Core.Test/EpisodeStatusTest.cs +++ b/NzbDrone.Core.Test/EpisodeStatusTest.cs @@ -13,7 +13,7 @@ namespace NzbDrone.Core.Test // ReSharper disable InconsistentNaming public class EpisodeStatusTest : TestBase { - [Test] + [TestCase(1, false, false, EpisodeStatusType.NotAired)] [TestCase(-2, false, false, EpisodeStatusType.Missing)] [TestCase(1, true, false, EpisodeStatusType.Ready)] @@ -36,7 +36,6 @@ namespace NzbDrone.Core.Test } - [Test] [TestCase(1, false, false, EpisodeStatusType.Missing)] [TestCase(-2, false, false, EpisodeStatusType.Missing)] [TestCase(1, true, false, EpisodeStatusType.Ready)] @@ -59,7 +58,6 @@ namespace NzbDrone.Core.Test } - [Test] [TestCase(1, false, false, EpisodeStatusType.Downloading)] [TestCase(-2, false, false, EpisodeStatusType.Downloading)] [TestCase(1, true, false, EpisodeStatusType.Downloading)] @@ -83,7 +81,7 @@ namespace NzbDrone.Core.Test Assert.AreEqual(status, episode.Status); } - [Test] + [TestCase(1, true, false, EpisodeStatusType.Ignored)] [TestCase(-2, true, false, EpisodeStatusType.Ignored)] [TestCase(1, true, true, EpisodeStatusType.Ready)] diff --git a/NzbDrone.Core.Test/IndexerTests.cs b/NzbDrone.Core.Test/IndexerTests.cs index 50ac36d16..fce620b40 100644 --- a/NzbDrone.Core.Test/IndexerTests.cs +++ b/NzbDrone.Core.Test/IndexerTests.cs @@ -23,7 +23,7 @@ namespace NzbDrone.Core.Test // ReSharper disable InconsistentNaming public class IndexerTests : TestBase { - [Test] + [TestCase("nzbsorg.xml", 0)] [TestCase("nzbsrus.xml", 6)] [TestCase("newzbin.xml", 1)] @@ -90,7 +90,7 @@ namespace NzbDrone.Core.Test ExceptionVerification.ExcpectedWarns(1); } - [Test] + [TestCase("Adventure.Inc.S03E19.DVDRip.XviD-OSiTV", 3, 19, QualityTypes.DVD)] public void custome_parser_partial_success(string title, int season, int episode, QualityTypes quality) { @@ -117,7 +117,7 @@ namespace NzbDrone.Core.Test Assert.AreEqual(quality, result.Quality.QualityType); } - [Test] + [TestCase("Adventure.Inc.DVDRip.XviD-OSiTV")] public void custome_parser_full_parse(string title) { diff --git a/NzbDrone.Core.Test/InventoryProvider_QualityNeededTest.cs b/NzbDrone.Core.Test/InventoryProvider_QualityNeededTest.cs index bfb286f42..ca03ab27c 100644 --- a/NzbDrone.Core.Test/InventoryProvider_QualityNeededTest.cs +++ b/NzbDrone.Core.Test/InventoryProvider_QualityNeededTest.cs @@ -205,18 +205,17 @@ namespace NzbDrone.Core.Test } //Should Download - [Test] - [TestCase(QualityTypes.SDTV, true, QualityTypes.HDTV, false, true)] - [TestCase(QualityTypes.DVD, true, QualityTypes.Bluray720p, true, true)] - [TestCase(QualityTypes.HDTV, false, QualityTypes.HDTV, true, true)] - [TestCase(QualityTypes.HDTV, false, QualityTypes.HDTV, false, false)] - [TestCase(QualityTypes.Bluray720p, true, QualityTypes.Bluray1080p, false, false)] - [TestCase(QualityTypes.HDTV, true, QualityTypes.Bluray720p, true, true)] - [TestCase(QualityTypes.Bluray1080p, true, QualityTypes.Bluray720p, true, false)] - [TestCase(QualityTypes.Bluray1080p, true, QualityTypes.Bluray720p, false, false)] - [TestCase(QualityTypes.Bluray1080p, false, QualityTypes.Bluray720p, true, false)] - [TestCase(QualityTypes.HDTV, false, QualityTypes.Bluray720p, true, true)] - [TestCase(QualityTypes.HDTV, true, QualityTypes.HDTV, false, false)] + [TestCase(QualityTypes.SDTV, true, QualityTypes.HDTV, false, true)] + [TestCase(QualityTypes.DVD, true, QualityTypes.Bluray720p, true, true)] + [TestCase(QualityTypes.HDTV, false, QualityTypes.HDTV, true, true)] + [TestCase(QualityTypes.HDTV, false, QualityTypes.HDTV, false, false)] + [TestCase(QualityTypes.Bluray720p, true, QualityTypes.Bluray1080p, false, false)] + [TestCase(QualityTypes.HDTV, true, QualityTypes.Bluray720p, true, true)] + [TestCase(QualityTypes.Bluray1080p, true, QualityTypes.Bluray720p, true, false)] + [TestCase(QualityTypes.Bluray1080p, true, QualityTypes.Bluray720p, false, false)] + [TestCase(QualityTypes.Bluray1080p, false, QualityTypes.Bluray720p, true, false)] + [TestCase(QualityTypes.HDTV, false, QualityTypes.Bluray720p, true, true)] + [TestCase(QualityTypes.HDTV, true, QualityTypes.HDTV, false, false)] public void Is_upgrade(QualityTypes fileQuality, bool isFileProper, QualityTypes reportQuality, bool isReportProper, bool excpected) { diff --git a/NzbDrone.Core.Test/ParserTest.cs b/NzbDrone.Core.Test/ParserTest.cs index eefe09956..62928349a 100644 --- a/NzbDrone.Core.Test/ParserTest.cs +++ b/NzbDrone.Core.Test/ParserTest.cs @@ -18,10 +18,6 @@ namespace NzbDrone.Core.Test */ - - - - [Test] [TestCase("Sonny.With.a.Chance.S02E15", "Sonny.With.a.Chance", 2, 15)] [TestCase("Two.and.a.Half.Me.103.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Me", 1, 3)] [TestCase("Two.and.a.Half.Me.113.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Me", 1, 13)] @@ -67,7 +63,6 @@ namespace NzbDrone.Core.Test } - [Test] [TestCase("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", QualityTypes.DVD)] [TestCase("WEEDS.S03E01-06.DUAL.BDRip.X-viD.AC3.-HELLYWOOD", QualityTypes.DVD)] [TestCase("WEEDS.S03E01-06.DUAL.BDRip.AC3.-HELLYWOOD", QualityTypes.DVD)] @@ -127,7 +122,7 @@ namespace NzbDrone.Core.Test } } - [Test] + [Timeout(1000)] [TestCase("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", "WEEDS", 3, new[] { 1, 2, 3, 4, 5, 6 }, 6)] [TestCase("Two.and.a.Half.Men.103.104.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Men", 1, new[] { 3, 4 }, 2)] @@ -135,7 +130,7 @@ namespace NzbDrone.Core.Test [TestCase("The Borgias S01e01 e02 ShoHD On Demand 1080i DD5 1 ALANiS", "The Borgias", 1, new[] { 1, 2 }, 2)] [TestCase("Big Time Rush 1x01 to 10 480i DD2 0 Sianto", "Big Time Rush", 1, new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, 10)] [TestCase("White.Collar.2x04.2x05.720p.BluRay-FUTV", "White.Collar", 2, new[] { 4, 5 }, 2)] - [TestCase("Desperate.Housewives.S07E22E23.720p.HDTV.X264-DIMENSION", "Desperate.Housewives", 7, new[] { 22,23 }, 2)] + [TestCase("Desperate.Housewives.S07E22E23.720p.HDTV.X264-DIMENSION", "Desperate.Housewives", 7, new[] { 22, 23 }, 2)] //[Row("The.Kennedys.Part.1.and.Part.2.DSR.XviD-SYS", 1, new[] { 1, 2 })] public void episode_multipart_parse(string postTitle, string title, int season, int[] episodes, int count) { @@ -147,7 +142,7 @@ namespace NzbDrone.Core.Test Assert.AreEqual(count, result.EpisodeNumbers.Count); } - [Test] + [TestCase("Conan 2011 04 18 Emma Roberts HDTV XviD BFF", "Conan", 2011, 04, 18)] [TestCase("The Tonight Show With Jay Leno 2011 04 15 1080i HDTV DD5 1 MPEG2 TrollHD", "The Tonight Show With Jay Leno", 2011, 04, 15)] [TestCase("The.Daily.Show.2010.10.11.Johnny.Knoxville.iTouch-MW", "The.Daily.Show", 2010, 10, 11)] @@ -164,7 +159,7 @@ namespace NzbDrone.Core.Test } - [Test] + [TestCase("30.Rock.Season.04.HDTV.XviD-DIMENSION", "30.Rock", 4)] [TestCase("Parks.and.Recreation.S02.720p.x264-DIMENSION", "Parks.and.Recreation", 2)] [TestCase("The.Office.US.S03.720p.x264-DIMENSION", "The.Office.US", 3)] @@ -176,7 +171,7 @@ namespace NzbDrone.Core.Test Assert.AreEqual(0, result.EpisodeNumbers.Count); } - [Test] + [TestCase("Conan", "conan")] [TestCase("The Tonight Show With Jay Leno", "tonightshowwithjayleno")] [TestCase("The.Daily.Show", "dailyshow")] @@ -188,7 +183,7 @@ namespace NzbDrone.Core.Test Assert.AreEqual(seriesName, result); } - [Test] + [TestCase(@"c:\test\", @"c:\test")] [TestCase(@"c:\\test\\", @"c:\test")] [TestCase(@"C:\\Test\\", @"C:\Test")] @@ -200,7 +195,7 @@ namespace NzbDrone.Core.Test Assert.AreEqual(clean, result); } - [Test] + [TestCase("CaPitAl", "capital")] [TestCase("peri.od", "period")] [TestCase("this.^&%^**$%@#$!That", "thisthat")] @@ -210,7 +205,7 @@ namespace NzbDrone.Core.Test Assert.AreEqual(clean, result); } - [Test] + [TestCase("the")] [TestCase("and")] [TestCase("or")] @@ -240,7 +235,7 @@ namespace NzbDrone.Core.Test } - [Test] + [TestCase("the")] [TestCase("and")] [TestCase("or")] diff --git a/NzbDrone.Core.Test/SabProviderTest.cs b/NzbDrone.Core.Test/SabProviderTest.cs index e0675fd89..0f7601ad0 100644 --- a/NzbDrone.Core.Test/SabProviderTest.cs +++ b/NzbDrone.Core.Test/SabProviderTest.cs @@ -259,7 +259,7 @@ namespace NzbDrone.Core.Test mocker.Resolve().IsInQueue(String.Empty); } - [Test] + [TestCase(1, new[] { 2 }, "My Episode Title", QualityTypes.DVD, false, "My Series Name - 1x2 - My Episode Title [DVD]")] [TestCase(1, new[] { 2 }, "My Episode Title", QualityTypes.DVD, true, "My Series Name - 1x2 - My Episode Title [DVD] [Proper]")] [TestCase(1, new[] { 2 }, "", QualityTypes.DVD, true, "My Series Name - 1x2 - [DVD] [Proper]")] diff --git a/NzbDrone.Core.Test/SeriesProviderTest.cs b/NzbDrone.Core.Test/SeriesProviderTest.cs index 48d7d8c1e967f701a6f083baa7e5b2703b443f0b..bd5086dd611b37e33b25d5f056ac2bb5f63a3dd9 100644 GIT binary patch delta 16 XcmdmExYclj0pH{}KC#WdeED1eG_(a? delta 16 XcmdmLxW{mV0pDa99)Zo4d^KDEGA;!T diff --git a/NzbDrone.Core/Providers/RootDirProvider.cs b/NzbDrone.Core/Providers/RootDirProvider.cs index 1bb341d20..2e0baa4df 100644 --- a/NzbDrone.Core/Providers/RootDirProvider.cs +++ b/NzbDrone.Core/Providers/RootDirProvider.cs @@ -31,11 +31,11 @@ namespace NzbDrone.Core.Providers return _repository.All().ToList(); } - public virtual void Add(RootDir rootDir) + public virtual int Add(RootDir rootDir) { ValidatePath(rootDir); - _repository.Add(rootDir); + return (int)_repository.Add(rootDir); } public virtual void Remove(int rootDirId)