2011-05-27 02:12:28 +00:00
|
|
|
|
using System;
|
2011-07-03 22:32:36 +00:00
|
|
|
|
using System.Collections.Generic;
|
2011-05-27 02:12:28 +00:00
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Net;
|
|
|
|
|
using System.ServiceModel.Syndication;
|
|
|
|
|
using AutoMoq;
|
|
|
|
|
using FizzWare.NBuilder;
|
2011-06-02 21:06:46 +00:00
|
|
|
|
using FluentAssertions;
|
2011-05-27 02:12:28 +00:00
|
|
|
|
using Moq;
|
2011-06-02 21:06:46 +00:00
|
|
|
|
using NUnit.Framework;
|
2011-05-28 19:23:35 +00:00
|
|
|
|
using NzbDrone.Core.Model;
|
2011-05-27 02:12:28 +00:00
|
|
|
|
using NzbDrone.Core.Providers;
|
|
|
|
|
using NzbDrone.Core.Providers.Core;
|
|
|
|
|
using NzbDrone.Core.Providers.Indexer;
|
|
|
|
|
using NzbDrone.Core.Repository;
|
|
|
|
|
using NzbDrone.Core.Repository.Quality;
|
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Test
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
// ReSharper disable InconsistentNaming
|
|
|
|
|
public class IndexerTests : TestBase
|
|
|
|
|
{
|
2011-07-02 18:41:23 +00:00
|
|
|
|
|
2011-08-27 05:37:20 +00:00
|
|
|
|
[TestCase("nzbsorg.xml", 2)]
|
2011-09-18 20:53:05 +00:00
|
|
|
|
[TestCase("nzbsrus.xml", 7)]
|
2011-06-02 21:06:46 +00:00
|
|
|
|
[TestCase("newzbin.xml", 1)]
|
2011-08-27 05:37:20 +00:00
|
|
|
|
[TestCase("nzbmatrix.xml", 2)]
|
2011-05-27 02:12:28 +00:00
|
|
|
|
public void parse_feed_xml(string fileName, int warns)
|
|
|
|
|
{
|
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<HttpProvider>()
|
|
|
|
|
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
|
|
|
|
|
.Returns(File.OpenRead(".\\Files\\Rss\\" + fileName));
|
|
|
|
|
|
2011-07-08 03:27:11 +00:00
|
|
|
|
var fakeSettings = Builder<IndexerDefinition>.CreateNew().Build();
|
2011-05-27 02:12:28 +00:00
|
|
|
|
mocker.GetMock<IndexerProvider>()
|
|
|
|
|
.Setup(c => c.GetSettings(It.IsAny<Type>()))
|
|
|
|
|
.Returns(fakeSettings);
|
|
|
|
|
|
|
|
|
|
var mockIndexer = mocker.Resolve<MockIndexer>();
|
|
|
|
|
var parseResults = mockIndexer.FetchRss();
|
|
|
|
|
|
|
|
|
|
foreach (var episodeParseResult in parseResults)
|
|
|
|
|
{
|
|
|
|
|
var Uri = new Uri(episodeParseResult.NzbUrl);
|
2011-06-02 21:06:46 +00:00
|
|
|
|
Uri.PathAndQuery.Should().NotContain("//");
|
2011-05-27 02:12:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2011-06-02 21:06:46 +00:00
|
|
|
|
parseResults.Should().NotBeEmpty();
|
|
|
|
|
parseResults.Should().OnlyContain(s => s.Indexer == mockIndexer.Name);
|
|
|
|
|
parseResults.Should().OnlyContain(s => !String.IsNullOrEmpty(s.NzbTitle));
|
2011-05-27 02:12:28 +00:00
|
|
|
|
|
|
|
|
|
ExceptionVerification.ExcpectedWarns(warns);
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-10 19:52:29 +00:00
|
|
|
|
[Test]
|
|
|
|
|
public void newzbin_parses_languae()
|
|
|
|
|
{
|
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<HttpProvider>()
|
|
|
|
|
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
|
|
|
|
|
.Returns(File.OpenRead(".\\Files\\Rss\\newbin_none_english.xml"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var newzbin = mocker.Resolve<Newzbin>();
|
|
|
|
|
var parseResults = newzbin.FetchRss();
|
|
|
|
|
|
|
|
|
|
foreach (var episodeParseResult in parseResults)
|
|
|
|
|
{
|
|
|
|
|
var Uri = new Uri(episodeParseResult.NzbUrl);
|
|
|
|
|
Uri.PathAndQuery.Should().NotContain("//");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parseResults.Should().NotBeEmpty();
|
|
|
|
|
parseResults.Should().NotContain(e => e.Language == LanguageType.English);
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-27 02:12:28 +00:00
|
|
|
|
[Test]
|
2011-06-03 01:15:19 +00:00
|
|
|
|
public void newzbin_rss_fetch()
|
2011-05-27 02:12:28 +00:00
|
|
|
|
{
|
|
|
|
|
var mocker = new AutoMoqer();
|
2011-07-02 18:41:23 +00:00
|
|
|
|
mocker.Resolve<HttpProvider>();
|
2011-07-08 03:27:11 +00:00
|
|
|
|
var fakeSettings = Builder<IndexerDefinition>.CreateNew().Build();
|
2011-05-27 02:12:28 +00:00
|
|
|
|
mocker.GetMock<IndexerProvider>()
|
|
|
|
|
.Setup(c => c.GetSettings(It.IsAny<Type>()))
|
|
|
|
|
.Returns(fakeSettings);
|
|
|
|
|
|
2011-07-02 18:41:23 +00:00
|
|
|
|
mocker.GetMock<ConfigProvider>()
|
|
|
|
|
.SetupGet(c => c.NewzbinUsername)
|
|
|
|
|
.Returns("nzbdrone");
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<ConfigProvider>()
|
|
|
|
|
.SetupGet(c => c.NewzbinPassword)
|
|
|
|
|
.Returns("smartar39865");
|
|
|
|
|
|
2011-05-27 02:12:28 +00:00
|
|
|
|
var newzbinProvider = mocker.Resolve<Newzbin>();
|
|
|
|
|
var parseResults = newzbinProvider.FetchRss();
|
|
|
|
|
|
|
|
|
|
foreach (var episodeParseResult in parseResults)
|
|
|
|
|
{
|
|
|
|
|
var Uri = new Uri(episodeParseResult.NzbUrl);
|
2011-06-02 21:06:46 +00:00
|
|
|
|
Uri.PathAndQuery.Should().NotContain("//");
|
2011-05-27 02:12:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2011-06-02 21:06:46 +00:00
|
|
|
|
parseResults.Should().NotBeEmpty();
|
|
|
|
|
parseResults.Should().OnlyContain(s => s.Indexer == newzbinProvider.Name);
|
|
|
|
|
parseResults.Should().OnlyContain(s => !String.IsNullOrEmpty(s.NzbTitle));
|
|
|
|
|
|
2011-07-02 18:41:23 +00:00
|
|
|
|
ExceptionVerification.IgnoreWarns();
|
2011-05-27 02:12:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-07-02 18:41:23 +00:00
|
|
|
|
|
2011-06-02 21:06:46 +00:00
|
|
|
|
[TestCase("Adventure.Inc.S03E19.DVDRip.XviD-OSiTV", 3, 19, QualityTypes.DVD)]
|
2011-05-27 02:12:28 +00:00
|
|
|
|
public void custome_parser_partial_success(string title, int season, int episode, QualityTypes quality)
|
|
|
|
|
{
|
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
|
|
|
|
|
|
const string summary = "My fake summary";
|
|
|
|
|
|
2011-07-08 03:27:11 +00:00
|
|
|
|
var fakeSettings = Builder<IndexerDefinition>.CreateNew().Build();
|
2011-05-27 02:12:28 +00:00
|
|
|
|
mocker.GetMock<IndexerProvider>()
|
|
|
|
|
.Setup(c => c.GetSettings(It.IsAny<Type>()))
|
|
|
|
|
.Returns(fakeSettings);
|
|
|
|
|
|
|
|
|
|
var fakeRssItem = Builder<SyndicationItem>.CreateNew()
|
|
|
|
|
.With(c => c.Title = new TextSyndicationContent(title))
|
|
|
|
|
.With(c => c.Summary = new TextSyndicationContent(summary))
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var result = mocker.Resolve<CustomParserIndexer>().ParseFeed(fakeRssItem);
|
|
|
|
|
|
|
|
|
|
Assert.IsNotNull(result);
|
2011-05-28 19:23:35 +00:00
|
|
|
|
Assert.AreEqual(LanguageType.Finnish, result.Language);
|
2011-05-27 02:12:28 +00:00
|
|
|
|
Assert.AreEqual(season, result.SeasonNumber);
|
|
|
|
|
Assert.AreEqual(episode, result.EpisodeNumbers[0]);
|
2011-05-28 19:23:35 +00:00
|
|
|
|
Assert.AreEqual(quality, result.Quality.QualityType);
|
2011-05-27 02:12:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-06-13 04:20:29 +00:00
|
|
|
|
|
2011-06-02 21:06:46 +00:00
|
|
|
|
[TestCase("Adventure.Inc.DVDRip.XviD-OSiTV")]
|
2011-05-27 02:12:28 +00:00
|
|
|
|
public void custome_parser_full_parse(string title)
|
|
|
|
|
{
|
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
|
|
|
|
|
|
const string summary = "My fake summary";
|
|
|
|
|
|
2011-07-08 03:27:11 +00:00
|
|
|
|
var fakeSettings = Builder<IndexerDefinition>.CreateNew().Build();
|
2011-05-27 02:12:28 +00:00
|
|
|
|
mocker.GetMock<IndexerProvider>()
|
|
|
|
|
.Setup(c => c.GetSettings(It.IsAny<Type>()))
|
|
|
|
|
.Returns(fakeSettings);
|
|
|
|
|
|
|
|
|
|
var fakeRssItem = Builder<SyndicationItem>.CreateNew()
|
|
|
|
|
.With(c => c.Title = new TextSyndicationContent(title))
|
|
|
|
|
.With(c => c.Summary = new TextSyndicationContent(summary))
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var result = mocker.Resolve<CustomParserIndexer>().ParseFeed(fakeRssItem);
|
|
|
|
|
|
|
|
|
|
Assert.IsNotNull(result);
|
2011-05-28 19:23:35 +00:00
|
|
|
|
Assert.AreEqual(LanguageType.Finnish, result.Language);
|
2011-05-27 02:12:28 +00:00
|
|
|
|
ExceptionVerification.ExcpectedWarns(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void downloadFeed()
|
|
|
|
|
{
|
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
|
mocker.SetConstant(new HttpProvider());
|
|
|
|
|
|
2011-07-08 03:27:11 +00:00
|
|
|
|
var fakeSettings = Builder<IndexerDefinition>.CreateNew().Build();
|
2011-05-27 02:12:28 +00:00
|
|
|
|
mocker.GetMock<IndexerProvider>()
|
|
|
|
|
.Setup(c => c.GetSettings(It.IsAny<Type>()))
|
|
|
|
|
.Returns(fakeSettings);
|
|
|
|
|
|
|
|
|
|
mocker.Resolve<TestUrlIndexer>().FetchRss();
|
|
|
|
|
|
|
|
|
|
ExceptionVerification.IgnoreWarns();
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-03 22:32:36 +00:00
|
|
|
|
[TestCase("simpsons", 21, 23)]
|
|
|
|
|
[TestCase("Hawaii Five-0 (2010)", 1, 5)]
|
2011-07-10 19:52:29 +00:00
|
|
|
|
[TestCase("In plain Sight", 1, 4)]
|
2011-07-03 22:32:36 +00:00
|
|
|
|
public void nzbsorg_search_returns_valid_results(string title, int season, int episode)
|
2011-05-27 02:12:28 +00:00
|
|
|
|
{
|
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<ConfigProvider>()
|
|
|
|
|
.SetupGet(c => c.NzbsOrgUId)
|
|
|
|
|
.Returns("43516");
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<ConfigProvider>()
|
|
|
|
|
.SetupGet(c => c.NzbsOrgHash)
|
|
|
|
|
.Returns("bc8edb4cc49d4ae440775adec5ac001f");
|
|
|
|
|
|
|
|
|
|
mocker.Resolve<HttpProvider>();
|
|
|
|
|
|
2011-07-03 22:32:36 +00:00
|
|
|
|
var result = mocker.Resolve<NzbsOrg>().FetchEpisode(title, season, episode);
|
2011-05-27 02:12:28 +00:00
|
|
|
|
|
2011-06-02 21:06:46 +00:00
|
|
|
|
result.Should().NotBeEmpty();
|
2011-07-03 22:32:36 +00:00
|
|
|
|
result.Should().OnlyContain(r => r.CleanTitle == Parser.NormalizeTitle(title));
|
|
|
|
|
result.Should().OnlyContain(r => r.SeasonNumber == season);
|
|
|
|
|
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(episode));
|
2011-06-03 01:15:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-07-02 18:41:23 +00:00
|
|
|
|
[TestCase("simpsons", 21, 23)]
|
2011-07-03 23:04:57 +00:00
|
|
|
|
[TestCase("Hawaii Five-0 (2010)", 1, 1)]
|
2011-07-10 20:07:42 +00:00
|
|
|
|
[TestCase("In plain Sight", 1, 11)]
|
2011-06-25 01:20:52 +00:00
|
|
|
|
public void newzbin_search_returns_valid_results(string title, int season, int episode)
|
2011-06-03 01:15:19 +00:00
|
|
|
|
{
|
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<ConfigProvider>()
|
|
|
|
|
.SetupGet(c => c.NewzbinUsername)
|
|
|
|
|
.Returns("nzbdrone");
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<ConfigProvider>()
|
|
|
|
|
.SetupGet(c => c.NewzbinPassword)
|
|
|
|
|
.Returns("smartar39865");
|
|
|
|
|
|
|
|
|
|
mocker.Resolve<HttpProvider>();
|
|
|
|
|
|
2011-06-25 01:20:52 +00:00
|
|
|
|
var result = mocker.Resolve<Newzbin>().FetchEpisode(title, season, episode);
|
2011-06-03 01:15:19 +00:00
|
|
|
|
|
|
|
|
|
result.Should().NotBeEmpty();
|
2011-07-02 18:41:23 +00:00
|
|
|
|
result.Should().OnlyContain(r => r.CleanTitle == Parser.NormalizeTitle(title));
|
2011-06-25 01:20:52 +00:00
|
|
|
|
result.Should().OnlyContain(r => r.SeasonNumber == season);
|
|
|
|
|
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(episode));
|
2011-05-27 06:03:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-06-04 05:32:55 +00:00
|
|
|
|
[Test]
|
|
|
|
|
public void nzbmatrix_search_returns_valid_results()
|
|
|
|
|
{
|
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<ConfigProvider>()
|
|
|
|
|
.SetupGet(c => c.NzbMatrixUsername)
|
|
|
|
|
.Returns("");
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<ConfigProvider>()
|
|
|
|
|
.SetupGet(c => c.NzbMatrixApiKey)
|
|
|
|
|
.Returns("");
|
|
|
|
|
|
|
|
|
|
mocker.Resolve<HttpProvider>();
|
|
|
|
|
|
|
|
|
|
var result = mocker.Resolve<NzbMatrix>().FetchEpisode("Simpsons", 21, 23);
|
|
|
|
|
|
|
|
|
|
result.Should().NotBeEmpty();
|
|
|
|
|
result.Should().OnlyContain(r => r.CleanTitle == "simpsons");
|
|
|
|
|
result.Should().OnlyContain(r => r.SeasonNumber == 21);
|
|
|
|
|
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(23));
|
|
|
|
|
}
|
2011-05-27 06:03:57 +00:00
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void nzbsorg_multi_word_search_returns_valid_results()
|
|
|
|
|
{
|
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<ConfigProvider>()
|
|
|
|
|
.SetupGet(c => c.NzbsOrgUId)
|
|
|
|
|
.Returns("43516");
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<ConfigProvider>()
|
|
|
|
|
.SetupGet(c => c.NzbsOrgHash)
|
|
|
|
|
.Returns("bc8edb4cc49d4ae440775adec5ac001f");
|
2011-05-27 02:12:28 +00:00
|
|
|
|
|
2011-05-27 06:03:57 +00:00
|
|
|
|
mocker.Resolve<HttpProvider>();
|
|
|
|
|
|
|
|
|
|
var result = mocker.Resolve<NzbsOrg>().FetchEpisode("Blue Bloods", 1, 19);
|
|
|
|
|
|
2011-06-02 21:06:46 +00:00
|
|
|
|
result.Should().NotBeEmpty();
|
|
|
|
|
result.Should().OnlyContain(r => r.CleanTitle == "bluebloods");
|
|
|
|
|
result.Should().OnlyContain(r => r.SeasonNumber == 1);
|
|
|
|
|
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(19));
|
|
|
|
|
|
2011-05-27 02:12:28 +00:00
|
|
|
|
}
|
2011-06-04 05:32:55 +00:00
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void nzbmatrix_multi_word_search_returns_valid_results()
|
|
|
|
|
{
|
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<ConfigProvider>()
|
|
|
|
|
.SetupGet(c => c.NzbMatrixUsername)
|
|
|
|
|
.Returns("");
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<ConfigProvider>()
|
|
|
|
|
.SetupGet(c => c.NzbMatrixApiKey)
|
|
|
|
|
.Returns("");
|
|
|
|
|
|
|
|
|
|
mocker.Resolve<HttpProvider>();
|
|
|
|
|
|
|
|
|
|
var result = mocker.Resolve<NzbMatrix>().FetchEpisode("Blue Bloods", 1, 19);
|
|
|
|
|
|
|
|
|
|
result.Should().NotBeEmpty();
|
|
|
|
|
result.Should().OnlyContain(r => r.CleanTitle == "bluebloods");
|
|
|
|
|
result.Should().OnlyContain(r => r.SeasonNumber == 1);
|
|
|
|
|
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(19));
|
|
|
|
|
}
|
2011-07-03 22:32:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[TestCase("hawaii five-0 (2010)", "hawaii+five+0+2010")]
|
|
|
|
|
[TestCase("this& that", "this+that")]
|
|
|
|
|
[TestCase("this& that", "this+that")]
|
|
|
|
|
public void get_query_title(string raw, string clean)
|
|
|
|
|
{
|
|
|
|
|
var result = IndexerBase.GetQueryTitle(raw);
|
|
|
|
|
|
|
|
|
|
result.Should().Be(clean);
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-14 02:25:33 +00:00
|
|
|
|
[Test]
|
|
|
|
|
public void size_newzbin()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<HttpProvider>()
|
|
|
|
|
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
|
|
|
|
|
.Returns(File.OpenRead(".\\Files\\Rss\\SizeParsing\\newzbin.xml"));
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
var parseResults = mocker.Resolve<Newzbin>().FetchRss();
|
|
|
|
|
|
|
|
|
|
parseResults.Should().HaveCount(1);
|
|
|
|
|
parseResults[0].Size.Should().Be(1295620506);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void size_nzbmatrix()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<HttpProvider>()
|
|
|
|
|
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
|
|
|
|
|
.Returns(File.OpenRead(".\\Files\\Rss\\SizeParsing\\nzbmatrix.xml"));
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
var parseResults = mocker.Resolve<NzbMatrix>().FetchRss();
|
|
|
|
|
|
|
|
|
|
parseResults.Should().HaveCount(1);
|
|
|
|
|
parseResults[0].Size.Should().Be(1331439862);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void size_nzbsorg()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
|
|
|
|
var mocker = new AutoMoqer();
|
2011-07-03 22:32:36 +00:00
|
|
|
|
|
2011-09-14 02:25:33 +00:00
|
|
|
|
mocker.GetMock<HttpProvider>()
|
|
|
|
|
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
|
|
|
|
|
.Returns(File.OpenRead(".\\Files\\Rss\\SizeParsing\\nzbsorg.xml"));
|
2011-07-03 22:32:36 +00:00
|
|
|
|
|
2011-09-14 02:25:33 +00:00
|
|
|
|
//Act
|
|
|
|
|
var parseResults = mocker.Resolve<NzbsOrg>().FetchRss();
|
2011-07-03 22:32:36 +00:00
|
|
|
|
|
2011-09-14 02:25:33 +00:00
|
|
|
|
parseResults.Should().HaveCount(1);
|
|
|
|
|
parseResults[0].Size.Should().Be(1793148846);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void size_nzbsrus()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
|
|
|
|
|
|
mocker.GetMock<HttpProvider>()
|
|
|
|
|
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
|
|
|
|
|
.Returns(File.OpenRead(".\\Files\\Rss\\SizeParsing\\nzbsrus.xml"));
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
var parseResults = mocker.Resolve<NzbsRUs>().FetchRss();
|
|
|
|
|
|
|
|
|
|
parseResults.Should().HaveCount(1);
|
|
|
|
|
parseResults[0].Size.Should().Be(1793148846);
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-05-27 02:12:28 +00:00
|
|
|
|
}
|