Some more test cases for CleanTitle

pull/4/head
Mark McDowall 10 years ago
parent 5f8af9f3a2
commit 2a2330548c

@ -61,7 +61,11 @@ namespace NzbDrone.Core.Test.OrganizerTests
[TestCase("Marvel's Agents of S.H.I.E.L.D.", "Marvels Agents of S.H.I.E.L.D")] [TestCase("Marvel's Agents of S.H.I.E.L.D.", "Marvels Agents of S.H.I.E.L.D")]
[TestCase("Castle (2009)", "Castle 2009")] [TestCase("Castle (2009)", "Castle 2009")]
[TestCase("Law & Order (UK)", "Law and Order UK")] [TestCase("Law & Order (UK)", "Law and Order UK")]
// [TestCase("", "")] [TestCase("Is this okay?", "Is this okay")]
[TestCase("[a] title", "a title")]
[TestCase("backslash \\ backlash", "backslash backlash")]
//[TestCase("", "")]
//[TestCase("", "")]
public void should_get_expected_title_back(string title, string expected) public void should_get_expected_title_back(string title, string expected)
{ {
_series.Title = title; _series.Title = title;

@ -56,7 +56,7 @@ namespace NzbDrone.Core.Organizer
private static readonly Regex FileNameCleanupRegex = new Regex(@"([- ._])(\1)+", RegexOptions.Compiled); private static readonly Regex FileNameCleanupRegex = new Regex(@"([- ._])(\1)+", RegexOptions.Compiled);
private static readonly Regex TrimSeparatorsRegex = new Regex(@"[- ._]$", RegexOptions.Compiled); private static readonly Regex TrimSeparatorsRegex = new Regex(@"[- ._]$", RegexOptions.Compiled);
private static readonly Regex ScenifyRemoveChars = new Regex(@"(?<=\s)(,|<|>|\/|\\|;|:|'|""|\||`|~|!|@|$|%|^|&|\*|-|_|=){1}(?=\s)|('|:)(?=s|\s)|(\(|\)|\[|\]|\{|\})", RegexOptions.Compiled | RegexOptions.IgnoreCase); private static readonly Regex ScenifyRemoveChars = new Regex(@"(?<=\s)(,|<|>|\/|\\|;|:|'|""|\||`|~|!|\?|@|$|%|^|\*|-|_|=){1}(?=\s)|('|:|\?)(?=s|\s|$)|(\(|\)|\[|\]|\{|\})", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static readonly Regex ScenifyReplaceChars = new Regex(@"[\/]", RegexOptions.Compiled | RegexOptions.IgnoreCase); private static readonly Regex ScenifyReplaceChars = new Regex(@"[\/]", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static readonly char[] EpisodeTitleTrimCharacters = new[] { ' ', '.', '?' }; private static readonly char[] EpisodeTitleTrimCharacters = new[] { ' ', '.', '?' };

Loading…
Cancel
Save