1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-27 01:57:21 +00:00

Fixed broken tests after new SceneName method.

This commit is contained in:
Mark McDowall 2011-06-13 22:52:12 -07:00
parent a290a0dcb0
commit e934e71b3b
4 changed files with 16 additions and 2 deletions

View file

@ -247,6 +247,9 @@ public void start_should_search_all_providers()
mocker.GetMock<InventoryProvider>() mocker.GetMock<InventoryProvider>()
.Setup(c => c.IsQualityNeeded(It.Is<EpisodeParseResult>(d => d.Series != null && d.Episodes.Count != 0))).Returns(false); .Setup(c => c.IsQualityNeeded(It.Is<EpisodeParseResult>(d => d.Series != null && d.Episodes.Count != 0))).Returns(false);
mocker.GetMock<SceneNameMappingProvider>()
.Setup(s => s.GetSceneName(It.IsAny<int>())).Returns("");
//Act //Act
mocker.Resolve<EpisodeSearchJob>().Start(new ProgressNotification("Test"), episode.EpisodeId); mocker.Resolve<EpisodeSearchJob>().Start(new ProgressNotification("Test"), episode.EpisodeId);
@ -295,6 +298,9 @@ public void start_should_use_scene_name_to_search()
mocker.GetMock<InventoryProvider>() mocker.GetMock<InventoryProvider>()
.Setup(c => c.IsQualityNeeded(It.Is<EpisodeParseResult>(d => d.Series != null && d.Episodes.Count != 0))).Returns(false); .Setup(c => c.IsQualityNeeded(It.Is<EpisodeParseResult>(d => d.Series != null && d.Episodes.Count != 0))).Returns(false);
mocker.GetMock<SceneNameMappingProvider>()
.Setup(s => s.GetSceneName(71256)).Returns("The Daily Show");
//Act //Act
mocker.Resolve<EpisodeSearchJob>().Start(new ProgressNotification("Test"), episode.EpisodeId); mocker.Resolve<EpisodeSearchJob>().Start(new ProgressNotification("Test"), episode.EpisodeId);
@ -347,7 +353,10 @@ public void start_failed_indexer_should_not_break_job()
.Returns(indexers); .Returns(indexers);
mocker.GetMock<InventoryProvider>() mocker.GetMock<InventoryProvider>()
.Setup(c => c.IsQualityNeeded(It.Is<EpisodeParseResult>(d => d.Series != null && d.Episodes.Count != 0))).Returns(false); .Setup(c => c.IsQualityNeeded(It.Is<EpisodeParseResult>(d => d.Series != null && d.Episodes.Count != 0))).Returns(false);;
mocker.GetMock<SceneNameMappingProvider>()
.Setup(s => s.GetSceneName(It.IsAny<int>())).Returns("");
//Act //Act
mocker.Resolve<EpisodeSearchJob>().Start(new ProgressNotification("Test"), episode.EpisodeId); mocker.Resolve<EpisodeSearchJob>().Start(new ProgressNotification("Test"), episode.EpisodeId);

View file

@ -46,7 +46,7 @@ public static class Parser
private static readonly Regex NormalizeRegex = new Regex(@"((^|\W)(a|an|the|and|or|of)($|\W))|\W|(?:(?<=[^0-9]+)|\b)(?!(?:19\d{2}|20\d{2}))\d+(?=[^0-9ip]+|\b)", private static readonly Regex NormalizeRegex = new Regex(@"((^|\W)(a|an|the|and|or|of)($|\W))|\W|(?:(?<=[^0-9]+)|\b)(?!(?:19\d{2}|20\d{2}))\d+(?=[^0-9ip]+|\b)",
RegexOptions.IgnoreCase | RegexOptions.Compiled); RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex SimpleTitleRegex = new Regex(@"480[i|p]|720[i|p]|1080[i|p]|[x|h]264|\\|\/|\<|\>|\?|\*|\:|\|", private static readonly Regex SimpleTitleRegex = new Regex(@"480[i|p]|720[i|p]|1080[i|p]|[x|h]264|\<|\>|\?|\*|\:|\|",
RegexOptions.IgnoreCase | RegexOptions.Compiled); RegexOptions.IgnoreCase | RegexOptions.Compiled);
/// <summary> /// <summary>

View file

@ -23,6 +23,11 @@ public SceneNameMappingProvider(IRepository repository, HttpProvider httpProvide
_httpProvider = httpProvider; _httpProvider = httpProvider;
} }
public SceneNameMappingProvider()
{
}
public virtual bool UpdateMappings() public virtual bool UpdateMappings()
{ {
try try