mark parse as invalid if last episode is before first.

pull/4/head
Keivan Beigi 12 years ago
parent b21e49f5fa
commit 31d472a0a0

@ -124,17 +124,10 @@ namespace NzbDrone.Core.Test.ParserTests
ExceptionVerification.IgnoreWarns(); ExceptionVerification.IgnoreWarns();
} }
[Test] [TestCase("[DmonHiro] The Severing Crime Edge - Cut 02 - Portrait Of Heresy [BD, 720p] [BE36E9E0]")]
[Ignore] public void unparsable_title_should_log_warn_and_return_null(string title)
public void unparsable_title_should_report_title()
{ {
const string TITLE = "SOMETHING 12345"; Parser.Parser.ParseTitle(title).Should().BeNull();
Parser.Parser.ParseTitle(TITLE).Should().BeNull();
MockedRestProvider.Verify(c => c.PostData(It.IsAny<string>(), It.Is<ParseErrorReport>(r => r.Title == TITLE)), Times.Once());
ExceptionVerification.IgnoreWarns();
} }
//[Timeout(1000)] //[Timeout(1000)]

@ -184,7 +184,14 @@ namespace NzbDrone.Core.Parser
{ {
var first = Convert.ToInt32(episodeCaptures.First().Value); var first = Convert.ToInt32(episodeCaptures.First().Value);
var last = Convert.ToInt32(episodeCaptures.Last().Value); var last = Convert.ToInt32(episodeCaptures.Last().Value);
result.EpisodeNumbers = Enumerable.Range(first, last - first + 1).ToArray();
if (first > last)
{
return null;
}
var count = last - first + 1;
result.EpisodeNumbers = Enumerable.Range(first, count).ToArray();
} }
else else
{ {

Loading…
Cancel
Save