2011-04-05 08:33:24 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.ServiceModel.Syndication;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Xml;
|
2011-04-07 04:25:52 +02:00
|
|
|
|
using AutoMoq;
|
2011-04-05 08:33:24 +02:00
|
|
|
|
using Gallio.Framework;
|
|
|
|
|
using MbUnit.Framework;
|
|
|
|
|
using MbUnit.Framework.ContractVerifiers;
|
|
|
|
|
using Moq;
|
|
|
|
|
using Ninject;
|
|
|
|
|
using Ninject.Moq;
|
|
|
|
|
using NzbDrone.Core.Providers;
|
|
|
|
|
using NzbDrone.Core.Providers.Core;
|
|
|
|
|
using NzbDrone.Core.Providers.Feed;
|
|
|
|
|
using NzbDrone.Core.Repository;
|
|
|
|
|
using SubSonic.Repository;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Test
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
public class RssProviderTest
|
|
|
|
|
// ReSharper disable InconsistentNaming
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
|
|
public void Download_feed_test()
|
|
|
|
|
{
|
2011-04-07 04:25:52 +02:00
|
|
|
|
var mocker = new AutoMoqer();
|
2011-04-05 08:33:24 +02:00
|
|
|
|
|
|
|
|
|
var xmlReader = XmlReader.Create(File.OpenRead(".\\Files\\Rss\\nzbsorg.xml"));
|
|
|
|
|
|
2011-04-07 04:25:52 +02:00
|
|
|
|
mocker.GetMock<HttpProvider>()
|
|
|
|
|
.Setup(h => h.DownloadXml(It.IsAny<String>()))
|
|
|
|
|
.Returns(xmlReader);
|
2011-04-05 08:33:24 +02:00
|
|
|
|
|
2011-04-07 04:25:52 +02:00
|
|
|
|
mocker.Resolve<MockFeedProvider>().Fetch();
|
2011-04-05 08:33:24 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class MockFeedProvider : FeedProviderBase
|
|
|
|
|
{
|
2011-04-07 04:25:52 +02:00
|
|
|
|
public MockFeedProvider(ISeriesProvider seriesProvider, ISeasonProvider seasonProvider, IEpisodeProvider episodeProvider, IConfigProvider configProvider, HttpProvider httpProvider)
|
2011-04-05 08:33:24 +02:00
|
|
|
|
: base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override string[] URL
|
|
|
|
|
{
|
|
|
|
|
get { return new[] { "www.google.com" }; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override string Name
|
|
|
|
|
{
|
|
|
|
|
get { return "MyName"; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override string NzbDownloadUrl(SyndicationItem item)
|
|
|
|
|
{
|
|
|
|
|
return item.Links[0].Uri.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|