Cleanup Sonarr Regexes from Parser.cs

This commit is contained in:
Qstick
2017-11-01 21:23:29 -04:00
parent ef3234b5de
commit b5a8c342e5
5 changed files with 68 additions and 350 deletions
@@ -13,10 +13,10 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Castle (2009)", "castle2009")]
[TestCase("Parenthood.2010", "parenthood2010")]
[TestCase("Law_and_Order_SVU", "lawordersvu")]
public void should_normalize_series_title(string parsedSeriesName, string seriesName)
public void should_normalize_artist_title(string parsedArtistName, string artistName)
{
var result = parsedSeriesName.CleanSeriesTitle();
result.Should().Be(seriesName);
var result = parsedArtistName.CleanArtistName();
result.Should().Be(artistName);
}
[TestCase("CaPitAl", "capital")]
@@ -27,7 +27,7 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("24", "24")]
public void should_remove_special_characters_and_casing(string dirty, string clean)
{
var result = dirty.CleanSeriesTitle();
var result = dirty.CleanArtistName();
result.Should().Be(clean);
}
@@ -51,7 +51,7 @@ namespace NzbDrone.Core.Test.ParserTests
foreach (var s in dirtyFormat)
{
var dirty = string.Format(s, word);
dirty.CleanSeriesTitle().Should().Be("wordword");
dirty.CleanArtistName().Should().Be("wordword");
}
}
@@ -68,7 +68,7 @@ namespace NzbDrone.Core.Test.ParserTests
foreach (var s in dirtyFormat)
{
var dirty = string.Format(s, "a");
dirty.CleanSeriesTitle().Should().Be("wordword");
dirty.CleanArtistName().Should().Be("wordword");
}
}
@@ -93,7 +93,7 @@ namespace NzbDrone.Core.Test.ParserTests
foreach (var s in dirtyFormat)
{
var dirty = string.Format(s, word);
dirty.CleanSeriesTitle().Should().Be(("word" + word.ToLower() + "word"));
dirty.CleanArtistName().Should().Be(("word" + word.ToLower() + "word"));
}
}
@@ -101,10 +101,10 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("The Office", "theoffice")]
[TestCase("The Tonight Show With Jay Leno", "thetonightshowwithjayleno")]
[TestCase("The.Daily.Show", "thedailyshow")]
public void should_not_remove_from_the_beginning_of_the_title(string parsedSeriesName, string seriesName)
public void should_not_remove_from_the_beginning_of_the_title(string parsedArtistName, string artistName)
{
var result = parsedSeriesName.CleanSeriesTitle();
result.Should().Be(seriesName);
var result = parsedArtistName.CleanArtistName();
result.Should().Be(artistName);
}
[TestCase("the")]
@@ -125,14 +125,14 @@ namespace NzbDrone.Core.Test.ParserTests
foreach (var s in dirtyFormat)
{
var dirty = string.Format(s, word);
dirty.CleanSeriesTitle().Should().Be(word + "wordword");
dirty.CleanArtistName().Should().Be(word + "wordword");
}
}
[Test]
public void should_not_clean_trailing_a()
{
"Tokyo Ghoul A".CleanSeriesTitle().Should().Be("tokyoghoula");
"Tokyo Ghoul A".CleanArtistName().Should().Be("tokyoghoula");
}
}
}
@@ -40,8 +40,8 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Reno.911.S01.DVDRip.DD2.0.x264-DEEP", "Reno 911")]
public void should_parse_series_name(string postTitle, string title)
{
var result = Parser.Parser.ParseArtistName(postTitle).CleanSeriesTitle();
result.Should().Be(title.CleanSeriesTitle());
var result = Parser.Parser.ParseArtistName(postTitle).CleanArtistName();
result.Should().Be(title.CleanArtistName());
}
[Test]
@@ -49,7 +49,7 @@ namespace NzbDrone.Core.Test.ParserTests
{
const string title = "Carniv\u00E0le";
title.CleanSeriesTitle().Should().Be("carnivale");
title.CleanArtistName().Should().Be("carnivale");
}
[TestCase("Discovery TV - Gold Rush : 02 Road From Hell [S04].mp4")]