|
|
@ -29,7 +29,7 @@ namespace NzbDrone.Core.Test.IndexerTests
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Mocker.GetMock<HttpProvider>()
|
|
|
|
Mocker.GetMock<HttpProvider>()
|
|
|
|
.Setup(h => h.DownloadString("https://nzbx.co/api/recent?category=tv", It.IsAny<NetworkCredential>()))
|
|
|
|
.Setup(h => h.DownloadString("https://nzbx.co/api/recent?category=tv", It.IsAny<NetworkCredential>()))
|
|
|
|
.Returns(File.ReadAllText(".\\Files\\Rss\\SizeParsing\\nzbx_recent.json"));
|
|
|
|
.Returns(ReadAllText("Files", "Rss", "SizeParsing", "nzbx_recent.json"));
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
|
var parseResults = Mocker.Resolve<Nzbx>().FetchRss();
|
|
|
|
var parseResults = Mocker.Resolve<Nzbx>().FetchRss();
|
|
|
@ -38,12 +38,12 @@ namespace NzbDrone.Core.Test.IndexerTests
|
|
|
|
parseResults[0].Size.Should().Be(890190951);
|
|
|
|
parseResults[0].Size.Should().Be(890190951);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void should_get_size_when_parsing_search_results()
|
|
|
|
public void should_get_size_when_parsing_search_results()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Mocker.GetMock<HttpProvider>()
|
|
|
|
Mocker.GetMock<HttpProvider>()
|
|
|
|
.Setup(h => h.DownloadString("https://nzbx.co/api/search?q=30+Rock+S01E01", It.IsAny<NetworkCredential>()))
|
|
|
|
.Setup(h => h.DownloadString("https://nzbx.co/api/search?q=30+Rock+S01E01", It.IsAny<NetworkCredential>()))
|
|
|
|
.Returns(File.ReadAllText(".\\Files\\Rss\\SizeParsing\\nzbx_search.json"));
|
|
|
|
.Returns(ReadAllText("Files", "Rss", "SizeParsing", "nzbx_search.json"));
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
|
var parseResults = Mocker.Resolve<Nzbx>().FetchEpisode("30 Rock", 1, 1);
|
|
|
|
var parseResults = Mocker.Resolve<Nzbx>().FetchEpisode("30 Rock", 1, 1);
|
|
|
@ -57,7 +57,7 @@ namespace NzbDrone.Core.Test.IndexerTests
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Mocker.GetMock<HttpProvider>()
|
|
|
|
Mocker.GetMock<HttpProvider>()
|
|
|
|
.Setup(h => h.DownloadString(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
|
|
|
|
.Setup(h => h.DownloadString(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
|
|
|
|
.Returns(File.ReadAllText(".\\Files\\Rss\\nzbx_recent.json"));
|
|
|
|
.Returns(ReadAllText("Files", "Rss", "nzbx_recent.json"));
|
|
|
|
|
|
|
|
|
|
|
|
var parseResults = Mocker.Resolve<Nzbx>().FetchRss();
|
|
|
|
var parseResults = Mocker.Resolve<Nzbx>().FetchRss();
|
|
|
|
|
|
|
|
|
|
|
@ -69,18 +69,18 @@ namespace NzbDrone.Core.Test.IndexerTests
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void should_be_able_to_parse_results_from_search_results()
|
|
|
|
public void should_be_able_to_parse_results_from_search_results()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Mocker.GetMock<HttpProvider>()
|
|
|
|
Mocker.GetMock<HttpProvider>()
|
|
|
|
.Setup(h => h.DownloadString(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
|
|
|
|
.Setup(h => h.DownloadString(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
|
|
|
|
.Returns(File.ReadAllText(".\\Files\\Rss\\nzbx_search.json"));
|
|
|
|
.Returns(ReadAllText("Files", "Rss", "nzbx_search.json"));
|
|
|
|
|
|
|
|
|
|
|
|
var parseResults = Mocker.Resolve<Nzbx>().FetchEpisode("30 Rock", 1, 1);
|
|
|
|
var parseResults = Mocker.Resolve<Nzbx>().FetchEpisode("30 Rock", 1, 1);
|
|
|
|
|
|
|
|
|
|
|
|
parseResults.Should().NotBeEmpty();
|
|
|
|
parseResults.Should().NotBeEmpty();
|
|
|
|
parseResults.Should().OnlyContain(s => s.Indexer == "nzbx");
|
|
|
|
parseResults.Should().OnlyContain(s => s.Indexer == "nzbx");
|
|
|
|
parseResults.Should().OnlyContain(s => !String.IsNullOrEmpty(s.OriginalString));
|
|
|
|
parseResults.Should().OnlyContain(s => !String.IsNullOrEmpty(s.OriginalString));
|
|
|
|
parseResults.Should().OnlyContain(s => s.Age >= 0);
|
|
|
|
parseResults.Should().OnlyContain(s => s.Age >= 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void should_get_postedDate_when_parsing_recent_feed()
|
|
|
|
public void should_get_postedDate_when_parsing_recent_feed()
|
|
|
@ -89,7 +89,7 @@ namespace NzbDrone.Core.Test.IndexerTests
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<HttpProvider>()
|
|
|
|
Mocker.GetMock<HttpProvider>()
|
|
|
|
.Setup(h => h.DownloadString("https://nzbx.co/api/recent?category=tv", It.IsAny<NetworkCredential>()))
|
|
|
|
.Setup(h => h.DownloadString("https://nzbx.co/api/recent?category=tv", It.IsAny<NetworkCredential>()))
|
|
|
|
.Returns(File.ReadAllText(".\\Files\\Rss\\SizeParsing\\nzbx_recent.json"));
|
|
|
|
.Returns(ReadAllText("Files", "Rss", "SizeParsing", "nzbx_recent.json"));
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
|
var parseResults = Mocker.Resolve<Nzbx>().FetchRss();
|
|
|
|
var parseResults = Mocker.Resolve<Nzbx>().FetchRss();
|
|
|
@ -105,7 +105,7 @@ namespace NzbDrone.Core.Test.IndexerTests
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<HttpProvider>()
|
|
|
|
Mocker.GetMock<HttpProvider>()
|
|
|
|
.Setup(h => h.DownloadString("https://nzbx.co/api/search?q=30+Rock+S01E01", It.IsAny<NetworkCredential>()))
|
|
|
|
.Setup(h => h.DownloadString("https://nzbx.co/api/search?q=30+Rock+S01E01", It.IsAny<NetworkCredential>()))
|
|
|
|
.Returns(File.ReadAllText(".\\Files\\Rss\\SizeParsing\\nzbx_search.json"));
|
|
|
|
.Returns(ReadAllText("Files", "Rss", "SizeParsing", "nzbx_search.json"));
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
|
var parseResults = Mocker.Resolve<Nzbx>().FetchEpisode("30 Rock", 1, 1);
|
|
|
|
var parseResults = Mocker.Resolve<Nzbx>().FetchEpisode("30 Rock", 1, 1);
|
|
|
@ -119,7 +119,7 @@ namespace NzbDrone.Core.Test.IndexerTests
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Mocker.GetMock<HttpProvider>()
|
|
|
|
Mocker.GetMock<HttpProvider>()
|
|
|
|
.Setup(h => h.DownloadString("https://nzbx.co/api/recent?category=tv", It.IsAny<NetworkCredential>()))
|
|
|
|
.Setup(h => h.DownloadString("https://nzbx.co/api/recent?category=tv", It.IsAny<NetworkCredential>()))
|
|
|
|
.Returns(File.ReadAllText(".\\Files\\Rss\\SizeParsing\\nzbx_recent.json"));
|
|
|
|
.Returns(ReadAllText("Files", "Rss", "SizeParsing", "nzbx_recent.json"));
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
|
var parseResults = Mocker.Resolve<Nzbx>().FetchRss();
|
|
|
|
var parseResults = Mocker.Resolve<Nzbx>().FetchRss();
|
|
|
|