|
|
@ -60,16 +60,20 @@ namespace NzbDrone.Core.Test
|
|
|
|
public void newzbin_rss_fetch()
|
|
|
|
public void newzbin_rss_fetch()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
|
|
|
|
mocker.Resolve<HttpProvider>();
|
|
|
|
mocker.GetMock<HttpProvider>()
|
|
|
|
|
|
|
|
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
|
|
|
|
|
|
|
|
.Returns(File.OpenRead(".\\Files\\Rss\\newzbin.xml"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeSettings = Builder<IndexerSetting>.CreateNew().Build();
|
|
|
|
var fakeSettings = Builder<IndexerSetting>.CreateNew().Build();
|
|
|
|
mocker.GetMock<IndexerProvider>()
|
|
|
|
mocker.GetMock<IndexerProvider>()
|
|
|
|
.Setup(c => c.GetSettings(It.IsAny<Type>()))
|
|
|
|
.Setup(c => c.GetSettings(It.IsAny<Type>()))
|
|
|
|
.Returns(fakeSettings);
|
|
|
|
.Returns(fakeSettings);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<ConfigProvider>()
|
|
|
|
|
|
|
|
.SetupGet(c => c.NewzbinUsername)
|
|
|
|
|
|
|
|
.Returns("nzbdrone");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<ConfigProvider>()
|
|
|
|
|
|
|
|
.SetupGet(c => c.NewzbinPassword)
|
|
|
|
|
|
|
|
.Returns("smartar39865");
|
|
|
|
|
|
|
|
|
|
|
|
var newzbinProvider = mocker.Resolve<Newzbin>();
|
|
|
|
var newzbinProvider = mocker.Resolve<Newzbin>();
|
|
|
|
var parseResults = newzbinProvider.FetchRss();
|
|
|
|
var parseResults = newzbinProvider.FetchRss();
|
|
|
|
|
|
|
|
|
|
|
@ -84,8 +88,7 @@ namespace NzbDrone.Core.Test
|
|
|
|
parseResults.Should().OnlyContain(s => s.Indexer == newzbinProvider.Name);
|
|
|
|
parseResults.Should().OnlyContain(s => s.Indexer == newzbinProvider.Name);
|
|
|
|
parseResults.Should().OnlyContain(s => !String.IsNullOrEmpty(s.NzbTitle));
|
|
|
|
parseResults.Should().OnlyContain(s => !String.IsNullOrEmpty(s.NzbTitle));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ExceptionVerification.IgnoreWarns();
|
|
|
|
ExceptionVerification.ExcpectedWarns(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -179,8 +182,8 @@ namespace NzbDrone.Core.Test
|
|
|
|
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(23));
|
|
|
|
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(23));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[TestCase("simpsons",21,23)]
|
|
|
|
[TestCase("simpsons", 21, 23)]
|
|
|
|
[TestCase("Hawaii Five-0", 1, 5)]
|
|
|
|
[TestCase("Hawaii Five-0 2010", 1, 5)]
|
|
|
|
public void newzbin_search_returns_valid_results(string title, int season, int episode)
|
|
|
|
public void newzbin_search_returns_valid_results(string title, int season, int episode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
@ -198,7 +201,7 @@ namespace NzbDrone.Core.Test
|
|
|
|
var result = mocker.Resolve<Newzbin>().FetchEpisode(title, season, episode);
|
|
|
|
var result = mocker.Resolve<Newzbin>().FetchEpisode(title, season, episode);
|
|
|
|
|
|
|
|
|
|
|
|
result.Should().NotBeEmpty();
|
|
|
|
result.Should().NotBeEmpty();
|
|
|
|
result.Should().OnlyContain(r => r.CleanTitle == title);
|
|
|
|
result.Should().OnlyContain(r => r.CleanTitle == Parser.NormalizeTitle(title));
|
|
|
|
result.Should().OnlyContain(r => r.SeasonNumber == season);
|
|
|
|
result.Should().OnlyContain(r => r.SeasonNumber == season);
|
|
|
|
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(episode));
|
|
|
|
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(episode));
|
|
|
|
}
|
|
|
|
}
|
|
|
|