@ -1,6 +1,7 @@
// ReSharper disable RedundantUsingDirective
using System ;
using MbUnit.Framework ;
using FluentAssertions ;
using NUnit.Framework ;
using NzbDrone.Core.Repository.Quality ;
using NzbDrone.Core.Test.Framework ;
@ -21,27 +22,27 @@ namespace NzbDrone.Core.Test
[Test]
[ Row ("Sonny.With.a.Chance.S02E15", "Sonny.With.a.Chance", 2, 15)]
[ Row ("Two.and.a.Half.Me.103.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Me", 1, 3)]
[ Row ("Two.and.a.Half.Me.113.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Me", 1, 13)]
[ Row ("Two.and.a.Half.Me.1013.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Me", 10, 13)]
[ Row ("Chuck.4x05.HDTV.XviD-LOL", "Chuck", 4, 5)]
[ Row ("The.Girls.Next.Door.S03E06.DVDRip.XviD-WiDE", "The.Girls.Next.Door", 3, 6)]
[ Row ("Degrassi.S10E27.WS.DSR.XviD-2HD", "Degrassi", 10, 27)]
[ Row ("Parenthood.2010.S02E14.HDTV.XviD-LOL", "Parenthood 2010", 2, 14)]
[ Row ("Hawaii Five 0 S01E19 720p WEB DL DD5 1 H 264 NT", "Hawaii Five", 1, 19)]
[ Row ("The Event S01E14 A Message Back 720p WEB DL DD5 1 H264 SURFER", "The Event", 1, 14)]
[ Row ("Adam Hills In Gordon St Tonight S01E07 WS PDTV XviD FUtV", "Adam Hills In Gordon St Tonight", 1, 7)]
[ Row ("Adam Hills In Gordon St Tonight S01E07 WS PDTV XviD FUtV", "Adam Hills In Gordon St Tonight", 1, 7)]
[ Row ("Adventure.Inc.S03E19.DVDRip.XviD-OSiTV", "Adventure.Inc", 3, 19)]
[ Row ("S03E09 WS PDTV XviD FUtV", "", 3, 9)]
[ Row ("5x10 WS PDTV XviD FUtV", "", 5, 10)]
[ Row ("Castle.2009.S01E14.HDTV.XviD-LOL", "Castle 2009", 1, 14)]
[ Row ("Pride.and.Prejudice.1995.S03E20.HDTV.XviD-LOL", "Pride and Prejudice 1995", 3, 20)]
[ 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)]
[ TestCase ("Two.and.a.Half.Me.1013.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Me", 10, 13)]
[ TestCase ("Chuck.4x05.HDTV.XviD-LOL", "Chuck", 4, 5)]
[ TestCase ("The.Girls.Next.Door.S03E06.DVDRip.XviD-WiDE", "The.Girls.Next.Door", 3, 6)]
[ TestCase ("Degrassi.S10E27.WS.DSR.XviD-2HD", "Degrassi", 10, 27)]
[ TestCase ("Parenthood.2010.S02E14.HDTV.XviD-LOL", "Parenthood 2010", 2, 14)]
[ TestCase ("Hawaii Five 0 S01E19 720p WEB DL DD5 1 H 264 NT", "Hawaii Five", 1, 19)]
[ TestCase ("The Event S01E14 A Message Back 720p WEB DL DD5 1 H264 SURFER", "The Event", 1, 14)]
[ TestCase ("Adam Hills In Gordon St Tonight S01E07 WS PDTV XviD FUtV", "Adam Hills In Gordon St Tonight", 1, 7)]
[ TestCase ("Adam Hills In Gordon St Tonight S01E07 WS PDTV XviD FUtV", "Adam Hills In Gordon St Tonight", 1, 7)]
[ TestCase ("Adventure.Inc.S03E19.DVDRip.XviD-OSiTV", "Adventure.Inc", 3, 19)]
[ TestCase ("S03E09 WS PDTV XviD FUtV", "", 3, 9)]
[ TestCase ("5x10 WS PDTV XviD FUtV", "", 5, 10)]
[ TestCase ("Castle.2009.S01E14.HDTV.XviD-LOL", "Castle 2009", 1, 14)]
[ TestCase ("Pride.and.Prejudice.1995.S03E20.HDTV.XviD-LOL", "Pride and Prejudice 1995", 3, 20)]
//[Row(@"Season 4\07 WS PDTV XviD FUtV", "", 4, 7)]
[ Row ("The.Office.S03E115.DVDRip.XviD-OSiTV", "The.Office", 3, 115)]
[ Row (@"Parks and Recreation - S02E21 - 94 Meetings - 720p TV.mkv", "Parks and Recreation", 2, 21)]
[ Row (@"24-7 Penguins-Capitals- Road to the NHL Winter Classic - S01E03 - Episode 3.mkv", "24-7 Penguins-Capitals- Road to the NHL Winter Classic", 1, 3)]
[ TestCase ("The.Office.S03E115.DVDRip.XviD-OSiTV", "The.Office", 3, 115)]
[ TestCase (@"Parks and Recreation - S02E21 - 94 Meetings - 720p TV.mkv", "Parks and Recreation", 2, 21)]
[ TestCase (@"24-7 Penguins-Capitals- Road to the NHL Winter Classic - S01E03 - Episode 3.mkv", "24-7 Penguins-Capitals- Road to the NHL Winter Classic", 1, 3)]
public void episode_parse ( string postTitle , string title , int season , int episode )
{
var result = Parser . ParseEpisodeInfo ( postTitle ) ;
@ -52,51 +53,51 @@ namespace NzbDrone.Core.Test
}
[Test]
[ Row (@"z:\tv shows\battlestar galactica (2003)\Season 3\S03E05 - Collaborators.mkv", 3, 5)]
[ Row (@"z:\tv shows\modern marvels\Season 16\S16E03 - The Potato.mkv", 16, 3)]
[ Row (@"z:\tv shows\robot chicken\Specials\S00E16 - Dear Consumer - SD TV.avi", 0, 16)]
[ Row (@"D:\shares\TV Shows\Parks And Recreation\Season 2\S02E21 - 94 Meetings - 720p TV.mkv", 2, 21)]
[ Row (@"D:\shares\TV Shows\Battlestar Galactica (2003)\Season 2\S02E21.avi", 2, 21)]
[ TestCase (@"z:\tv shows\battlestar galactica (2003)\Season 3\S03E05 - Collaborators.mkv", 3, 5)]
[ TestCase (@"z:\tv shows\modern marvels\Season 16\S16E03 - The Potato.mkv", 16, 3)]
[ TestCase (@"z:\tv shows\robot chicken\Specials\S00E16 - Dear Consumer - SD TV.avi", 0, 16)]
[ TestCase (@"D:\shares\TV Shows\Parks And Recreation\Season 2\S02E21 - 94 Meetings - 720p TV.mkv", 2, 21)]
[ TestCase (@"D:\shares\TV Shows\Battlestar Galactica (2003)\Season 2\S02E21.avi", 2, 21)]
public void file_path_parse ( string path , int season , int episode )
{
var result = Parser . ParseEpisodeInfo ( path ) ;
Assert. Count ( 1 , result . EpisodeNumbers ) ;
result. EpisodeNumbers . Should ( ) . HaveCount ( 1 ) ;
Assert . AreEqual ( season , result . SeasonNumber ) ;
Assert . AreEqual ( episode , result . EpisodeNumbers [ 0 ] ) ;
}
[Test]
[ Row ("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", QualityTypes.DVD)]
[ Row ("WEEDS.S03E01-06.DUAL.BDRip.X-viD.AC3.-HELLYWOOD", QualityTypes.DVD)]
[ Row ("WEEDS.S03E01-06.DUAL.BDRip.AC3.-HELLYWOOD", QualityTypes.DVD)]
[ Row ("Two.and.a.Half.Men.S08E05.720p.HDTV.X264-DIMENSION", QualityTypes.HDTV)]
[ Row ("this has no extention or periods HDTV", QualityTypes.SDTV)]
[ Row ("Chuck.S04E05.HDTV.XviD-LOL", QualityTypes.SDTV)]
[ Row ("The.Girls.Next.Door.S03E06.DVDRip.XviD-WiDE", QualityTypes.DVD)]
[ Row ("The.Girls.Next.Door.S03E06.DVD.Rip.XviD-WiDE", QualityTypes.DVD)]
[ Row ("The.Girls.Next.Door.S03E06.HDTV-WiDE", QualityTypes.SDTV)]
[ Row ("Degrassi.S10E27.WS.DSR.XviD-2HD", QualityTypes.SDTV)]
[ Row ("Sonny.With.a.Chance.S02E15.720p.WEB-DL.DD5.1.H.264-SURFER", QualityTypes.WEBDL)]
[ Row ("Sonny.With.a.Chance.S02E15.720p", QualityTypes.HDTV)]
[ Row ("Sonny.With.a.Chance.S02E15.mkv", QualityTypes.HDTV)]
[ Row ("Sonny.With.a.Chance.S02E15.avi", QualityTypes.SDTV)]
[ Row ("Sonny.With.a.Chance.S02E15.xvid", QualityTypes.SDTV)]
[ Row ("Sonny.With.a.Chance.S02E15.divx", QualityTypes.SDTV)]
[ Row ("Sonny.With.a.Chance.S02E15", QualityTypes.Unknown)]
[ Row ("Chuck - S01E04 - So Old - Playdate - 720p TV.mkv", QualityTypes.HDTV)]
[ Row ("Chuck - S22E03 - MoneyBART - HD TV.mkv", QualityTypes.HDTV)]
[ Row ("Chuck - S01E03 - Come Fly With Me - 720p BluRay.mkv", QualityTypes.Bluray720p)]
[ Row ("Chuck - S01E03 - Come Fly With Me - 1080p BluRay.mkv", QualityTypes.Bluray1080p)]
[ Row ("Chuck - S11E06 - D-Yikes! - 720p WEB-DL.mkv", QualityTypes.WEBDL)]
[ Row ("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", QualityTypes.DVD)]
[ Row ("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", QualityTypes.DVD)]
[ Row ("Law & Order: Special Victims Unit - 11x11 - Quickie", QualityTypes.Unknown)]
[ Row ("(<a href=\"http://www.newzbin.com/browse/post/6076286/nzb/\">NZB</a>)", QualityTypes.Unknown)]
[ Row ("S07E23 - [HDTV]. mkv ", QualityTypes.HDTV)]
[ Row ("S07E23 - [WEBDL]. mkv ", QualityTypes.WEBDL)]
[ Row ("S07E23.mkv ", QualityTypes.HDTV)]
[ Row ("S07E23 .avi ", QualityTypes.SDTV)]
[ 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)]
[ TestCase ("Two.and.a.Half.Men.S08E05.720p.HDTV.X264-DIMENSION", QualityTypes.HDTV)]
[ TestCase ("this has no extention or periods HDTV", QualityTypes.SDTV)]
[ TestCase ("Chuck.S04E05.HDTV.XviD-LOL", QualityTypes.SDTV)]
[ TestCase ("The.Girls.Next.Door.S03E06.DVDRip.XviD-WiDE", QualityTypes.DVD)]
[ TestCase ("The.Girls.Next.Door.S03E06.DVD.Rip.XviD-WiDE", QualityTypes.DVD)]
[ TestCase ("The.Girls.Next.Door.S03E06.HDTV-WiDE", QualityTypes.SDTV)]
[ TestCase ("Degrassi.S10E27.WS.DSR.XviD-2HD", QualityTypes.SDTV)]
[ TestCase ("Sonny.With.a.Chance.S02E15.720p.WEB-DL.DD5.1.H.264-SURFER", QualityTypes.WEBDL)]
[ TestCase ("Sonny.With.a.Chance.S02E15.720p", QualityTypes.HDTV)]
[ TestCase ("Sonny.With.a.Chance.S02E15.mkv", QualityTypes.HDTV)]
[ TestCase ("Sonny.With.a.Chance.S02E15.avi", QualityTypes.SDTV)]
[ TestCase ("Sonny.With.a.Chance.S02E15.xvid", QualityTypes.SDTV)]
[ TestCase ("Sonny.With.a.Chance.S02E15.divx", QualityTypes.SDTV)]
[ TestCase ("Sonny.With.a.Chance.S02E15", QualityTypes.Unknown)]
[ TestCase ("Chuck - S01E04 - So Old - Playdate - 720p TV.mkv", QualityTypes.HDTV)]
[ TestCase ("Chuck - S22E03 - MoneyBART - HD TV.mkv", QualityTypes.HDTV)]
[ TestCase ("Chuck - S01E03 - Come Fly With Me - 720p BluRay.mkv", QualityTypes.Bluray720p)]
[ TestCase ("Chuck - S01E03 - Come Fly With Me - 1080p BluRay.mkv", QualityTypes.Bluray1080p)]
[ TestCase ("Chuck - S11E06 - D-Yikes! - 720p WEB-DL.mkv", QualityTypes.WEBDL)]
[ TestCase ("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", QualityTypes.DVD)]
[ TestCase ("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", QualityTypes.DVD)]
[ TestCase ("Law & Order: Special Victims Unit - 11x11 - Quickie", QualityTypes.Unknown)]
[ TestCase ("(<a href=\"http://www.newzbin.com/browse/post/6076286/nzb/\">NZB</a>)", QualityTypes.Unknown)]
[ TestCase ("S07E23 - [HDTV]. mkv ", QualityTypes.HDTV)]
[ TestCase ("S07E23 - [WEBDL]. mkv ", QualityTypes.WEBDL)]
[ TestCase ("S07E23.mkv ", QualityTypes.HDTV)]
[ TestCase ("S07E23 .avi ", QualityTypes.SDTV)]
public void quality_parse ( string postTitle , object quality )
{
var result = Parser . ParseQuality ( postTitle ) ;
@ -127,31 +128,31 @@ namespace NzbDrone.Core.Test
}
[Test]
[Timeout(1 )]
[ Row ("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", "WEEDS", 3, new[] { 1 , 2 , 3 , 4 , 5 , 6 } , 6 ) ]
[ Row ("Two.and.a.Half.Men.103.104.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Men", 1, new[] { 3 , 4 } , 2 ) ]
[ Row ("Weeds.S03E01.S03E02.720p.HDTV.X264-DIMENSION", "Weeds", 3, new[] { 1 , 2 } , 2 ) ]
[ Row ("The Borgias S01e01 e02 ShoHD On Demand 1080i DD5 1 ALANiS", "The Borgias", 1, new[] { 1 , 2 } , 2 ) ]
[ Row ("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 ) ]
[ Row ("White.Collar.2x04.2x05.720p.BluRay-FUTV", "White.Collar", 2, new[] { 4 , 5 } , 2 ) ]
[Timeout(1 000 )]
[ 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 ) ]
[ TestCase ("Weeds.S03E01.S03E02.720p.HDTV.X264-DIMENSION", "Weeds", 3, new[] { 1 , 2 } , 2 ) ]
[ 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 ) ]
//[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 )
{
var result = Parser . ParseEpisodeInfo ( postTitle ) ;
Assert . AreEqual ( season , result . SeasonNumber ) ;
Assert. Count ( episodes . Length , result . EpisodeNumber s) ;
Assert. AreElementsEqualIgnoringOrder ( episodes , result . EpisodeNumbers ) ;
result. EpisodeNumbers . Should ( ) . HaveSameCount ( episode s) ;
result. EpisodeNumbers . Should ( ) . BeEquivalentTo ( result . EpisodeNumbers ) ;
Assert . AreEqual ( Parser . NormalizeTitle ( title ) , result . CleanTitle ) ;
Assert . AreEqual ( count , result . EpisodeNumbers . Count ) ;
}
[Test]
[ Row ("Conan 2011 04 18 Emma Roberts HDTV XviD BFF", "Conan", 2011, 04, 18)]
[ Row ("The Tonight Show With Jay Leno 2011 04 15 1080i HDTV DD5 1 MPEG2 TrollHD", "The Tonight Show With Jay Leno", 2011, 04, 15)]
[ Row ("The.Daily.Show.2010.10.11.Johnny.Knoxville.iTouch-MW", "The.Daily.Show", 2010, 10, 11)]
[ Row ("The Daily Show - 2011-04-12 - Gov. Deval Patrick", "The.Daily.Show", 2011, 04, 12)]
[ Row ("2011.01.10 - Denis Leary - HD TV.mkv", "", 2011, 1, 10)]
[ Row ("2011.03.13 - Denis Leary - HD TV.mkv", "", 2011, 3, 13)]
[ 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)]
[ TestCase ("The Daily Show - 2011-04-12 - Gov. Deval Patrick", "The.Daily.Show", 2011, 04, 12)]
[ TestCase ("2011.01.10 - Denis Leary - HD TV.mkv", "", 2011, 1, 10)]
[ TestCase ("2011.03.13 - Denis Leary - HD TV.mkv", "", 2011, 3, 13)]
public void episode_daily_parse ( string postTitle , string title , int year , int month , int day )
{
var result = Parser . ParseEpisodeInfo ( postTitle ) ;
@ -163,9 +164,9 @@ namespace NzbDrone.Core.Test
[Test]
[ Row ("30.Rock.Season.04.HDTV.XviD-DIMENSION", "30.Rock", 4)]
[ Row ("Parks.and.Recreation.S02.720p.x264-DIMENSION", "Parks.and.Recreation", 2)]
[ Row ("The.Office.US.S03.720p.x264-DIMENSION", "The.Office.US", 3)]
[ 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)]
public void full_season_release_parse ( string postTitle , string title , int season )
{
var result = Parser . ParseEpisodeInfo ( postTitle ) ;
@ -175,11 +176,11 @@ namespace NzbDrone.Core.Test
}
[Test]
[ Row ("Conan", "conan")]
[ Row ("The Tonight Show With Jay Leno", "tonightshowwithjayleno")]
[ Row ("The.Daily.Show", "dailyshow")]
[ Row ("Castle (2009)", "castle2009")]
[ Row ("Parenthood.2010", "parenthood2010")]
[ TestCase ("Conan", "conan")]
[ TestCase ("The Tonight Show With Jay Leno", "tonightshowwithjayleno")]
[ TestCase ("The.Daily.Show", "dailyshow")]
[ TestCase ("Castle (2009)", "castle2009")]
[ TestCase ("Parenthood.2010", "parenthood2010")]
public void series_name_normalize ( string parsedSeriesName , string seriesName )
{
var result = Parser . NormalizeTitle ( parsedSeriesName ) ;
@ -187,11 +188,11 @@ namespace NzbDrone.Core.Test
}
[Test]
[ Row (@"c:\test\", @"c:\test")]
[ Row (@"c:\\test\\", @"c:\test")]
[ Row (@"C:\\Test\\", @"C:\Test")]
[ Row (@"C:\\Test\\Test\", @"C:\Test\Test")]
[ Row (@"\\Testserver\Test\", @"\\Testserver\Test")]
[ TestCase (@"c:\test\", @"c:\test")]
[ TestCase (@"c:\\test\\", @"c:\test")]
[ TestCase (@"C:\\Test\\", @"C:\Test")]
[ TestCase (@"C:\\Test\\Test\", @"C:\Test\Test")]
[ TestCase (@"\\Testserver\Test\", @"\\Testserver\Test")]
public void Normalize_Path ( string dirty , string clean )
{
var result = Parser . NormalizePath ( dirty ) ;
@ -199,9 +200,9 @@ namespace NzbDrone.Core.Test
}
[Test]
[ Row ("CaPitAl", "capital")]
[ Row ("peri.od", "period")]
[ Row ("this.^&%^**$%@#$!That", "thisthat")]
[ TestCase ("CaPitAl", "capital")]
[ TestCase ("peri.od", "period")]
[ TestCase ("this.^&%^**$%@#$!That", "thisthat")]
public void Normalize_Title ( string dirty , string clean )
{
var result = Parser . NormalizeTitle ( dirty ) ;
@ -209,12 +210,12 @@ namespace NzbDrone.Core.Test
}
[Test]
[ Row ("the")]
[ Row ("and")]
[ Row ("or")]
[ Row ("a")]
[ Row ("an")]
[ Row ("of")]
[ TestCase ("the")]
[ TestCase ("and")]
[ TestCase ("or")]
[ TestCase ("a")]
[ TestCase ("an")]
[ TestCase ("of")]
public void Normalize_removed_common_words ( string word )
{
var dirtyFormat = new [ ]
@ -239,12 +240,12 @@ namespace NzbDrone.Core.Test
}
[Test]
[ Row ("the")]
[ Row ("and")]
[ Row ("or")]
[ Row ("a")]
[ Row ("an")]
[ Row ("of")]
[ TestCase ("the")]
[ TestCase ("and")]
[ TestCase ("or")]
[ TestCase ("a")]
[ TestCase ("an")]
[ TestCase ("of")]
public void Normalize_not_removed_common_words_in_the_middle ( string word )
{
var dirtyFormat = new [ ]