Radarr/NzbDrone.Core.Test/RssProviderTest.cs

57 lines
1.5 KiB
C#

using System;
using System.IO;
using System.ServiceModel.Syndication;
using System.Xml;
using AutoMoq;
using MbUnit.Framework;
using Moq;
using NzbDrone.Core.Providers;
using NzbDrone.Core.Providers.Core;
using NzbDrone.Core.Providers.Feed;
namespace NzbDrone.Core.Test
{
[TestFixture]
public class RssProviderTest
// ReSharper disable InconsistentNaming
{
[Test]
public void Download_feed_test()
{
var mocker = new AutoMoqer();
var xmlReader = XmlReader.Create(File.OpenRead(".\\Files\\Rss\\nzbsorg.xml"));
mocker.GetMock<HttpProvider>()
.Setup(h => h.DownloadXml(It.IsAny<String>()))
.Returns(xmlReader);
mocker.Resolve<MockFeedProvider>().Fetch();
}
}
public class MockFeedProvider : FeedProviderBase
{
public MockFeedProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider,
EpisodeProvider episodeProvider, ConfigProvider configProvider,
HttpProvider httpProvider)
: 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();
}
}
}