Merge branch 'master' of git://github.com/kayone/NzbDrone
This commit is contained in:
commit
4f16615e8b
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,15 @@
|
|||
<Configuration>
|
||||
<SnapshotDialog>
|
||||
<InitialDirectory>D:\My Dropbox\Git\NzbDrone</InitialDirectory>
|
||||
</SnapshotDialog>
|
||||
<CoverageFilters>
|
||||
<AllowFilters>
|
||||
<Filter>
|
||||
<ClassFilter>*</ClassFilter>
|
||||
<FunctionFilter>*</FunctionFilter>
|
||||
<ModuleFilter>*</ModuleFilter>
|
||||
</Filter>
|
||||
</AllowFilters>
|
||||
<DenyFilters />
|
||||
</CoverageFilters>
|
||||
</Configuration>
|
|
@ -5,8 +5,8 @@ using System.Collections.Generic;
|
|||
using System.Threading;
|
||||
using AutoMoq;
|
||||
using FizzWare.NBuilder;
|
||||
using MbUnit.Framework;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Jobs;
|
||||
|
|
|
@ -3,10 +3,8 @@ using System.Collections.Generic;
|
|||
using System.Text;
|
||||
using AutoMoq;
|
||||
using FizzWare.NBuilder;
|
||||
using Gallio.Framework;
|
||||
using MbUnit.Framework;
|
||||
using MbUnit.Framework.ContractVerifiers;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Repository;
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq.Expressions;
|
||||
using AutoMoq;
|
||||
using FizzWare.NBuilder;
|
||||
using MbUnit.Framework;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Repository;
|
||||
|
@ -53,9 +53,9 @@ namespace NzbDrone.Core.Test
|
|||
mocker.Resolve<EpisodeProvider>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
var actualCount = mocker.Resolve<EpisodeProvider>().GetEpisodeBySeries(seriesId);
|
||||
var actualCount = mocker.Resolve<EpisodeProvider>().GetEpisodeBySeries(seriesId).Count;
|
||||
mocker.GetMock<TvDbProvider>().VerifyAll();
|
||||
Assert.Count(episodeCount, actualCount);
|
||||
actualCount.Should().Be(episodeCount);
|
||||
mocker.VerifyAllMocks();
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,7 @@ namespace NzbDrone.Core.Test
|
|||
|
||||
//Assert
|
||||
mocker.VerifyAllMocks();
|
||||
Assert.Count(1, repo.All<Episode>());
|
||||
repo.All<Episode>().Should().HaveCount(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -234,7 +234,7 @@ namespace NzbDrone.Core.Test
|
|||
|
||||
//Assert
|
||||
mocker.VerifyAllMocks();
|
||||
Assert.Count(1, repo.All<Episode>());
|
||||
repo.All<Episode>().Should().HaveCount(1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -283,9 +283,10 @@ namespace NzbDrone.Core.Test
|
|||
e => e.Where(g => g.EpisodeFileId == 69).Count() == faketvDbResponse.Episodes.Count)),
|
||||
Times.Once());
|
||||
|
||||
Assert.Count(faketvDbResponse.Episodes.Count, updatedEpisodes);
|
||||
Assert.ForAll(updatedEpisodes, c => Assert.AreEqual(99, c.EpisodeId));
|
||||
Assert.ForAll(updatedEpisodes, c => Assert.AreEqual(69, c.EpisodeFileId));
|
||||
|
||||
updatedEpisodes.Should().HaveSameCount(faketvDbResponse.Episodes);
|
||||
updatedEpisodes.Should().OnlyContain(c => c.EpisodeId == 99);
|
||||
updatedEpisodes.Should().OnlyContain(c => c.EpisodeFileId == 69);
|
||||
}
|
||||
|
||||
|
||||
|
@ -307,7 +308,7 @@ namespace NzbDrone.Core.Test
|
|||
|
||||
//assert
|
||||
var episodes = episodeProvider.GetEpisodeBySeries(tvDbSeriesId);
|
||||
Assert.IsNotEmpty(episodes);
|
||||
episodes.Should().NotBeEmpty();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,8 +3,9 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using AutoMoq;
|
||||
using FizzWare.NBuilder;
|
||||
using MbUnit.Framework;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
|
@ -94,7 +95,7 @@ namespace NzbDrone.Core.Test
|
|||
.WhereRandom(1).Has(c => c.Quality = new Quality(QualityTypes.DVD, true))
|
||||
.Build();
|
||||
|
||||
Assert.Count(1, parseResults.Where(c => c.Quality.Proper));
|
||||
parseResults.Where(c => c.Quality.Proper).Should().HaveCount(1);
|
||||
|
||||
var episode = Builder<Episode>.CreateNew().Build();
|
||||
|
||||
|
@ -199,9 +200,9 @@ namespace NzbDrone.Core.Test
|
|||
|
||||
|
||||
[Test]
|
||||
[Row(0)]
|
||||
[Row(-1)]
|
||||
[Row(-100)]
|
||||
[TestCase(0)]
|
||||
[TestCase(-1)]
|
||||
[TestCase(-100)]
|
||||
[ExpectedException(typeof(ArgumentOutOfRangeException))]
|
||||
public void start_target_id_less_than_0_throws_exception(int target)
|
||||
{
|
||||
|
@ -227,6 +228,7 @@ namespace NzbDrone.Core.Test
|
|||
.Setup(c => c.GetEpisode(episode.EpisodeId))
|
||||
.Returns(episode);
|
||||
|
||||
|
||||
var indexer1 = new Mock<IndexerBase>();
|
||||
indexer1.Setup(c => c.FetchEpisode(episode.Series.Title, episode.SeasonNumber, episode.EpisodeNumber))
|
||||
.Returns(parseResults).Verifiable();
|
||||
|
@ -258,6 +260,54 @@ namespace NzbDrone.Core.Test
|
|||
indexer2.VerifyAll();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void start_should_use_scene_name_to_search()
|
||||
{
|
||||
var parseResults = Builder<EpisodeParseResult>.CreateListOfSize(4)
|
||||
.Build();
|
||||
|
||||
var episode = Builder<Episode>.CreateNew()
|
||||
.With(c => c.Series = Builder<Series>.CreateNew().With(s => s.SeriesId = 71256).Build())
|
||||
.With(c => c.SeasonNumber = 12)
|
||||
.Build();
|
||||
|
||||
var mocker = new AutoMoqer(MockBehavior.Strict);
|
||||
|
||||
mocker.GetMock<EpisodeProvider>()
|
||||
.Setup(c => c.GetEpisode(episode.EpisodeId))
|
||||
.Returns(episode);
|
||||
|
||||
var indexer1 = new Mock<IndexerBase>();
|
||||
indexer1.Setup(c => c.FetchEpisode("The Daily Show", episode.SeasonNumber, episode.EpisodeNumber))
|
||||
.Returns(parseResults).Verifiable();
|
||||
|
||||
|
||||
var indexer2 = new Mock<IndexerBase>();
|
||||
indexer2.Setup(c => c.FetchEpisode("The Daily Show", episode.SeasonNumber, episode.EpisodeNumber))
|
||||
.Returns(parseResults).Verifiable();
|
||||
|
||||
var indexers = new List<IndexerBase> { indexer1.Object, indexer2.Object };
|
||||
|
||||
mocker.GetMock<IndexerProvider>()
|
||||
.Setup(c => c.GetEnabledIndexers())
|
||||
.Returns(indexers);
|
||||
|
||||
mocker.GetMock<InventoryProvider>()
|
||||
.Setup(c => c.IsQualityNeeded(It.Is<EpisodeParseResult>(d => d.Series != null && d.Episodes.Count != 0))).Returns(false);
|
||||
|
||||
//Act
|
||||
mocker.Resolve<EpisodeSearchJob>().Start(new ProgressNotification("Test"), episode.EpisodeId);
|
||||
|
||||
|
||||
//Assert
|
||||
mocker.VerifyAllMocks();
|
||||
mocker.GetMock<InventoryProvider>().Verify(c => c.IsQualityNeeded(It.IsAny<EpisodeParseResult>()),
|
||||
Times.Exactly(8));
|
||||
ExceptionVerification.ExcpectedWarns(1);
|
||||
indexer1.VerifyAll();
|
||||
indexer2.VerifyAll();
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void start_failed_indexer_should_not_break_job()
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
using System;
|
||||
using FizzWare.NBuilder;
|
||||
using MbUnit.Framework;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
@ -14,10 +14,10 @@ namespace NzbDrone.Core.Test
|
|||
public class EpisodeStatusTest : TestBase
|
||||
{
|
||||
[Test]
|
||||
[Row(1, false, false, EpisodeStatusType.NotAired)]
|
||||
[Row(-2, false, false, EpisodeStatusType.Missing)]
|
||||
[Row(1, true, false, EpisodeStatusType.Ready)]
|
||||
[Row(1, false, true, EpisodeStatusType.Ignored)]
|
||||
[TestCase(1, false, false, EpisodeStatusType.NotAired)]
|
||||
[TestCase(-2, false, false, EpisodeStatusType.Missing)]
|
||||
[TestCase(1, true, false, EpisodeStatusType.Ready)]
|
||||
[TestCase(1, false, true, EpisodeStatusType.Ignored)]
|
||||
public void no_grab_date(int offsetDays, bool hasEpisodes, bool ignored, EpisodeStatusType status)
|
||||
{
|
||||
Episode episode = Builder<Episode>.CreateNew()
|
||||
|
@ -39,10 +39,10 @@ namespace NzbDrone.Core.Test
|
|||
|
||||
|
||||
[Test]
|
||||
[Row(1, false, false, EpisodeStatusType.NotAired)]
|
||||
[Row(-2, false, false, EpisodeStatusType.Missing)]
|
||||
[Row(1, true, false, EpisodeStatusType.Ready)]
|
||||
[Row(1, false, true, EpisodeStatusType.Ignored)]
|
||||
[TestCase(1, false, false, EpisodeStatusType.NotAired)]
|
||||
[TestCase(-2, false, false, EpisodeStatusType.Missing)]
|
||||
[TestCase(1, true, false, EpisodeStatusType.Ready)]
|
||||
[TestCase(1, false, true, EpisodeStatusType.Ignored)]
|
||||
public void old_grab_date(int offsetDays, bool hasEpisodes, bool ignored,
|
||||
EpisodeStatusType status)
|
||||
{
|
||||
|
@ -65,11 +65,11 @@ namespace NzbDrone.Core.Test
|
|||
|
||||
|
||||
[Test]
|
||||
[Row(1, false, false, EpisodeStatusType.Downloading)]
|
||||
[Row(-2, false, false, EpisodeStatusType.Downloading)]
|
||||
[Row(1, true, false, EpisodeStatusType.Downloading)]
|
||||
[Row(1, true, true, EpisodeStatusType.Downloading)]
|
||||
[Row(1, false, true, EpisodeStatusType.Downloading)]
|
||||
[TestCase(1, false, false, EpisodeStatusType.Downloading)]
|
||||
[TestCase(-2, false, false, EpisodeStatusType.Downloading)]
|
||||
[TestCase(1, true, false, EpisodeStatusType.Downloading)]
|
||||
[TestCase(1, true, true, EpisodeStatusType.Downloading)]
|
||||
[TestCase(1, false, true, EpisodeStatusType.Downloading)]
|
||||
public void recent_grab_date(int offsetDays, bool hasEpisodes, bool ignored,
|
||||
EpisodeStatusType status)
|
||||
{
|
||||
|
@ -91,9 +91,9 @@ namespace NzbDrone.Core.Test
|
|||
}
|
||||
|
||||
[Test]
|
||||
[Row(1, false, false, EpisodeStatusType.Ignored)]
|
||||
[Row(-2, false, false, EpisodeStatusType.Ignored)]
|
||||
[Row(1, false, true, EpisodeStatusType.Ignored)]
|
||||
[TestCase(1, false, false, EpisodeStatusType.Ignored)]
|
||||
[TestCase(-2, false, false, EpisodeStatusType.Ignored)]
|
||||
[TestCase(1, false, true, EpisodeStatusType.Ignored)]
|
||||
public void skipped_season(int offsetDays, bool hasEpisodes, bool ignored, EpisodeStatusType status)
|
||||
{
|
||||
Episode episode = Builder<Episode>.CreateNew()
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
using AutoMoq;
|
||||
using MbUnit.Framework;
|
||||
using Moq;
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||
using System.Collections.Generic;
|
||||
using NLog;
|
||||
using NLog.Targets;
|
||||
using MbUnit.Framework;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.Framework
|
||||
{
|
||||
|
@ -25,7 +25,7 @@ namespace NzbDrone.Core.Test.Framework
|
|||
_logs = new List<LogEventInfo>();
|
||||
}
|
||||
|
||||
internal static void AssertNoError()
|
||||
internal static void AssertNoUnexcpectedLogs()
|
||||
{
|
||||
ExcpectedFatals(0);
|
||||
ExcpectedErrors(0);
|
||||
|
|
|
@ -1,46 +1,26 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
using System;
|
||||
using System.IO;
|
||||
using MbUnit.Framework;
|
||||
using NLog;
|
||||
using NLog.Config;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test
|
||||
{
|
||||
[AssemblyFixture]
|
||||
[SetUpFixture]
|
||||
public class Fixtures
|
||||
{
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
foreach (
|
||||
var file in Directory.GetFiles(Directory.GetCurrentDirectory(), "*.db", SearchOption.AllDirectories))
|
||||
var filesToDelete = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.db", SearchOption.AllDirectories);
|
||||
foreach (var file in filesToDelete)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Delete(file);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[FixtureTearDown]
|
||||
public void FixtureTearDown()
|
||||
{
|
||||
foreach (var file in Directory.GetFiles(Directory.GetCurrentDirectory(), "*.db", SearchOption.AllDirectories)
|
||||
)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
File.Delete(file);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
catch{}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using MbUnit.Framework;
|
||||
using NUnit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.Framework
|
||||
{
|
||||
|
@ -15,7 +16,7 @@ namespace NzbDrone.Core.Test.Framework
|
|||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
if (!Assert.IsFailurePending) ExceptionVerification.AssertNoError();
|
||||
ExceptionVerification.AssertNoUnexcpectedLogs();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
using NUnit;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.Framework
|
||||
{
|
||||
public class TestBaseNunit
|
||||
// ReSharper disable InconsistentNaming
|
||||
{
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
ExceptionVerification.Reset();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
ExceptionVerification.AssertNoError();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -4,8 +4,9 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using AutoMoq;
|
||||
using FizzWare.NBuilder;
|
||||
using MbUnit.Framework;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
|
@ -121,7 +122,7 @@ namespace NzbDrone.Core.Test
|
|||
var storedHistory = repo.All<History>();
|
||||
var newHistiory = repo.All<History>().First();
|
||||
|
||||
Assert.Count(1, storedHistory);
|
||||
storedHistory.Should().HaveCount(1);
|
||||
Assert.AreEqual(history.Date, newHistiory.Date);
|
||||
Assert.AreEqual(history.EpisodeId, newHistiory.EpisodeId);
|
||||
Assert.AreEqual(history.NzbTitle, newHistiory.NzbTitle);
|
||||
|
|
|
@ -4,8 +4,8 @@ using System.Collections.Generic;
|
|||
using System.Threading;
|
||||
using AutoMoq;
|
||||
using FizzWare.NBuilder;
|
||||
using MbUnit.Framework;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Jobs;
|
||||
|
@ -79,7 +79,7 @@ namespace NzbDrone.Core.Test
|
|||
|
||||
|
||||
[Test]
|
||||
[Timeout(3)]
|
||||
[Timeout(3000)]
|
||||
public void failed_import_should_not_be_stuck_in_loop()
|
||||
{
|
||||
var series = Builder<Series>.CreateListOfSize(2)
|
||||
|
|
|
@ -6,8 +6,8 @@ using System.Net;
|
|||
using System.ServiceModel.Syndication;
|
||||
using AutoMoq;
|
||||
using FizzWare.NBuilder;
|
||||
using MbUnit.Framework;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
|
@ -16,6 +16,7 @@ using NzbDrone.Core.Providers.Indexer;
|
|||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using FluentAssertions;
|
||||
|
||||
namespace NzbDrone.Core.Test
|
||||
{
|
||||
|
@ -38,8 +39,11 @@ namespace NzbDrone.Core.Test
|
|||
indexerProvider.SaveSettings(settings);
|
||||
|
||||
//Assert
|
||||
Assert.Count(1, indexerProvider.GetAllISettings());
|
||||
Assert.Count(1, indexerProvider.GetEnabledIndexers());
|
||||
indexerProvider.GetAllISettings();
|
||||
|
||||
|
||||
indexerProvider.GetAllISettings().Should().HaveCount(1);
|
||||
indexerProvider.GetEnabledIndexers().Should().HaveCount(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -57,8 +61,9 @@ namespace NzbDrone.Core.Test
|
|||
indexerProvider.SaveSettings(settings);
|
||||
|
||||
//Assert
|
||||
Assert.Count(1, indexerProvider.GetAllISettings());
|
||||
Assert.IsEmpty(indexerProvider.GetEnabledIndexers());
|
||||
|
||||
indexerProvider.GetAllISettings().Should().HaveCount(1);
|
||||
indexerProvider.GetEnabledIndexers().Should().BeEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,10 +6,9 @@ using System.ServiceModel.Syndication;
|
|||
using System.Text;
|
||||
using AutoMoq;
|
||||
using FizzWare.NBuilder;
|
||||
using Gallio.Framework;
|
||||
using MbUnit.Framework;
|
||||
using MbUnit.Framework.ContractVerifiers;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
|
@ -25,10 +24,10 @@ namespace NzbDrone.Core.Test
|
|||
public class IndexerTests : TestBase
|
||||
{
|
||||
[Test]
|
||||
[Row("nzbsorg.xml", 0)]
|
||||
[Row("nzbsrus.xml", 6)]
|
||||
[Row("newzbin.xml", 1)]
|
||||
[Row("nzbmatrix.xml", 1)]
|
||||
[TestCase("nzbsorg.xml", 0)]
|
||||
[TestCase("nzbsrus.xml", 6)]
|
||||
[TestCase("newzbin.xml", 1)]
|
||||
[TestCase("nzbmatrix.xml", 1)]
|
||||
public void parse_feed_xml(string fileName, int warns)
|
||||
{
|
||||
var mocker = new AutoMoqer();
|
||||
|
@ -48,21 +47,19 @@ namespace NzbDrone.Core.Test
|
|||
foreach (var episodeParseResult in parseResults)
|
||||
{
|
||||
var Uri = new Uri(episodeParseResult.NzbUrl);
|
||||
Assert.DoesNotContain(Uri.PathAndQuery, "//");
|
||||
Uri.PathAndQuery.Should().NotContain("//");
|
||||
}
|
||||
|
||||
|
||||
Assert.IsNotEmpty(parseResults);
|
||||
|
||||
Assert.ForAll(parseResults, s => Assert.AreEqual(mockIndexer.Name, s.Indexer));
|
||||
Assert.ForAll(parseResults, s => Assert.AreNotEqual("", s.NzbTitle));
|
||||
Assert.ForAll(parseResults, s => Assert.AreNotEqual(null, s.NzbTitle));
|
||||
parseResults.Should().NotBeEmpty();
|
||||
parseResults.Should().OnlyContain(s => s.Indexer == mockIndexer.Name);
|
||||
parseResults.Should().OnlyContain(s => !String.IsNullOrEmpty(s.NzbTitle));
|
||||
|
||||
ExceptionVerification.ExcpectedWarns(warns);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void newzbin()
|
||||
public void newzbin_rss_fetch()
|
||||
{
|
||||
var mocker = new AutoMoqer();
|
||||
|
||||
|
@ -81,21 +78,20 @@ namespace NzbDrone.Core.Test
|
|||
foreach (var episodeParseResult in parseResults)
|
||||
{
|
||||
var Uri = new Uri(episodeParseResult.NzbUrl);
|
||||
Assert.DoesNotContain(Uri.PathAndQuery, "//");
|
||||
Uri.PathAndQuery.Should().NotContain("//");
|
||||
}
|
||||
|
||||
|
||||
Assert.IsNotEmpty(parseResults);
|
||||
Assert.ForAll(parseResults, s => Assert.AreEqual(newzbinProvider.Name, s.Indexer));
|
||||
Assert.ForAll(parseResults, s => Assert.AreNotEqual("", s.NzbTitle));
|
||||
Assert.ForAll(parseResults, s => Assert.AreNotEqual(null, s.NzbTitle));
|
||||
parseResults.Should().NotBeEmpty();
|
||||
parseResults.Should().OnlyContain(s => s.Indexer == newzbinProvider.Name);
|
||||
parseResults.Should().OnlyContain(s => !String.IsNullOrEmpty(s.NzbTitle));
|
||||
|
||||
|
||||
ExceptionVerification.ExcpectedWarns(1);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
[Row("Adventure.Inc.S03E19.DVDRip.XviD-OSiTV", 3, 19, QualityTypes.DVD)]
|
||||
[TestCase("Adventure.Inc.S03E19.DVDRip.XviD-OSiTV", 3, 19, QualityTypes.DVD)]
|
||||
public void custome_parser_partial_success(string title, int season, int episode, QualityTypes quality)
|
||||
{
|
||||
var mocker = new AutoMoqer();
|
||||
|
@ -123,7 +119,7 @@ namespace NzbDrone.Core.Test
|
|||
|
||||
|
||||
[Test]
|
||||
[Row("Adventure.Inc.DVDRip.XviD-OSiTV")]
|
||||
[TestCase("Adventure.Inc.DVDRip.XviD-OSiTV")]
|
||||
public void custome_parser_full_parse(string title)
|
||||
{
|
||||
var mocker = new AutoMoqer();
|
||||
|
@ -184,10 +180,35 @@ namespace NzbDrone.Core.Test
|
|||
|
||||
var result = mocker.Resolve<NzbsOrg>().FetchEpisode("Simpsons", 21, 23);
|
||||
|
||||
Assert.IsNotEmpty(result);
|
||||
Assert.ForAll(result, r => r.CleanTitle == "simpsons");
|
||||
Assert.ForAll(result, r => r.SeasonNumber == 21);
|
||||
Assert.ForAll(result, r => r.EpisodeNumbers.Contains(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));
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void newzbin_search_returns_valid_results()
|
||||
{
|
||||
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>();
|
||||
|
||||
var result = mocker.Resolve<Newzbin>().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));
|
||||
}
|
||||
|
||||
|
||||
|
@ -209,10 +230,11 @@ namespace NzbDrone.Core.Test
|
|||
|
||||
var result = mocker.Resolve<NzbsOrg>().FetchEpisode("Blue Bloods", 1, 19);
|
||||
|
||||
Assert.IsNotEmpty(result);
|
||||
Assert.ForAll(result, r => r.CleanTitle == "bluebloods");
|
||||
Assert.ForAll(result, r => r.SeasonNumber == 1);
|
||||
Assert.ForAll(result, r => r.EpisodeNumbers.Contains(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));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,9 @@ using System.Net;
|
|||
using System.ServiceModel.Syndication;
|
||||
using AutoMoq;
|
||||
using FizzWare.NBuilder;
|
||||
using MbUnit.Framework;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
|
@ -199,7 +200,7 @@ namespace NzbDrone.Core.Test
|
|||
//Assert
|
||||
Assert.IsTrue(result);
|
||||
Assert.AreSame(series, parseResultSingle.Series);
|
||||
Assert.Count(1, parseResultSingle.Episodes);
|
||||
parseResultSingle.Episodes.Should().HaveCount(1);
|
||||
Assert.AreEqual("TBD", parseResultSingle.Episodes[0].Title);
|
||||
mocker.VerifyAllMocks();
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using AutoMoq;
|
||||
using FizzWare.NBuilder;
|
||||
using MbUnit.Framework;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Repository;
|
||||
|
@ -206,17 +206,17 @@ namespace NzbDrone.Core.Test
|
|||
|
||||
//Should Download
|
||||
[Test]
|
||||
[Row(QualityTypes.SDTV, true, QualityTypes.HDTV, false, true)]
|
||||
[Row(QualityTypes.DVD, true, QualityTypes.Bluray720p, true, true)]
|
||||
[Row(QualityTypes.HDTV, false, QualityTypes.HDTV, true, true)]
|
||||
[Row(QualityTypes.HDTV, false, QualityTypes.HDTV, false, false)]
|
||||
[Row(QualityTypes.Bluray720p, true, QualityTypes.Bluray1080p, false, false)]
|
||||
[Row(QualityTypes.HDTV, true, QualityTypes.Bluray720p, true, true)]
|
||||
[Row(QualityTypes.Bluray1080p, true, QualityTypes.Bluray720p, true, false)]
|
||||
[Row(QualityTypes.Bluray1080p, true, QualityTypes.Bluray720p, false, false)]
|
||||
[Row(QualityTypes.Bluray1080p, false, QualityTypes.Bluray720p, true, false)]
|
||||
[Row(QualityTypes.HDTV, false, QualityTypes.Bluray720p, true, true)]
|
||||
[Row(QualityTypes.HDTV, true, QualityTypes.HDTV, false, false)]
|
||||
[TestCase(QualityTypes.SDTV, true, QualityTypes.HDTV, false, true)]
|
||||
[TestCase(QualityTypes.DVD, true, QualityTypes.Bluray720p, true, true)]
|
||||
[TestCase(QualityTypes.HDTV, false, QualityTypes.HDTV, true, true)]
|
||||
[TestCase(QualityTypes.HDTV, false, QualityTypes.HDTV, false, false)]
|
||||
[TestCase(QualityTypes.Bluray720p, true, QualityTypes.Bluray1080p, false, false)]
|
||||
[TestCase(QualityTypes.HDTV, true, QualityTypes.Bluray720p, true, true)]
|
||||
[TestCase(QualityTypes.Bluray1080p, true, QualityTypes.Bluray720p, true, false)]
|
||||
[TestCase(QualityTypes.Bluray1080p, true, QualityTypes.Bluray720p, false, false)]
|
||||
[TestCase(QualityTypes.Bluray1080p, false, QualityTypes.Bluray720p, true, false)]
|
||||
[TestCase(QualityTypes.HDTV, false, QualityTypes.Bluray720p, true, true)]
|
||||
[TestCase(QualityTypes.HDTV, true, QualityTypes.HDTV, false, false)]
|
||||
public void Is_upgrade(QualityTypes fileQuality, bool isFileProper, QualityTypes reportQuality,
|
||||
bool isReportProper, bool excpected)
|
||||
{
|
||||
|
|
|
@ -3,7 +3,8 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using AutoMoq;
|
||||
using MbUnit.Framework;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers.Jobs;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
@ -227,7 +228,8 @@ namespace NzbDrone.Core.Test
|
|||
|
||||
|
||||
//Assert
|
||||
Assert.Count(1, timers);
|
||||
|
||||
timers.Should().HaveCount(1);
|
||||
Assert.AreEqual(fakeTimer.DefaultInterval, timers[0].Interval);
|
||||
Assert.AreEqual(fakeTimer.Name, timers[0].Name);
|
||||
Assert.AreEqual(fakeTimer.GetType().ToString(), timers[0].TypeName);
|
||||
|
@ -264,7 +266,7 @@ namespace NzbDrone.Core.Test
|
|||
|
||||
|
||||
//Assert
|
||||
Assert.Count(1, timers);
|
||||
timers.Should().HaveCount(1);
|
||||
Assert.IsTrue(timers[0].Enable);
|
||||
}
|
||||
|
||||
|
@ -295,7 +297,7 @@ namespace NzbDrone.Core.Test
|
|||
|
||||
|
||||
//Assert
|
||||
Assert.Count(1, timers);
|
||||
timers.Should().HaveCount(1);
|
||||
Assert.IsFalse(timers[0].Enable);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,8 +5,9 @@ using System.Linq.Expressions;
|
|||
using System.Linq;
|
||||
using AutoMoq;
|
||||
using FizzWare.NBuilder;
|
||||
using MbUnit.Framework;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
|
@ -358,8 +359,9 @@ namespace NzbDrone.Core.Test
|
|||
|
||||
var result = mocker.Resolve<MediaFileProvider>().GetSeasonFiles(12);
|
||||
|
||||
Assert.Count(8, result);
|
||||
Assert.DoesNotContain(result, null);
|
||||
|
||||
result.Should().HaveCount(8);
|
||||
result.Should().NotContainNulls();
|
||||
mocker.VerifyAllMocks();
|
||||
|
||||
|
||||
|
|
|
@ -40,10 +40,8 @@
|
|||
<HintPath>..\packages\NBuilder.2.3.0.0\lib\FizzWare.NBuilder.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FluentAssertions">
|
||||
<HintPath>..\packages\FluentAssertions.1.4.0.0\Lib\.NetFramework 4.0\FluentAssertions.dll</HintPath>
|
||||
<HintPath>..\Libraries\FluentAssertions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Gallio, Version=3.2.0.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL" />
|
||||
<Reference Include="MbUnit, Version=3.2.0.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL" />
|
||||
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CommonServiceLocator.1.0\lib\NET35\Microsoft.Practices.ServiceLocation.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -93,7 +91,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="dbBenchmark.cs" />
|
||||
<Compile Include="Framework\TestBaseNunit.cs" />
|
||||
<Compile Include="Framework\TestBase.cs" />
|
||||
<Compile Include="InventoryProvider_IsMonitoredTest.cs" />
|
||||
<Compile Include="DownloadProviderTest.cs" />
|
||||
<Compile Include="EpisodeSearchJobTest.cs" />
|
||||
|
@ -111,7 +109,6 @@
|
|||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Framework\ExceptionVerification.cs" />
|
||||
<Compile Include="Framework\TestBase.cs" />
|
||||
<Compile Include="JobProviderTest.cs" />
|
||||
<Compile Include="QualityTest.cs" />
|
||||
<Compile Include="RepositoryProviderTest.cs" />
|
||||
|
@ -121,13 +118,14 @@
|
|||
<Compile Include="MediaFileProviderTests.cs" />
|
||||
<Compile Include="ConfigProviderTest.cs" />
|
||||
<Compile Include="EpisodeProviderTest.cs" />
|
||||
<Compile Include="Fixtures.cs" />
|
||||
<Compile Include="Framework\Fixtures.cs" />
|
||||
<Compile Include="Framework\MockLib.cs" />
|
||||
<Compile Include="ParserTest.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="QualityProfileTest.cs" />
|
||||
<Compile Include="RepoTest.cs" />
|
||||
<Compile Include="SabProviderTest.cs" />
|
||||
<Compile Include="SceneNameHelperTest.cs" />
|
||||
<Compile Include="SeriesProviderTest.cs" />
|
||||
<Compile Include="TvDbProviderTest.cs" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
using System;
|
||||
using MbUnit.Framework;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
|
@ -21,27 +22,27 @@ namespace NzbDrone.Core.Test
|
|||
|
||||
|
||||
[Test]
|
||||
[Row("Sonny.With.a.Chance.S02E15", "Sonny.With.a.Chance", 2, 15)]
|
||||
[Row("Two.and.a.Half.Me.103.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Me", 1, 3)]
|
||||
[Row("Two.and.a.Half.Me.113.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Me", 1, 13)]
|
||||
[Row("Two.and.a.Half.Me.1013.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Me", 10, 13)]
|
||||
[Row("Chuck.4x05.HDTV.XviD-LOL", "Chuck", 4, 5)]
|
||||
[Row("The.Girls.Next.Door.S03E06.DVDRip.XviD-WiDE", "The.Girls.Next.Door", 3, 6)]
|
||||
[Row("Degrassi.S10E27.WS.DSR.XviD-2HD", "Degrassi", 10, 27)]
|
||||
[Row("Parenthood.2010.S02E14.HDTV.XviD-LOL", "Parenthood 2010", 2, 14)]
|
||||
[Row("Hawaii Five 0 S01E19 720p WEB DL DD5 1 H 264 NT", "Hawaii Five", 1, 19)]
|
||||
[Row("The Event S01E14 A Message Back 720p WEB DL DD5 1 H264 SURFER", "The Event", 1, 14)]
|
||||
[Row("Adam Hills In Gordon St Tonight S01E07 WS PDTV XviD FUtV", "Adam Hills In Gordon St Tonight", 1, 7)]
|
||||
[Row("Adam Hills In Gordon St Tonight S01E07 WS PDTV XviD FUtV", "Adam Hills In Gordon St Tonight", 1, 7)]
|
||||
[Row("Adventure.Inc.S03E19.DVDRip.XviD-OSiTV", "Adventure.Inc", 3, 19)]
|
||||
[Row("S03E09 WS PDTV XviD FUtV", "", 3, 9)]
|
||||
[Row("5x10 WS PDTV XviD FUtV", "", 5, 10)]
|
||||
[Row("Castle.2009.S01E14.HDTV.XviD-LOL", "Castle 2009", 1, 14)]
|
||||
[Row("Pride.and.Prejudice.1995.S03E20.HDTV.XviD-LOL", "Pride and Prejudice 1995", 3, 20)]
|
||||
[TestCase("Sonny.With.a.Chance.S02E15", "Sonny.With.a.Chance", 2, 15)]
|
||||
[TestCase("Two.and.a.Half.Me.103.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Me", 1, 3)]
|
||||
[TestCase("Two.and.a.Half.Me.113.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Me", 1, 13)]
|
||||
[TestCase("Two.and.a.Half.Me.1013.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Me", 10, 13)]
|
||||
[TestCase("Chuck.4x05.HDTV.XviD-LOL", "Chuck", 4, 5)]
|
||||
[TestCase("The.Girls.Next.Door.S03E06.DVDRip.XviD-WiDE", "The.Girls.Next.Door", 3, 6)]
|
||||
[TestCase("Degrassi.S10E27.WS.DSR.XviD-2HD", "Degrassi", 10, 27)]
|
||||
[TestCase("Parenthood.2010.S02E14.HDTV.XviD-LOL", "Parenthood 2010", 2, 14)]
|
||||
[TestCase("Hawaii Five 0 S01E19 720p WEB DL DD5 1 H 264 NT", "Hawaii Five", 1, 19)]
|
||||
[TestCase("The Event S01E14 A Message Back 720p WEB DL DD5 1 H264 SURFER", "The Event", 1, 14)]
|
||||
[TestCase("Adam Hills In Gordon St Tonight S01E07 WS PDTV XviD FUtV", "Adam Hills In Gordon St Tonight", 1, 7)]
|
||||
[TestCase("Adam Hills In Gordon St Tonight S01E07 WS PDTV XviD FUtV", "Adam Hills In Gordon St Tonight", 1, 7)]
|
||||
[TestCase("Adventure.Inc.S03E19.DVDRip.XviD-OSiTV", "Adventure.Inc", 3, 19)]
|
||||
[TestCase("S03E09 WS PDTV XviD FUtV", "", 3, 9)]
|
||||
[TestCase("5x10 WS PDTV XviD FUtV", "", 5, 10)]
|
||||
[TestCase("Castle.2009.S01E14.HDTV.XviD-LOL", "Castle 2009", 1, 14)]
|
||||
[TestCase("Pride.and.Prejudice.1995.S03E20.HDTV.XviD-LOL", "Pride and Prejudice 1995", 3, 20)]
|
||||
//[Row(@"Season 4\07 WS PDTV XviD FUtV", "", 4, 7)]
|
||||
[Row("The.Office.S03E115.DVDRip.XviD-OSiTV", "The.Office", 3, 115)]
|
||||
[Row(@"Parks and Recreation - S02E21 - 94 Meetings - 720p TV.mkv", "Parks and Recreation", 2, 21)]
|
||||
[Row(@"24-7 Penguins-Capitals- Road to the NHL Winter Classic - S01E03 - Episode 3.mkv", "24-7 Penguins-Capitals- Road to the NHL Winter Classic", 1, 3)]
|
||||
[TestCase("The.Office.S03E115.DVDRip.XviD-OSiTV", "The.Office", 3, 115)]
|
||||
[TestCase(@"Parks and Recreation - S02E21 - 94 Meetings - 720p TV.mkv", "Parks and Recreation", 2, 21)]
|
||||
[TestCase(@"24-7 Penguins-Capitals- Road to the NHL Winter Classic - S01E03 - Episode 3.mkv", "24-7 Penguins-Capitals- Road to the NHL Winter Classic", 1, 3)]
|
||||
public void episode_parse(string postTitle, string title, int season, int episode)
|
||||
{
|
||||
var result = Parser.ParseEpisodeInfo(postTitle);
|
||||
|
@ -52,51 +53,51 @@ namespace NzbDrone.Core.Test
|
|||
}
|
||||
|
||||
[Test]
|
||||
[Row(@"z:\tv shows\battlestar galactica (2003)\Season 3\S03E05 - Collaborators.mkv", 3, 5)]
|
||||
[Row(@"z:\tv shows\modern marvels\Season 16\S16E03 - The Potato.mkv", 16, 3)]
|
||||
[Row(@"z:\tv shows\robot chicken\Specials\S00E16 - Dear Consumer - SD TV.avi", 0, 16)]
|
||||
[Row(@"D:\shares\TV Shows\Parks And Recreation\Season 2\S02E21 - 94 Meetings - 720p TV.mkv", 2, 21)]
|
||||
[Row(@"D:\shares\TV Shows\Battlestar Galactica (2003)\Season 2\S02E21.avi", 2, 21)]
|
||||
[TestCase(@"z:\tv shows\battlestar galactica (2003)\Season 3\S03E05 - Collaborators.mkv", 3, 5)]
|
||||
[TestCase(@"z:\tv shows\modern marvels\Season 16\S16E03 - The Potato.mkv", 16, 3)]
|
||||
[TestCase(@"z:\tv shows\robot chicken\Specials\S00E16 - Dear Consumer - SD TV.avi", 0, 16)]
|
||||
[TestCase(@"D:\shares\TV Shows\Parks And Recreation\Season 2\S02E21 - 94 Meetings - 720p TV.mkv", 2, 21)]
|
||||
[TestCase(@"D:\shares\TV Shows\Battlestar Galactica (2003)\Season 2\S02E21.avi", 2, 21)]
|
||||
public void file_path_parse(string path, int season, int episode)
|
||||
{
|
||||
var result = Parser.ParseEpisodeInfo(path);
|
||||
Assert.Count(1, result.EpisodeNumbers);
|
||||
result.EpisodeNumbers.Should().HaveCount(1);
|
||||
Assert.AreEqual(season, result.SeasonNumber);
|
||||
Assert.AreEqual(episode, result.EpisodeNumbers[0]);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
[Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", QualityTypes.DVD)]
|
||||
[Row("WEEDS.S03E01-06.DUAL.BDRip.X-viD.AC3.-HELLYWOOD", QualityTypes.DVD)]
|
||||
[Row("WEEDS.S03E01-06.DUAL.BDRip.AC3.-HELLYWOOD", QualityTypes.DVD)]
|
||||
[Row("Two.and.a.Half.Men.S08E05.720p.HDTV.X264-DIMENSION", QualityTypes.HDTV)]
|
||||
[Row("this has no extention or periods HDTV", QualityTypes.SDTV)]
|
||||
[Row("Chuck.S04E05.HDTV.XviD-LOL", QualityTypes.SDTV)]
|
||||
[Row("The.Girls.Next.Door.S03E06.DVDRip.XviD-WiDE", QualityTypes.DVD)]
|
||||
[Row("The.Girls.Next.Door.S03E06.DVD.Rip.XviD-WiDE", QualityTypes.DVD)]
|
||||
[Row("The.Girls.Next.Door.S03E06.HDTV-WiDE", QualityTypes.SDTV)]
|
||||
[Row("Degrassi.S10E27.WS.DSR.XviD-2HD", QualityTypes.SDTV)]
|
||||
[Row("Sonny.With.a.Chance.S02E15.720p.WEB-DL.DD5.1.H.264-SURFER", QualityTypes.WEBDL)]
|
||||
[Row("Sonny.With.a.Chance.S02E15.720p", QualityTypes.HDTV)]
|
||||
[Row("Sonny.With.a.Chance.S02E15.mkv", QualityTypes.HDTV)]
|
||||
[Row("Sonny.With.a.Chance.S02E15.avi", QualityTypes.SDTV)]
|
||||
[Row("Sonny.With.a.Chance.S02E15.xvid", QualityTypes.SDTV)]
|
||||
[Row("Sonny.With.a.Chance.S02E15.divx", QualityTypes.SDTV)]
|
||||
[Row("Sonny.With.a.Chance.S02E15", QualityTypes.Unknown)]
|
||||
[Row("Chuck - S01E04 - So Old - Playdate - 720p TV.mkv", QualityTypes.HDTV)]
|
||||
[Row("Chuck - S22E03 - MoneyBART - HD TV.mkv", QualityTypes.HDTV)]
|
||||
[Row("Chuck - S01E03 - Come Fly With Me - 720p BluRay.mkv", QualityTypes.Bluray720p)]
|
||||
[Row("Chuck - S01E03 - Come Fly With Me - 1080p BluRay.mkv", QualityTypes.Bluray1080p)]
|
||||
[Row("Chuck - S11E06 - D-Yikes! - 720p WEB-DL.mkv", QualityTypes.WEBDL)]
|
||||
[Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", QualityTypes.DVD)]
|
||||
[Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", QualityTypes.DVD)]
|
||||
[Row("Law & Order: Special Victims Unit - 11x11 - Quickie", QualityTypes.Unknown)]
|
||||
[Row("(<a href=\"http://www.newzbin.com/browse/post/6076286/nzb/\">NZB</a>)", QualityTypes.Unknown)]
|
||||
[Row("S07E23 - [HDTV].mkv ", QualityTypes.HDTV)]
|
||||
[Row("S07E23 - [WEBDL].mkv ", QualityTypes.WEBDL)]
|
||||
[Row("S07E23.mkv ", QualityTypes.HDTV)]
|
||||
[Row("S07E23 .avi ", QualityTypes.SDTV)]
|
||||
[TestCase("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", QualityTypes.DVD)]
|
||||
[TestCase("WEEDS.S03E01-06.DUAL.BDRip.X-viD.AC3.-HELLYWOOD", QualityTypes.DVD)]
|
||||
[TestCase("WEEDS.S03E01-06.DUAL.BDRip.AC3.-HELLYWOOD", QualityTypes.DVD)]
|
||||
[TestCase("Two.and.a.Half.Men.S08E05.720p.HDTV.X264-DIMENSION", QualityTypes.HDTV)]
|
||||
[TestCase("this has no extention or periods HDTV", QualityTypes.SDTV)]
|
||||
[TestCase("Chuck.S04E05.HDTV.XviD-LOL", QualityTypes.SDTV)]
|
||||
[TestCase("The.Girls.Next.Door.S03E06.DVDRip.XviD-WiDE", QualityTypes.DVD)]
|
||||
[TestCase("The.Girls.Next.Door.S03E06.DVD.Rip.XviD-WiDE", QualityTypes.DVD)]
|
||||
[TestCase("The.Girls.Next.Door.S03E06.HDTV-WiDE", QualityTypes.SDTV)]
|
||||
[TestCase("Degrassi.S10E27.WS.DSR.XviD-2HD", QualityTypes.SDTV)]
|
||||
[TestCase("Sonny.With.a.Chance.S02E15.720p.WEB-DL.DD5.1.H.264-SURFER", QualityTypes.WEBDL)]
|
||||
[TestCase("Sonny.With.a.Chance.S02E15.720p", QualityTypes.HDTV)]
|
||||
[TestCase("Sonny.With.a.Chance.S02E15.mkv", QualityTypes.HDTV)]
|
||||
[TestCase("Sonny.With.a.Chance.S02E15.avi", QualityTypes.SDTV)]
|
||||
[TestCase("Sonny.With.a.Chance.S02E15.xvid", QualityTypes.SDTV)]
|
||||
[TestCase("Sonny.With.a.Chance.S02E15.divx", QualityTypes.SDTV)]
|
||||
[TestCase("Sonny.With.a.Chance.S02E15", QualityTypes.Unknown)]
|
||||
[TestCase("Chuck - S01E04 - So Old - Playdate - 720p TV.mkv", QualityTypes.HDTV)]
|
||||
[TestCase("Chuck - S22E03 - MoneyBART - HD TV.mkv", QualityTypes.HDTV)]
|
||||
[TestCase("Chuck - S01E03 - Come Fly With Me - 720p BluRay.mkv", QualityTypes.Bluray720p)]
|
||||
[TestCase("Chuck - S01E03 - Come Fly With Me - 1080p BluRay.mkv", QualityTypes.Bluray1080p)]
|
||||
[TestCase("Chuck - S11E06 - D-Yikes! - 720p WEB-DL.mkv", QualityTypes.WEBDL)]
|
||||
[TestCase("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", QualityTypes.DVD)]
|
||||
[TestCase("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD.avi", QualityTypes.DVD)]
|
||||
[TestCase("Law & Order: Special Victims Unit - 11x11 - Quickie", QualityTypes.Unknown)]
|
||||
[TestCase("(<a href=\"http://www.newzbin.com/browse/post/6076286/nzb/\">NZB</a>)", QualityTypes.Unknown)]
|
||||
[TestCase("S07E23 - [HDTV].mkv ", QualityTypes.HDTV)]
|
||||
[TestCase("S07E23 - [WEBDL].mkv ", QualityTypes.WEBDL)]
|
||||
[TestCase("S07E23.mkv ", QualityTypes.HDTV)]
|
||||
[TestCase("S07E23 .avi ", QualityTypes.SDTV)]
|
||||
public void quality_parse(string postTitle, object quality)
|
||||
{
|
||||
var result = Parser.ParseQuality(postTitle);
|
||||
|
@ -127,31 +128,31 @@ namespace NzbDrone.Core.Test
|
|||
}
|
||||
|
||||
[Test]
|
||||
[Timeout(1)]
|
||||
[Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", "WEEDS", 3, new[] { 1, 2, 3, 4, 5, 6 }, 6)]
|
||||
[Row("Two.and.a.Half.Men.103.104.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Men", 1, new[] { 3, 4 }, 2)]
|
||||
[Row("Weeds.S03E01.S03E02.720p.HDTV.X264-DIMENSION", "Weeds", 3, new[] { 1, 2 }, 2)]
|
||||
[Row("The Borgias S01e01 e02 ShoHD On Demand 1080i DD5 1 ALANiS", "The Borgias", 1, new[] { 1, 2 }, 2)]
|
||||
[Row("Big Time Rush 1x01 to 10 480i DD2 0 Sianto", "Big Time Rush", 1, new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, 10)]
|
||||
[Row("White.Collar.2x04.2x05.720p.BluRay-FUTV", "White.Collar", 2, new[] { 4, 5 }, 2)]
|
||||
[Timeout(1000)]
|
||||
[TestCase("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", "WEEDS", 3, new[] { 1, 2, 3, 4, 5, 6 }, 6)]
|
||||
[TestCase("Two.and.a.Half.Men.103.104.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Men", 1, new[] { 3, 4 }, 2)]
|
||||
[TestCase("Weeds.S03E01.S03E02.720p.HDTV.X264-DIMENSION", "Weeds", 3, new[] { 1, 2 }, 2)]
|
||||
[TestCase("The Borgias S01e01 e02 ShoHD On Demand 1080i DD5 1 ALANiS", "The Borgias", 1, new[] { 1, 2 }, 2)]
|
||||
[TestCase("Big Time Rush 1x01 to 10 480i DD2 0 Sianto", "Big Time Rush", 1, new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, 10)]
|
||||
[TestCase("White.Collar.2x04.2x05.720p.BluRay-FUTV", "White.Collar", 2, new[] { 4, 5 }, 2)]
|
||||
//[Row("The.Kennedys.Part.1.and.Part.2.DSR.XviD-SYS", 1, new[] { 1, 2 })]
|
||||
public void episode_multipart_parse(string postTitle, string title, int season, int[] episodes, int count)
|
||||
{
|
||||
var result = Parser.ParseEpisodeInfo(postTitle);
|
||||
Assert.AreEqual(season, result.SeasonNumber);
|
||||
Assert.Count(episodes.Length, result.EpisodeNumbers);
|
||||
Assert.AreElementsEqualIgnoringOrder(episodes, result.EpisodeNumbers);
|
||||
result.EpisodeNumbers.Should().HaveSameCount(episodes);
|
||||
result.EpisodeNumbers.Should().BeEquivalentTo(result.EpisodeNumbers);
|
||||
Assert.AreEqual(Parser.NormalizeTitle(title), result.CleanTitle);
|
||||
Assert.AreEqual(count, result.EpisodeNumbers.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Row("Conan 2011 04 18 Emma Roberts HDTV XviD BFF", "Conan", 2011, 04, 18)]
|
||||
[Row("The Tonight Show With Jay Leno 2011 04 15 1080i HDTV DD5 1 MPEG2 TrollHD", "The Tonight Show With Jay Leno", 2011, 04, 15)]
|
||||
[Row("The.Daily.Show.2010.10.11.Johnny.Knoxville.iTouch-MW", "The.Daily.Show", 2010, 10, 11)]
|
||||
[Row("The Daily Show - 2011-04-12 - Gov. Deval Patrick", "The.Daily.Show", 2011, 04, 12)]
|
||||
[Row("2011.01.10 - Denis Leary - HD TV.mkv", "", 2011, 1, 10)]
|
||||
[Row("2011.03.13 - Denis Leary - HD TV.mkv", "", 2011, 3, 13)]
|
||||
[TestCase("Conan 2011 04 18 Emma Roberts HDTV XviD BFF", "Conan", 2011, 04, 18)]
|
||||
[TestCase("The Tonight Show With Jay Leno 2011 04 15 1080i HDTV DD5 1 MPEG2 TrollHD", "The Tonight Show With Jay Leno", 2011, 04, 15)]
|
||||
[TestCase("The.Daily.Show.2010.10.11.Johnny.Knoxville.iTouch-MW", "The.Daily.Show", 2010, 10, 11)]
|
||||
[TestCase("The Daily Show - 2011-04-12 - Gov. Deval Patrick", "The.Daily.Show", 2011, 04, 12)]
|
||||
[TestCase("2011.01.10 - Denis Leary - HD TV.mkv", "", 2011, 1, 10)]
|
||||
[TestCase("2011.03.13 - Denis Leary - HD TV.mkv", "", 2011, 3, 13)]
|
||||
public void episode_daily_parse(string postTitle, string title, int year, int month, int day)
|
||||
{
|
||||
var result = Parser.ParseEpisodeInfo(postTitle);
|
||||
|
@ -163,9 +164,9 @@ namespace NzbDrone.Core.Test
|
|||
|
||||
|
||||
[Test]
|
||||
[Row("30.Rock.Season.04.HDTV.XviD-DIMENSION", "30.Rock", 4)]
|
||||
[Row("Parks.and.Recreation.S02.720p.x264-DIMENSION", "Parks.and.Recreation", 2)]
|
||||
[Row("The.Office.US.S03.720p.x264-DIMENSION", "The.Office.US", 3)]
|
||||
[TestCase("30.Rock.Season.04.HDTV.XviD-DIMENSION", "30.Rock", 4)]
|
||||
[TestCase("Parks.and.Recreation.S02.720p.x264-DIMENSION", "Parks.and.Recreation", 2)]
|
||||
[TestCase("The.Office.US.S03.720p.x264-DIMENSION", "The.Office.US", 3)]
|
||||
public void full_season_release_parse(string postTitle, string title, int season)
|
||||
{
|
||||
var result = Parser.ParseEpisodeInfo(postTitle);
|
||||
|
@ -175,11 +176,11 @@ namespace NzbDrone.Core.Test
|
|||
}
|
||||
|
||||
[Test]
|
||||
[Row("Conan", "conan")]
|
||||
[Row("The Tonight Show With Jay Leno", "tonightshowwithjayleno")]
|
||||
[Row("The.Daily.Show", "dailyshow")]
|
||||
[Row("Castle (2009)", "castle2009")]
|
||||
[Row("Parenthood.2010", "parenthood2010")]
|
||||
[TestCase("Conan", "conan")]
|
||||
[TestCase("The Tonight Show With Jay Leno", "tonightshowwithjayleno")]
|
||||
[TestCase("The.Daily.Show", "dailyshow")]
|
||||
[TestCase("Castle (2009)", "castle2009")]
|
||||
[TestCase("Parenthood.2010", "parenthood2010")]
|
||||
public void series_name_normalize(string parsedSeriesName, string seriesName)
|
||||
{
|
||||
var result = Parser.NormalizeTitle(parsedSeriesName);
|
||||
|
@ -187,11 +188,11 @@ namespace NzbDrone.Core.Test
|
|||
}
|
||||
|
||||
[Test]
|
||||
[Row(@"c:\test\", @"c:\test")]
|
||||
[Row(@"c:\\test\\", @"c:\test")]
|
||||
[Row(@"C:\\Test\\", @"C:\Test")]
|
||||
[Row(@"C:\\Test\\Test\", @"C:\Test\Test")]
|
||||
[Row(@"\\Testserver\Test\", @"\\Testserver\Test")]
|
||||
[TestCase(@"c:\test\", @"c:\test")]
|
||||
[TestCase(@"c:\\test\\", @"c:\test")]
|
||||
[TestCase(@"C:\\Test\\", @"C:\Test")]
|
||||
[TestCase(@"C:\\Test\\Test\", @"C:\Test\Test")]
|
||||
[TestCase(@"\\Testserver\Test\", @"\\Testserver\Test")]
|
||||
public void Normalize_Path(string dirty, string clean)
|
||||
{
|
||||
var result = Parser.NormalizePath(dirty);
|
||||
|
@ -199,9 +200,9 @@ namespace NzbDrone.Core.Test
|
|||
}
|
||||
|
||||
[Test]
|
||||
[Row("CaPitAl", "capital")]
|
||||
[Row("peri.od", "period")]
|
||||
[Row("this.^&%^**$%@#$!That", "thisthat")]
|
||||
[TestCase("CaPitAl", "capital")]
|
||||
[TestCase("peri.od", "period")]
|
||||
[TestCase("this.^&%^**$%@#$!That", "thisthat")]
|
||||
public void Normalize_Title(string dirty, string clean)
|
||||
{
|
||||
var result = Parser.NormalizeTitle(dirty);
|
||||
|
@ -209,12 +210,12 @@ namespace NzbDrone.Core.Test
|
|||
}
|
||||
|
||||
[Test]
|
||||
[Row("the")]
|
||||
[Row("and")]
|
||||
[Row("or")]
|
||||
[Row("a")]
|
||||
[Row("an")]
|
||||
[Row("of")]
|
||||
[TestCase("the")]
|
||||
[TestCase("and")]
|
||||
[TestCase("or")]
|
||||
[TestCase("a")]
|
||||
[TestCase("an")]
|
||||
[TestCase("of")]
|
||||
public void Normalize_removed_common_words(string word)
|
||||
{
|
||||
var dirtyFormat = new[]
|
||||
|
@ -239,12 +240,12 @@ namespace NzbDrone.Core.Test
|
|||
}
|
||||
|
||||
[Test]
|
||||
[Row("the")]
|
||||
[Row("and")]
|
||||
[Row("or")]
|
||||
[Row("a")]
|
||||
[Row("an")]
|
||||
[Row("of")]
|
||||
[TestCase("the")]
|
||||
[TestCase("and")]
|
||||
[TestCase("or")]
|
||||
[TestCase("a")]
|
||||
[TestCase("an")]
|
||||
[TestCase("of")]
|
||||
public void Normalize_not_removed_common_words_in_the_middle(string word)
|
||||
{
|
||||
var dirtyFormat = new[]
|
||||
|
|
|
@ -3,7 +3,8 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using MbUnit.Framework;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
@ -64,7 +65,8 @@ namespace NzbDrone.Core.Test
|
|||
|
||||
var result = repo.All<Series>();
|
||||
|
||||
Assert.Count(1, result);
|
||||
|
||||
result.Should().HaveCount(1);
|
||||
Assert.AreEqual(result.ToList()[0].QualityProfile.Name, testProfile.Name);
|
||||
|
||||
//Act
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Gallio.Framework;
|
||||
using MbUnit.Framework;
|
||||
using MbUnit.Framework.ContractVerifiers;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
|
||||
|
@ -14,39 +13,43 @@ namespace NzbDrone.Core.Test
|
|||
public class QualityTest
|
||||
{
|
||||
[Test]
|
||||
[Ignore("No supported asserts are available")]
|
||||
public void Icomparer_greater_test()
|
||||
{
|
||||
var first = new Quality(QualityTypes.DVD, true);
|
||||
var second = new Quality(QualityTypes.Bluray1080p, true);
|
||||
|
||||
Assert.GreaterThan(second, first);
|
||||
//Assert.GreaterThan(second, first);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("No supported asserts are available")]
|
||||
public void Icomparer_greater_proper()
|
||||
{
|
||||
var first = new Quality(QualityTypes.Bluray1080p, false);
|
||||
var second = new Quality(QualityTypes.Bluray1080p, true);
|
||||
|
||||
Assert.GreaterThan(second, first);
|
||||
//Assert.GreaterThan(second, first);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("No supported asserts are available")]
|
||||
public void Icomparer_lesser()
|
||||
{
|
||||
var first = new Quality(QualityTypes.DVD, true);
|
||||
var second = new Quality(QualityTypes.Bluray1080p, true);
|
||||
|
||||
Assert.LessThan(first, second);
|
||||
//Assert.LessThan(first, second);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("No supported asserts are available")]
|
||||
public void Icomparer_lesser_proper()
|
||||
{
|
||||
var first = new Quality(QualityTypes.DVD, false);
|
||||
var second = new Quality(QualityTypes.DVD, true);
|
||||
|
||||
Assert.LessThan(first, second);
|
||||
//Assert.LessThan(first, second);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -2,9 +2,10 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using MbUnit.Framework;
|
||||
using FluentAssertions;
|
||||
using NLog;
|
||||
using NLog.Config;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Instrumentation;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
@ -33,7 +34,8 @@ namespace NzbDrone.Core.Test
|
|||
Assert.AreEqual(fakeSeries.SeriesId, fetchedSeries.SeriesId);
|
||||
Assert.AreEqual(fakeSeries.Title, fetchedSeries.Title);
|
||||
|
||||
Assert.IsNotEmpty(fetchedSeries.Episodes);
|
||||
|
||||
fetchedSeries.Episodes.Should().HaveCount(1);
|
||||
Assert.AreEqual(fetchedSeries.Episodes[0].EpisodeId, fakeEpisode.EpisodeId);
|
||||
Assert.AreEqual(fetchedSeries.Episodes[0].SeriesId, fakeEpisode.SeriesId);
|
||||
Assert.AreEqual(fetchedSeries.Episodes[0].Title, fakeEpisode.Title);
|
||||
|
@ -60,9 +62,9 @@ namespace NzbDrone.Core.Test
|
|||
Assert.AreEqual(fakeEpisode.Title, fetchedEpisode.Title);
|
||||
|
||||
Console.WriteLine("=======================");
|
||||
var ttt= fetchedEpisode.Series;
|
||||
var ttt = fetchedEpisode.Series;
|
||||
Console.WriteLine("=======================");
|
||||
var tttd= fetchedEpisode.Series;
|
||||
var tttd = fetchedEpisode.Series;
|
||||
Console.WriteLine("=======================");
|
||||
|
||||
//Assert.Contains(fetchedEpisode.ToString(), fakeSeries.Title);
|
||||
|
@ -73,20 +75,20 @@ namespace NzbDrone.Core.Test
|
|||
[Description(
|
||||
"This test confirms that the tvdb id stored in the db is preserved rather than being replaced by an auto incrementing value"
|
||||
)]
|
||||
public void tvdbid_is_preserved([RandomNumbers(Minimum = 100, Maximum = 999, Count = 1)] int tvdbId)
|
||||
public void tvdbid_is_preserved()
|
||||
{
|
||||
//Arrange
|
||||
var sonicRepo = MockLib.GetEmptyRepository();
|
||||
var series = Builder<Series>.CreateNew().With(c => c.SeriesId = tvdbId).Build();
|
||||
var series = Builder<Series>.CreateNew().With(c => c.SeriesId = 18).Build();
|
||||
|
||||
//Act
|
||||
var addId = sonicRepo.Add(series);
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual(tvdbId, addId);
|
||||
Assert.AreEqual(18, addId);
|
||||
var allSeries = sonicRepo.All<Series>();
|
||||
Assert.IsNotEmpty(allSeries);
|
||||
Assert.AreEqual(tvdbId, allSeries.First().SeriesId);
|
||||
allSeries.Should().HaveCount(1);
|
||||
Assert.AreEqual(18, allSeries.First().SeriesId);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -118,8 +120,7 @@ namespace NzbDrone.Core.Test
|
|||
Logger.Info(message);
|
||||
|
||||
//Assert
|
||||
Assert.IsNotEmpty(sonicRepo.All<Log>());
|
||||
Assert.Count(1, sonicRepo.All<Log>());
|
||||
sonicRepo.All<Log>().Should().HaveCount(1);
|
||||
|
||||
var logItem = sonicRepo.All<Log>().First();
|
||||
Assert.AreNotEqual(new DateTime(), logItem.Time);
|
||||
|
@ -153,8 +154,7 @@ namespace NzbDrone.Core.Test
|
|||
Logger.ErrorException(message, ex);
|
||||
|
||||
//Assert
|
||||
Assert.IsNotEmpty(sonicRepo.All<Log>());
|
||||
Assert.Count(1, sonicRepo.All<Log>());
|
||||
sonicRepo.All<Log>().Should().HaveCount(1);
|
||||
|
||||
var logItem = sonicRepo.All<Log>().First();
|
||||
Assert.AreNotEqual(new DateTime(), logItem.Time);
|
||||
|
@ -187,8 +187,7 @@ namespace NzbDrone.Core.Test
|
|||
Logger.ErrorException(message, ex);
|
||||
|
||||
//Assert
|
||||
Assert.IsNotEmpty(sonicRepo.All<Log>());
|
||||
Assert.Count(1, sonicRepo.All<Log>());
|
||||
sonicRepo.All<Log>().Should().HaveCount(1);
|
||||
|
||||
var logItem = sonicRepo.All<Log>().First();
|
||||
Assert.AreNotEqual(new DateTime(), logItem.Time);
|
||||
|
|
|
@ -2,11 +2,10 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using Gallio.Framework;
|
||||
using MbUnit.Framework;
|
||||
using MbUnit.Framework.ContractVerifiers;
|
||||
using FluentAssertions;
|
||||
using Migrator.Framework;
|
||||
using Migrator.Providers.SQLite;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Instrumentation;
|
||||
using NzbDrone.Core.Repository;
|
||||
|
@ -29,21 +28,22 @@ namespace NzbDrone.Core.Test
|
|||
var provider = new RepositoryProvider();
|
||||
var types = provider.GetRepositoryTypes();
|
||||
|
||||
Assert.IsNotEmpty(types);
|
||||
Assert.Contains(types, typeof(Config));
|
||||
Assert.Contains(types, typeof(Episode));
|
||||
Assert.Contains(types, typeof(EpisodeFile));
|
||||
Assert.Contains(types, typeof(ExternalNotificationSetting));
|
||||
Assert.Contains(types, typeof(History));
|
||||
Assert.Contains(types, typeof(IndexerSetting));
|
||||
Assert.Contains(types, typeof(JobSetting));
|
||||
Assert.Contains(types, typeof(RootDir));
|
||||
Assert.Contains(types, typeof(Season));
|
||||
Assert.Contains(types, typeof(Series));
|
||||
types.Should().Contain(typeof(Config));
|
||||
types.Should().Contain(typeof(Episode));
|
||||
types.Should().Contain(typeof(EpisodeFile));
|
||||
types.Should().Contain(typeof(ExternalNotificationSetting));
|
||||
types.Should().Contain(typeof(History));
|
||||
types.Should().Contain(typeof(IndexerSetting));
|
||||
types.Should().Contain(typeof(JobSetting));
|
||||
types.Should().Contain(typeof(RootDir));
|
||||
types.Should().Contain(typeof(Season));
|
||||
types.Should().Contain(typeof(Season));
|
||||
types.Should().Contain(typeof(Series));
|
||||
types.Should().Contain(typeof(QualityProfile));
|
||||
|
||||
types.Should().NotContain(typeof(QualityTypes));
|
||||
|
||||
Assert.Contains(types, typeof(QualityProfile));
|
||||
|
||||
Assert.DoesNotContain(types, typeof(QualityTypes));
|
||||
}
|
||||
|
||||
|
||||
|
@ -57,7 +57,8 @@ namespace NzbDrone.Core.Test
|
|||
var typeTable = provider.GetSchemaFromType(typeof(TestRepoType));
|
||||
|
||||
Assert.IsNotNull(typeTable.Columns);
|
||||
Assert.Count(3, typeTable.Columns);
|
||||
|
||||
typeTable.Columns.Should().HaveCount(3);
|
||||
Assert.AreEqual("TestRepoTypes", typeTable.Name);
|
||||
}
|
||||
|
||||
|
@ -89,12 +90,12 @@ namespace NzbDrone.Core.Test
|
|||
var repo = new SimpleRepository(dbProvider, SimpleRepositoryOptions.RunMigrations);
|
||||
var sqliteDatabase = new SQLiteTransformationProvider(new SQLiteDialect(), connectionString);
|
||||
|
||||
repo.Add(new TestRepoType(){Value = "Dummy"});
|
||||
repo.Add(new TestRepoType() { Value = "Dummy" });
|
||||
|
||||
var repositoryProvider = new RepositoryProvider();
|
||||
var columns = repositoryProvider.GetColumnsFromDatabase(sqliteDatabase, "TestRepoTypes");
|
||||
|
||||
Assert.Count(3, columns);
|
||||
columns.Should().HaveCount(3);
|
||||
|
||||
}
|
||||
|
||||
|
@ -107,7 +108,7 @@ namespace NzbDrone.Core.Test
|
|||
var sqliteDatabase = new SQLiteTransformationProvider(new SQLiteDialect(), connectionString);
|
||||
var repo = new SimpleRepository(dbProvider, SimpleRepositoryOptions.RunMigrations);
|
||||
|
||||
repo.Add(new TestRepoType(){Value = "Dummy"});
|
||||
repo.Add(new TestRepoType() { Value = "Dummy" });
|
||||
|
||||
var repositoryProvider = new RepositoryProvider();
|
||||
var typeSchema = repositoryProvider.GetSchemaFromType(typeof(TestRepoType2));
|
||||
|
@ -117,7 +118,7 @@ namespace NzbDrone.Core.Test
|
|||
var deletedColumns = repositoryProvider.GetDeletedColumns(typeSchema, columns);
|
||||
|
||||
|
||||
Assert.Count(1, deletedColumns);
|
||||
deletedColumns.Should().HaveCount(1);
|
||||
Assert.AreEqual("NewName", deletedColumns[0].Name.Trim('[', ']'));
|
||||
}
|
||||
|
||||
|
@ -140,7 +141,7 @@ namespace NzbDrone.Core.Test
|
|||
var deletedColumns = repositoryProvider.GetNewColumns(typeSchema, columns);
|
||||
|
||||
|
||||
Assert.Count(1, deletedColumns);
|
||||
deletedColumns.Should().HaveCount(1);
|
||||
Assert.AreEqual("NewName", deletedColumns[0].Name.Trim('[', ']'));
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,9 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using AutoMoq;
|
||||
using MbUnit.Framework;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Repository;
|
||||
|
@ -23,8 +24,8 @@ namespace NzbDrone.Core.Test
|
|||
{
|
||||
//Setup
|
||||
var sonicRepo = MockLib.GetEmptyRepository();
|
||||
sonicRepo.Add(new RootDir {Path = @"C:\TV"});
|
||||
sonicRepo.Add(new RootDir {Path = @"C:\TV2"});
|
||||
sonicRepo.Add(new RootDir { Path = @"C:\TV" });
|
||||
sonicRepo.Add(new RootDir { Path = @"C:\TV2" });
|
||||
|
||||
var mocker = new AutoMoqer();
|
||||
|
||||
|
@ -50,13 +51,14 @@ namespace NzbDrone.Core.Test
|
|||
|
||||
//Act
|
||||
var rootDirProvider = mocker.Resolve<RootDirProvider>();
|
||||
rootDirProvider.Add(new RootDir {Path = path});
|
||||
rootDirProvider.Add(new RootDir { Path = path });
|
||||
|
||||
|
||||
//Assert
|
||||
var rootDirs = rootDirProvider.GetAll();
|
||||
Assert.IsNotEmpty(rootDirs);
|
||||
Assert.Count(1, rootDirs);
|
||||
|
||||
rootDirs.Should().HaveCount(1);
|
||||
Assert.AreEqual(path, rootDirs.First().Path);
|
||||
}
|
||||
|
||||
|
@ -71,13 +73,13 @@ namespace NzbDrone.Core.Test
|
|||
|
||||
//Act
|
||||
var rootDirProvider = mocker.Resolve<RootDirProvider>();
|
||||
rootDirProvider.Add(new RootDir {Path = @"C:\TV"});
|
||||
rootDirProvider.Update(new RootDir {Id = 1, Path = path});
|
||||
rootDirProvider.Add(new RootDir { Path = @"C:\TV" });
|
||||
rootDirProvider.Update(new RootDir { Id = 1, Path = path });
|
||||
|
||||
//Assert
|
||||
var rootDirs = rootDirProvider.GetAll();
|
||||
Assert.IsNotEmpty(rootDirs);
|
||||
Assert.Count(1, rootDirs);
|
||||
rootDirs.Should().HaveCount(1);
|
||||
Assert.AreEqual(path, rootDirs.First().Path);
|
||||
}
|
||||
|
||||
|
@ -90,12 +92,12 @@ namespace NzbDrone.Core.Test
|
|||
|
||||
//Act
|
||||
var rootDirProvider = mocker.Resolve<RootDirProvider>();
|
||||
rootDirProvider.Add(new RootDir {Path = @"C:\TV"});
|
||||
rootDirProvider.Add(new RootDir { Path = @"C:\TV" });
|
||||
rootDirProvider.Remove(1);
|
||||
|
||||
//Assert
|
||||
var rootDirs = rootDirProvider.GetAll();
|
||||
Assert.Count(0, rootDirs);
|
||||
rootDirs.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -110,7 +112,7 @@ namespace NzbDrone.Core.Test
|
|||
|
||||
//Act
|
||||
var rootDirProvider = mocker.Resolve<RootDirProvider>();
|
||||
rootDirProvider.Add(new RootDir {Id = id, Path = path});
|
||||
rootDirProvider.Add(new RootDir { Id = id, Path = path });
|
||||
|
||||
//Assert
|
||||
var rootDir = rootDirProvider.GetRootDir(id);
|
||||
|
|
|
@ -5,8 +5,8 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using AutoMoq;
|
||||
using FizzWare.NBuilder;
|
||||
using MbUnit.Framework;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
|
@ -179,7 +179,7 @@ namespace NzbDrone.Core.Test
|
|||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(ApplicationException), Message = "API Key Incorrect")]
|
||||
[ExpectedException(typeof(ApplicationException), ExpectedMessage= "API Key Incorrect")]
|
||||
public void IsInQueue_False_Error()
|
||||
{
|
||||
//Setup
|
||||
|
@ -213,12 +213,12 @@ namespace NzbDrone.Core.Test
|
|||
}
|
||||
|
||||
[Test]
|
||||
[Row(1, new[] { 2 }, "My Episode Title", QualityTypes.DVD, false, "My Series Name - 1x2 - My Episode Title [DVD]")]
|
||||
[Row(1, new[] { 2 }, "My Episode Title", QualityTypes.DVD, true, "My Series Name - 1x2 - My Episode Title [DVD] [Proper]")]
|
||||
[Row(1, new[] { 2 }, "", QualityTypes.DVD, true, "My Series Name - 1x2 - [DVD] [Proper]")]
|
||||
[Row(1, new[] { 2, 4 }, "My Episode Title", QualityTypes.HDTV, false, "My Series Name - 1x2-1x4 - My Episode Title [HDTV]")]
|
||||
[Row(1, new[] { 2, 4 }, "My Episode Title", QualityTypes.HDTV, true, "My Series Name - 1x2-1x4 - My Episode Title [HDTV] [Proper]")]
|
||||
[Row(1, new[] { 2, 4 }, "", QualityTypes.HDTV, true, "My Series Name - 1x2-1x4 - [HDTV] [Proper]")]
|
||||
[TestCase(1, new[] { 2 }, "My Episode Title", QualityTypes.DVD, false, "My Series Name - 1x2 - My Episode Title [DVD]")]
|
||||
[TestCase(1, new[] { 2 }, "My Episode Title", QualityTypes.DVD, true, "My Series Name - 1x2 - My Episode Title [DVD] [Proper]")]
|
||||
[TestCase(1, new[] { 2 }, "", QualityTypes.DVD, true, "My Series Name - 1x2 - [DVD] [Proper]")]
|
||||
[TestCase(1, new[] { 2, 4 }, "My Episode Title", QualityTypes.HDTV, false, "My Series Name - 1x2-1x4 - My Episode Title [HDTV]")]
|
||||
[TestCase(1, new[] { 2, 4 }, "My Episode Title", QualityTypes.HDTV, true, "My Series Name - 1x2-1x4 - My Episode Title [HDTV] [Proper]")]
|
||||
[TestCase(1, new[] { 2, 4 }, "", QualityTypes.HDTV, true, "My Series Name - 1x2-1x4 - [HDTV] [Proper]")]
|
||||
public void sab_title(int seasons, int[] episodes, string title, QualityTypes quality, bool proper, string excpected)
|
||||
{
|
||||
var mocker = new AutoMoqer();
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Helpers;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
public class SceneNameHelperTest : TestBase
|
||||
{
|
||||
|
||||
[Test]
|
||||
public void GetIdByName_exists()
|
||||
{
|
||||
var id = SceneNameHelper.GetIdByName("CSI New York");
|
||||
id.Should().Be(73696);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void GetTitleById_exists()
|
||||
{
|
||||
var title = SceneNameHelper.GetTitleById(71256);
|
||||
title.Should().Be("The Daily Show");
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
|
@ -1,57 +1,56 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
using System;
|
||||
using System.Linq;
|
||||
using MbUnit.Framework;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test
|
||||
{
|
||||
[TestFixture]
|
||||
[NUnit.Framework.TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
public class TvDbProviderTest : TestBase
|
||||
{
|
||||
[Test]
|
||||
[Row("The Simpsons")]
|
||||
[Row("Family Guy")]
|
||||
[Row("South Park")]
|
||||
[Row("clone high, usa")]
|
||||
[TestCase("The Simpsons")]
|
||||
[TestCase("Family Guy")]
|
||||
[TestCase("South Park")]
|
||||
public void successful_search(string title)
|
||||
{
|
||||
var tvCont = new TvDbProvider();
|
||||
var result = tvCont.SearchSeries(title);
|
||||
var result = new TvDbProvider().SearchSeries(title);
|
||||
|
||||
Assert.IsNotEmpty(result);
|
||||
Assert.AreEqual(title, result[0].SeriesName, StringComparison.InvariantCultureIgnoreCase);
|
||||
result.Should().NotBeEmpty();
|
||||
result[0].SeriesName.Should().Be(title);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Row("The Simpsons")]
|
||||
[Row("Family Guy")]
|
||||
[Row("South Park")]
|
||||
[TestCase("The Simpsons")]
|
||||
[TestCase("Family Guy")]
|
||||
[TestCase("South Park")]
|
||||
public void successful_title_lookup(string title)
|
||||
{
|
||||
var tvCont = new TvDbProvider();
|
||||
var result = tvCont.GetSeries(title);
|
||||
|
||||
Assert.AreEqual(title, result.SeriesName, StringComparison.InvariantCultureIgnoreCase);
|
||||
result.SeriesName.Should().Be(title);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
[Row(new object[] { "CAPITAL", "capital", true })]
|
||||
[Row(new object[] { "Something!!", "Something", true })]
|
||||
[Row(new object[] { "Simpsons 2000", "Simpsons", true })]
|
||||
[Row(new object[] { "Simp222sons", "Simpsons", true })]
|
||||
[Row(new object[] { "Simpsons", "The Simpsons", true })]
|
||||
[Row(new object[] { "Law and order", "Law & order", true })]
|
||||
[Row(new object[] { "xxAndxx", "xxxx", false })]
|
||||
[Row(new object[] { "Andxx", "xx", false })]
|
||||
[Row(new object[] { "xxAnd", "xx", false })]
|
||||
[Row(new object[] { "Thexx", "xx", false })]
|
||||
[Row(new object[] { "Thexx", "xx", false })]
|
||||
[Row(new object[] { "xxThexx", "xxxxx", false })]
|
||||
[Row(new object[] { "Simpsons The", "Simpsons", true })]
|
||||
[TestCase(new object[] { "CAPITAL", "capital", true })]
|
||||
[TestCase(new object[] { "Something!!", "Something", true })]
|
||||
[TestCase(new object[] { "Simpsons 2000", "Simpsons", true })]
|
||||
[TestCase(new object[] { "Simp222sons", "Simpsons", true })]
|
||||
[TestCase(new object[] { "Simpsons", "The Simpsons", true })]
|
||||
[TestCase(new object[] { "Law and order", "Law & order", true })]
|
||||
[TestCase(new object[] { "xxAndxx", "xxxx", false })]
|
||||
[TestCase(new object[] { "Andxx", "xx", false })]
|
||||
[TestCase(new object[] { "xxAnd", "xx", false })]
|
||||
[TestCase(new object[] { "Thexx", "xx", false })]
|
||||
[TestCase(new object[] { "Thexx", "xx", false })]
|
||||
[TestCase(new object[] { "xxThexx", "xxxxx", false })]
|
||||
[TestCase(new object[] { "Simpsons The", "Simpsons", true })]
|
||||
public void Name_match_test(string a, string b, bool match)
|
||||
{
|
||||
bool result = TvDbProvider.IsTitleMatch(a, b);
|
||||
|
@ -69,7 +68,7 @@ namespace NzbDrone.Core.Test
|
|||
var result = tvdbProvider.SearchSeries(Guid.NewGuid().ToString());
|
||||
|
||||
//assert
|
||||
Assert.IsEmpty(result);
|
||||
result.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -114,19 +113,19 @@ namespace NzbDrone.Core.Test
|
|||
}
|
||||
|
||||
//assert
|
||||
Assert.Count(7, seasons);
|
||||
Assert.Count(23, seasons1);
|
||||
Assert.Count(19, seasons2);
|
||||
Assert.Count(16, seasons3);
|
||||
Assert.Count(20, seasons4);
|
||||
Assert.Count(18, seasons5);
|
||||
seasons.Should().HaveCount(7);
|
||||
seasons1.Should().HaveCount(23);
|
||||
seasons2.Should().HaveCount(19);
|
||||
seasons3.Should().HaveCount(16);
|
||||
seasons4.Should().HaveCount(20);
|
||||
seasons5.Should().HaveCount(18);
|
||||
|
||||
Assert.Distinct(seasons1.Select(s => s.EpisodeNumber));
|
||||
Assert.Distinct(seasons2.Select(s => s.EpisodeNumber));
|
||||
Assert.Distinct(seasons3.Select(s => s.EpisodeNumber));
|
||||
Assert.Distinct(seasons4.Select(s => s.EpisodeNumber));
|
||||
Assert.Distinct(seasons5.Select(s => s.EpisodeNumber));
|
||||
Assert.Distinct(seasons6.Select(s => s.EpisodeNumber));
|
||||
seasons1.Select(s => s.EpisodeNumber).Should().OnlyHaveUniqueItems();
|
||||
seasons2.Select(s => s.EpisodeNumber).Should().OnlyHaveUniqueItems();
|
||||
seasons3.Select(s => s.EpisodeNumber).Should().OnlyHaveUniqueItems();
|
||||
seasons4.Select(s => s.EpisodeNumber).Should().OnlyHaveUniqueItems();
|
||||
seasons5.Select(s => s.EpisodeNumber).Should().OnlyHaveUniqueItems();
|
||||
seasons6.Select(s => s.EpisodeNumber).Should().OnlyHaveUniqueItems();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,9 +5,7 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Threading;
|
||||
using FizzWare.NBuilder;
|
||||
using Gallio.Framework;
|
||||
using MbUnit.Framework;
|
||||
using MbUnit.Framework.ContractVerifiers;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
|
|
|
@ -7,5 +7,4 @@
|
|||
<package id="CommonServiceLocator" version="1.0" />
|
||||
<package id="Unity" version="2.1.505.0" />
|
||||
<package id="NUnit" version="2.5.10.11092" />
|
||||
<package id="FluentAssertions" version="1.4.0.0" />
|
||||
</packages>
|
|
@ -1,7 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.Model;
|
||||
|
||||
namespace NzbDrone.Core.Helpers
|
||||
{
|
||||
|
@ -9,307 +7,140 @@ namespace NzbDrone.Core.Helpers
|
|||
{
|
||||
//Todo: Move this to a publically available location (so updates can be applied without releasing a new version of NzbDrone)
|
||||
//Todo: GoogleDocs? WCF Web Services on NzbDrone.com?
|
||||
private static readonly List<SceneNameModel> SceneNameMappings = new List<SceneNameModel>
|
||||
{
|
||||
new SceneNameModel
|
||||
{SeriesId = 72546, Name = "CSI"},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 73696,
|
||||
Name = "CSI New York"
|
||||
},
|
||||
new SceneNameModel
|
||||
{SeriesId = 73696, Name = "CSI NY"},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 110381,
|
||||
Name = "Archer"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 83897,
|
||||
Name =
|
||||
"Life After People The Series"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 83897,
|
||||
Name = "Life After People"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 80552,
|
||||
Name = "Kitchen Nightmares US"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 71256,
|
||||
Name = "The Daily Show"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 71256,
|
||||
Name =
|
||||
"The Daily Show with Jon Stewart"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 75692,
|
||||
Name = "Law and Order SVU"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 75692,
|
||||
Name =
|
||||
"Law and Order Special Victims Unit"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 71489,
|
||||
Name =
|
||||
"Law and Order Criminal Intent"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 71489,
|
||||
Name = "Law and Order CI"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 79590,
|
||||
Name = "Dancing With The Stars US"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 73387,
|
||||
Name = "Craig Ferguson"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 85355,
|
||||
Name = "Jimmy Fallon"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 75088,
|
||||
Name = "David Letterman"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 76706,
|
||||
Name = "Big Brother US"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 105521,
|
||||
Name = "The Colony"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 105521,
|
||||
Name = "The Colony US"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 76235,
|
||||
Name =
|
||||
"Americas Funniest Home Videos"
|
||||
},
|
||||
new SceneNameModel
|
||||
{SeriesId = 76235, Name = "AFHV"},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 139941,
|
||||
Name = "Childrens Hospital US"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 139941,
|
||||
Name = "Childrens Hospital"
|
||||
},
|
||||
new SceneNameModel
|
||||
{SeriesId = 83123, Name = "Merlin"},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 83123,
|
||||
Name = "Merlin 2008"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 76779,
|
||||
Name = "WWE Monday Night RAW"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 164951,
|
||||
Name = "Shit My Dad Says"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 83714,
|
||||
Name = "Genius with Dave Gorman"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 168161,
|
||||
Name = "Law and Order LA"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 77526,
|
||||
Name = "Star Trek TOS"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 72073,
|
||||
Name = "Star Trek DS9"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 72194,
|
||||
Name = "Ellen Degeneres"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 72194,
|
||||
Name = "Ellen Degeneres"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 195831,
|
||||
Name = "Drinking Made Easy"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 195831,
|
||||
Name =
|
||||
"Zane Lampreys Drinking Made Easy"
|
||||
},
|
||||
new SceneNameModel
|
||||
{SeriesId = 76133, Name = "Poirot"},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 76133,
|
||||
Name = "Agatha Christies Poirot"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 70870,
|
||||
Name =
|
||||
"The Real World Road Rules Challenge"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 70870,
|
||||
Name = "The Challenge Cutthroat"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 77444,
|
||||
Name = "This Old House Program"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 73290,
|
||||
Name = "60 Minutes US"
|
||||
},
|
||||
new SceneNameModel
|
||||
{SeriesId = 194751, Name = "Conan"},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 194751,
|
||||
Name = "Conan 2010"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 164451,
|
||||
Name = "Carlos 2010"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 70726,
|
||||
Name = "Babalon 5"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 70726,
|
||||
Name = "Babalon5"
|
||||
},
|
||||
new SceneNameModel
|
||||
{SeriesId = 83714, Name = "Genius"},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 83714,
|
||||
Name = "Genius With Dave Gormand"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 212571,
|
||||
Name = "Come Fly With Me 2010"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 81563,
|
||||
Name = "Border Security"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 81563,
|
||||
Name =
|
||||
"Border Security Australias Frontline"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 172381,
|
||||
Name = "Silent Library US"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 131791,
|
||||
Name = "Sci-Fi Science"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 80646,
|
||||
Name = "Frontline"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 80646,
|
||||
Name = "Frontline US"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 189931,
|
||||
Name = "RBT AU"
|
||||
},
|
||||
new SceneNameModel
|
||||
{SeriesId = 73255, Name = "House"},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 73255,
|
||||
Name = "House MD"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 73244,
|
||||
Name = "The Office"
|
||||
},
|
||||
new SceneNameModel
|
||||
{
|
||||
SeriesId = 73244,
|
||||
Name = "The Office US"
|
||||
},
|
||||
};
|
||||
private static readonly Dictionary<String, Int32> SeriesIdLookupList = new Dictionary<string, int>();
|
||||
private static readonly Dictionary<Int32, String> SceneNameLookupList = new Dictionary<Int32, String>();
|
||||
|
||||
public static int FindByName(string cleanSeriesName)
|
||||
|
||||
static SceneNameHelper()
|
||||
{
|
||||
var map = SceneNameMappings.Find(s => Parser.NormalizeTitle(s.Name) == cleanSeriesName);
|
||||
//These values are used to match report titles parsed out of RSS to a series in the DB
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("CSI"), 72546);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("CSI New York"), 73696);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("CSI NY"), 73696);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Archer"), 110381);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Life After People The Series"), 83897);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Life After People"), 83897);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Kitchen Nightmares US"), 80552);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("The Daily Show"), 71256);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("The Daily Show with Jon Stewart"), 71256);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Law and Order SVU"), 75692);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Law and Order Special Victims Unit"), 75692);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Law and Order Criminal Intent"), 71489);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Law and Order CI"), 71489);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Dancing With The Stars US"), 79590);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Craig Ferguson"), 73387);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Jimmy Fallon"), 85355);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("David Letterman"), 75088);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Big Brother US"), 76706);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("The Colony"), 105521);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("The Colony US"), 105521);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Americas Funniest Home Videos"), 76235);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("AFHV"), 76235);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Childrens Hospital US"), 139941);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Childrens Hospital"), 139941);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Merlin"), 83123);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Merlin 2008"), 83123);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("WWE Monday Night RAW"), 76779);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Shit My Dad Says"), 164951);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Genius with Dave Gorman"), 83714);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Law and Order LA"), 168161);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Star Trek TOS"), 77526);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Star Trek DS9"), 72073);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Ellen Degeneres"), 72194);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Drinking Made Easy"), 195831);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Zane Lampreys Drinking Made Easy"), 195831);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Poirot"), 76133);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Agatha Christies Poirot"), 76133);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("The Real World Road Rules Challenge"), 70870);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("The Challenge Cutthroat"), 70870);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("This Old House Program"), 77444);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("60 Minutes US"), 73290);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Conan"), 194751);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Conan 2010"), 194751);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Carlos 2010"), 164451);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Babalon 5"), 70726);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Babalon5"), 70726);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Genius"), 83714);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Genius With Dave Gormand"), 83714);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Come Fly With Me 2010"), 212571);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Border Security"), 81563);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Border Security Australias Frontline"), 81563);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Silent Library US"), 172381);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Sci-Fi Science"), 131791);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Frontline"), 80646);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("Frontline US"), 80646);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("RBT AU"), 189931);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("House"), 73255);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("House MD"), 73255);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("The Office"), 73244);
|
||||
SeriesIdLookupList.Add(Parser.NormalizeTitle("The Office US"), 73244);
|
||||
|
||||
if (map == null)
|
||||
return 0;
|
||||
//These values are used when doing an indexer search.
|
||||
SceneNameLookupList.Add(72546, "CSI"); //CSI
|
||||
SceneNameLookupList.Add(73696, "CSI"); //CSI NY
|
||||
SceneNameLookupList.Add(110381, "Archer");
|
||||
SceneNameLookupList.Add(83897, "Life After People");
|
||||
SceneNameLookupList.Add(80552, "Kitchen Nightmares US");
|
||||
SceneNameLookupList.Add(71256, "The Daily Show"); //The Daily Show with Jon Stewart
|
||||
SceneNameLookupList.Add(75692, "Law and Order"); //SVU
|
||||
SceneNameLookupList.Add(71489, "Law and Order");//CI
|
||||
SceneNameLookupList.Add(79590, "Dancing With The Stars US");
|
||||
SceneNameLookupList.Add(73387, "Craig Ferguson");
|
||||
SceneNameLookupList.Add(85355, "Jimmy Fallon");
|
||||
SceneNameLookupList.Add(75088, "David Letterman");
|
||||
SceneNameLookupList.Add(76706, "Big Brother US");
|
||||
SceneNameLookupList.Add(105521, "The Colony");
|
||||
SceneNameLookupList.Add(76235, "Americas Funniest Home Videos");
|
||||
SceneNameLookupList.Add(139941, "Childrens Hospital");
|
||||
SceneNameLookupList.Add(83123, "Merlin");
|
||||
SceneNameLookupList.Add(76779, "WWE Monday Night RAW");
|
||||
SceneNameLookupList.Add(164951, "Shit My Dad Says");
|
||||
SceneNameLookupList.Add(168161, "Law and Order LA");
|
||||
SceneNameLookupList.Add(77526, "Star Trek TOS");
|
||||
SceneNameLookupList.Add(72073, "Star Trek DS9");
|
||||
SceneNameLookupList.Add(72194, "Ellen Degeneres");
|
||||
SceneNameLookupList.Add(195831, "Drinking Made Easy");//Zane Lampreys Drinking Made Easy
|
||||
SceneNameLookupList.Add(76133, "Poirot"); //Agatha Christies Poirot
|
||||
SceneNameLookupList.Add(70870, "The Real World Road Rules Challenge");
|
||||
SceneNameLookupList.Add(77444, "This Old House Program");
|
||||
SceneNameLookupList.Add(73290, "60 Minutes US");
|
||||
SceneNameLookupList.Add(194751, "Conan");
|
||||
SceneNameLookupList.Add(164451, "Carlos 2010");
|
||||
SceneNameLookupList.Add(70726, "Babalon"); //5
|
||||
SceneNameLookupList.Add(83714, "Genius"); //Genius With Dave Gormand
|
||||
SceneNameLookupList.Add(212571, "Come Fly With Me 2010");
|
||||
SceneNameLookupList.Add(81563, "Border Security");
|
||||
SceneNameLookupList.Add(172381, "Silent Library US");
|
||||
SceneNameLookupList.Add(131791, "Sci-Fi Science");
|
||||
SceneNameLookupList.Add(80646, "Frontline");
|
||||
SceneNameLookupList.Add(189931, "RBT AU");
|
||||
SceneNameLookupList.Add(73255, "House");
|
||||
SceneNameLookupList.Add(73244, "The Office");
|
||||
}
|
||||
|
||||
return map.SeriesId;
|
||||
|
||||
public static Nullable<Int32> GetIdByName(string cleanSeriesName)
|
||||
{
|
||||
int id;
|
||||
|
||||
if (SeriesIdLookupList.TryGetValue(Parser.NormalizeTitle(cleanSeriesName), out id))
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String GetTitleById(int seriesId)
|
||||
{
|
||||
string title;
|
||||
|
||||
if (SceneNameLookupList.TryGetValue(seriesId, out title))
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,7 +10,8 @@ namespace NzbDrone.Core.Providers.Indexer
|
|||
{
|
||||
public class Newzbin : IndexerBase
|
||||
{
|
||||
public Newzbin(HttpProvider httpProvider, ConfigProvider configProvider) : base(httpProvider, configProvider)
|
||||
public Newzbin(HttpProvider httpProvider, ConfigProvider configProvider)
|
||||
: base(httpProvider, configProvider)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -35,7 +36,8 @@ namespace NzbDrone.Core.Providers.Indexer
|
|||
|
||||
protected override IList<string> GetSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
|
||||
{
|
||||
return new List<string>();
|
||||
|
||||
return new List<string> { String.Format(@"http://www.newzbin.com/search/query/?q={0}+{1}x{2:00}&fpn=p&searchaction=Go&category=8&feed=rss&hauth=1", GetQueryTitle(seriesTitle), seasonNumber, episodeNumber) };
|
||||
}
|
||||
|
||||
public override string Name
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Helpers;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers.Indexer;
|
||||
|
@ -43,15 +44,25 @@ namespace NzbDrone.Core.Providers.Jobs
|
|||
throw new ArgumentOutOfRangeException("targetId");
|
||||
|
||||
var episode = _episodeProvider.GetEpisode(targetId);
|
||||
|
||||
if (episode == null)
|
||||
{
|
||||
Logger.Error("Unable to find an episode {0} in database", targetId);
|
||||
return;
|
||||
}
|
||||
|
||||
var series = episode.Series;
|
||||
|
||||
var indexers = _indexerProvider.GetEnabledIndexers();
|
||||
var reports = new List<EpisodeParseResult>();
|
||||
|
||||
var title = SceneNameHelper.GetTitleById(series.SeriesId);
|
||||
|
||||
if(string.IsNullOrWhiteSpace(title))
|
||||
{
|
||||
title = series.Title;
|
||||
}
|
||||
|
||||
foreach (var indexer in indexers)
|
||||
{
|
||||
try
|
||||
|
@ -66,7 +77,7 @@ namespace NzbDrone.Core.Providers.Jobs
|
|||
}
|
||||
else
|
||||
{
|
||||
indexerResults = indexer.FetchEpisode(episode.Series.Title, episode.SeasonNumber, episode.EpisodeNumber);
|
||||
indexerResults = indexer.FetchEpisode(title, episode.SeasonNumber, episode.EpisodeNumber);
|
||||
}
|
||||
|
||||
reports.AddRange(indexerResults);
|
||||
|
@ -82,7 +93,7 @@ namespace NzbDrone.Core.Providers.Jobs
|
|||
|
||||
reports.ForEach(c =>
|
||||
{
|
||||
c.Series = episode.Series;
|
||||
c.Series = series;
|
||||
c.Episodes = new List<Episode> { episode };
|
||||
});
|
||||
|
||||
|
|
|
@ -105,10 +105,10 @@ namespace NzbDrone.Core.Providers
|
|||
{
|
||||
var normalizeTitle = Parser.NormalizeTitle(title);
|
||||
|
||||
var seriesId = SceneNameHelper.FindByName(normalizeTitle);
|
||||
if (seriesId != 0)
|
||||
var seriesId = SceneNameHelper.GetIdByName(normalizeTitle);
|
||||
if (seriesId != null)
|
||||
{
|
||||
return GetSeries(seriesId);
|
||||
return GetSeries(seriesId.Value);
|
||||
}
|
||||
|
||||
return _repository.Single<Series>(s => s.CleanTitle == normalizeTitle);
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue