1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00

updated indexerfixture to create cross platform paths.

This commit is contained in:
kay.one 2013-02-17 20:01:59 -08:00
parent da96095432
commit 3cf527bfa2
3 changed files with 27 additions and 20 deletions

View File

@ -29,7 +29,7 @@
text-align: center;
text-transform: lowercase;
font-size: 21px;
font-weight: normal;
font-weight: lighter;
vertical-align: middle;
}

View File

@ -1,4 +1,5 @@
using System;
using System.IO;
using NUnit.Framework;
using NzbDrone.Core.Model.Notification;
using NzbDrone.Test.Common;
@ -19,6 +20,12 @@ protected static void ThrowException()
{
throw new ApplicationException("This is a message for test exception");
}
protected FileStream OpenRead(params string[] path)
{
return File.OpenRead(Path.Combine(path));
}
}
public abstract class CoreTest<TSubject> : CoreTest

View File

@ -52,7 +52,7 @@ public void parse_feed_xml(string fileName)
{
Mocker.GetMock<HttpProvider>()
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
.Returns(File.OpenRead(".\\Files\\Rss\\" + fileName));
.Returns(OpenRead("Files", "Rss", fileName));
var fakeSettings = Builder<IndexerDefinition>.CreateNew().Build();
Mocker.GetMock<IndexerProvider>()
@ -143,7 +143,7 @@ public void size_nzbsrus()
Mocker.GetMock<HttpProvider>()
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
.Returns(File.OpenRead(".\\Files\\Rss\\SizeParsing\\nzbsrus.xml"));
.Returns(OpenRead("Files", "Rss", "SizeParsing", "nzbsrus.xml"));
//Act
var parseResults = Mocker.Resolve<NzbsRUs>().FetchRss();
@ -166,7 +166,7 @@ public void size_newznab()
Mocker.GetMock<HttpProvider>()
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
.Returns(File.OpenRead(".\\Files\\Rss\\SizeParsing\\newznab.xml"));
.Returns(OpenRead("Files", "Rss", "SizeParsing", "newznab.xml"));
//Act
var parseResults = Mocker.Resolve<Newznab>().FetchRss();
@ -181,11 +181,11 @@ public void size_nzbindex()
Mocker.GetMock<HttpProvider>()
.Setup(h => h.DownloadStream("http://www.nzbindex.nl/rss/alt.binaries.teevee/?sort=agedesc&minsize=100&complete=1&max=50&more=1&q=%23a.b.teevee", It.IsAny<NetworkCredential>()))
.Returns(File.OpenRead(".\\Files\\Rss\\SizeParsing\\nzbindex.xml"));
.Returns(OpenRead("Files", "Rss", "SizeParsing", "nzbindex.xml"));
Mocker.GetMock<HttpProvider>()
.Setup(h => h.DownloadStream("http://www.nzbindex.nl/rss/alt.binaries.hdtv/?sort=agedesc&minsize=100&complete=1&max=50&more=1&q=", It.IsAny<NetworkCredential>()))
.Returns(File.OpenRead(".\\Files\\Rss\\SizeParsing\\nzbindex.xml"));
.Returns(OpenRead("Files", "Rss", "SizeParsing", "nzbindex.xml"));
//Act
var parseResults = Mocker.Resolve<NzbIndex>().FetchRss();
@ -200,11 +200,11 @@ public void size_nzbclub()
Mocker.GetMock<HttpProvider>()
.Setup(h => h.DownloadStream("http://www.nzbclub.com/nzbfeed.aspx?ig=2&gid=102952&st=1&ns=1&q=%23a.b.teevee", It.IsAny<NetworkCredential>()))
.Returns(File.OpenRead(".\\Files\\Rss\\SizeParsing\\nzbclub.xml"));
.Returns(OpenRead("Files", "Rss", "SizeParsing", "nzbclub.xml"));
Mocker.GetMock<HttpProvider>()
.Setup(h => h.DownloadStream("http://www.nzbclub.com/nzbfeed.aspx?ig=2&gid=5542&st=1&ns=1&q=", It.IsAny<NetworkCredential>()))
.Returns(File.OpenRead(".\\Files\\Rss\\SizeParsing\\nzbclub.xml"));
.Returns(OpenRead("Files", "Rss", "SizeParsing", "nzbclub.xml"));
//Act
var parseResults = Mocker.Resolve<NzbClub>().FetchRss();
@ -220,7 +220,7 @@ public void size_omgwtfnzbs()
Mocker.GetMock<HttpProvider>()
.Setup(h => h.DownloadStream("http://rss.omgwtfnzbs.org/rss-search.php?catid=19,20&user=MockedConfigValue&api=MockedConfigValue&eng=1", It.IsAny<NetworkCredential>()))
.Returns(File.OpenRead(".\\Files\\Rss\\SizeParsing\\omgwtfnzbs.xml"));
.Returns(OpenRead("Files", "Rss", "SizeParsing", "omgwtfnzbs.xml"));
//Act
var parseResults = Mocker.Resolve<Omgwtfnzbs>().FetchRss();
@ -273,7 +273,7 @@ public void newznab_link_should_be_link_to_nzb_not_details()
{
Mocker.GetMock<HttpProvider>()
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
.Returns(File.OpenRead(".\\Files\\Rss\\newznab.xml"));
.Returns(OpenRead("Files", "Rss", "newznab.xml"));
var fakeSettings = Builder<IndexerDefinition>.CreateNew().Build();
Mocker.GetMock<IndexerProvider>()
@ -304,7 +304,7 @@ public void dateTime_should_parse_when_using_other_cultures(string fileName, str
Mocker.GetMock<HttpProvider>()
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
.Returns(File.OpenRead(".\\Files\\Rss\\" + fileName));
.Returns(OpenRead("Files", "Rss", "" + fileName));
var fakeSettings = Builder<IndexerDefinition>.CreateNew().Build();
Mocker.GetMock<IndexerProvider>()
@ -338,7 +338,7 @@ public void NzbsRus_NzbInfoUrl_should_contain_information_string()
Mocker.GetMock<HttpProvider>()
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
.Returns(File.OpenRead(".\\Files\\Rss\\" + fileName));
.Returns(OpenRead("Files", "Rss", "" + fileName));
var parseResults = Mocker.Resolve<NzbsRUs>().FetchRss();
@ -365,7 +365,7 @@ public void Newznab_NzbInfoUrl_should_contain_information_string()
Mocker.GetMock<HttpProvider>()
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
.Returns(File.OpenRead(".\\Files\\Rss\\" + fileName));
.Returns(OpenRead("Files", "Rss", "" + fileName));
var parseResults = Mocker.Resolve<Newznab>().FetchRss();
@ -384,7 +384,7 @@ public void Wombles_NzbInfoUrl_should_contain_information_string()
Mocker.GetMock<HttpProvider>()
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
.Returns(File.OpenRead(".\\Files\\Rss\\" + fileName));
.Returns(OpenRead("Files", "Rss", "" + fileName));
var parseResults = Mocker.Resolve<Wombles>().FetchRss();
@ -404,7 +404,7 @@ public void FileSharingTalk_NzbInfoUrl_should_contain_information_string()
Mocker.GetMock<HttpProvider>()
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
.Returns(File.OpenRead(".\\Files\\Rss\\" + fileName));
.Returns(OpenRead("Files", "Rss", "" + fileName));
var parseResults = Mocker.Resolve<FileSharingTalk>().FetchRss();
@ -423,11 +423,11 @@ public void NzbIndex_NzbInfoUrl_should_contain_information_string()
Mocker.GetMock<HttpProvider>()
.Setup(h => h.DownloadStream("http://www.nzbindex.nl/rss/alt.binaries.teevee/?sort=agedesc&minsize=100&complete=1&max=50&more=1&q=%23a.b.teevee", It.IsAny<NetworkCredential>()))
.Returns(File.OpenRead(".\\Files\\Rss\\nzbindex.xml"));
.Returns(OpenRead("Files", "Rss", "nzbindex.xml"));
Mocker.GetMock<HttpProvider>()
.Setup(h => h.DownloadStream("http://www.nzbindex.nl/rss/alt.binaries.hdtv/?sort=agedesc&minsize=100&complete=1&max=50&more=1&q=", It.IsAny<NetworkCredential>()))
.Returns(File.OpenRead(".\\Files\\Rss\\nzbindex.xml"));
.Returns(OpenRead("Files", "Rss", "nzbindex.xml"));
var parseResults = Mocker.Resolve<NzbIndex>().FetchRss();
@ -447,11 +447,11 @@ public void NzbClub_NzbInfoUrl_should_contain_information_string()
Mocker.GetMock<HttpProvider>()
.Setup(h => h.DownloadStream("http://www.nzbclub.com/nzbfeed.aspx?ig=2&gid=102952&st=1&ns=1&q=%23a.b.teevee", It.IsAny<NetworkCredential>()))
.Returns(File.OpenRead(".\\Files\\Rss\\" + fileName));
.Returns(OpenRead("Files", "Rss", "" + fileName));
Mocker.GetMock<HttpProvider>()
.Setup(h => h.DownloadStream("http://www.nzbclub.com/nzbfeed.aspx?ig=2&gid=5542&st=1&ns=1&q=", It.IsAny<NetworkCredential>()))
.Returns(File.OpenRead(".\\Files\\Rss\\" + fileName));
.Returns(OpenRead("Files", "Rss", "" + fileName));
var parseResults = Mocker.Resolve<NzbClub>().FetchRss();
@ -480,7 +480,7 @@ public void should_get_nzbInfoUrl_for_omgwtfnzbs()
Mocker.GetMock<HttpProvider>()
.Setup(h => h.DownloadStream("http://rss.omgwtfnzbs.org/rss-search.php?catid=19,20&user=MockedConfigValue&api=MockedConfigValue&eng=1", It.IsAny<NetworkCredential>()))
.Returns(File.OpenRead(".\\Files\\Rss\\SizeParsing\\omgwtfnzbs.xml"));
.Returns(OpenRead("Files", "Rss", "SizeParsing", "omgwtfnzbs.xml"));
//Act
var parseResults = Mocker.Resolve<Omgwtfnzbs>().FetchRss();