|
|
@ -3,14 +3,12 @@ using System.Linq;
|
|
|
|
|
|
|
|
|
|
|
|
using FizzWare.NBuilder;
|
|
|
|
using FizzWare.NBuilder;
|
|
|
|
using FluentAssertions;
|
|
|
|
using FluentAssertions;
|
|
|
|
using Moq;
|
|
|
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
using NUnit.Framework;
|
|
|
|
using NzbDrone.Core.Providers;
|
|
|
|
using NzbDrone.Core.Providers;
|
|
|
|
using NzbDrone.Core.Providers.Core;
|
|
|
|
using NzbDrone.Core.Providers.Core;
|
|
|
|
using NzbDrone.Core.Repository;
|
|
|
|
using NzbDrone.Core.Repository;
|
|
|
|
using NzbDrone.Core.Repository.Quality;
|
|
|
|
using NzbDrone.Core.Repository.Quality;
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
using NzbDrone.Test.Common.AutoMoq;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ReSharper disable InconsistentNaming
|
|
|
|
// ReSharper disable InconsistentNaming
|
|
|
|
namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
namespace NzbDrone.Core.Test.ProviderTests
|
|
|
@ -134,14 +132,16 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
{
|
|
|
|
{
|
|
|
|
WithRealDb();
|
|
|
|
WithRealDb();
|
|
|
|
|
|
|
|
|
|
|
|
Db.Insert(TestDbHelper.GetFakeSeries(1, "MyTitle"));
|
|
|
|
var fakeSEries = Builder<Series>.CreateNew()
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Db.Insert(fakeSEries);
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
|
var seriesProvider = Mocker.Resolve<SeriesProvider>();
|
|
|
|
var seriesProvider = Mocker.Resolve<SeriesProvider>();
|
|
|
|
var series = seriesProvider.FindSeries("WrongTitle");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
//Assert
|
|
|
|
Assert.IsNull(series);
|
|
|
|
seriesProvider.FindSeries("WrongTitle").Should().BeNull();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[TestCase("The Test", "Test")]
|
|
|
|
[TestCase("The Test", "Test")]
|
|
|
@ -150,19 +150,25 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
{
|
|
|
|
{
|
|
|
|
WithRealDb();
|
|
|
|
WithRealDb();
|
|
|
|
|
|
|
|
|
|
|
|
Db.Insert(TestDbHelper.GetFakeSeries(1, title));
|
|
|
|
var fakeSeries = Builder<Series>.CreateNew()
|
|
|
|
Db.Insert(Builder<QualityProfile>.CreateNew().Build());
|
|
|
|
.With(c => c.Title = title)
|
|
|
|
Mocker.Resolve<QualityProvider>();
|
|
|
|
.With(c => c.CleanTitle = Parser.NormalizeTitle(title))
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeQuality = Builder<QualityProfile>.CreateNew()
|
|
|
|
|
|
|
|
.With(c => c.QualityProfileId = fakeSeries.QualityProfileId)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Db.Insert(fakeSeries);
|
|
|
|
|
|
|
|
Db.Insert(fakeQuality);
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
|
var seriesProvider = Mocker.Resolve<SeriesProvider>();
|
|
|
|
var series = Mocker.Resolve<SeriesProvider>().FindSeries(searchTitle);
|
|
|
|
var series = seriesProvider.FindSeries(searchTitle);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
//Assert
|
|
|
|
Assert.IsNotNull(series);
|
|
|
|
series.Should().NotBeNull();
|
|
|
|
Assert.AreEqual(title, series.Title);
|
|
|
|
series.SeriesId.Should().Be(series.SeriesId);
|
|
|
|
series.QualityProfile.Should().NotBeNull();
|
|
|
|
series.Title.Should().BeEquivalentTo(series.Title);
|
|
|
|
series.QualityProfile.ShouldHave().Properties(q => q.Name, q => q.SonicAllowed, q => q.Cutoff, q => q.AllowedString);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
@ -651,7 +657,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|
|
|
[Test]
|
|
|
|
[Test]
|
|
|
|
public void SearchForSeries_should_not_return_results_that_do_not_contain_the_query()
|
|
|
|
public void SearchForSeries_should_not_return_results_that_do_not_contain_the_query()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
WithRealDb();
|
|
|
|
WithRealDb();
|
|
|
|
|
|
|
|
|
|
|
|
var fakeQuality = Builder<QualityProfile>.CreateNew().Build();
|
|
|
|
var fakeQuality = Builder<QualityProfile>.CreateNew().Build();
|
|
|
|
var fakeSeries = Builder<Series>.CreateListOfSize(10)
|
|
|
|
var fakeSeries = Builder<Series>.CreateListOfSize(10)
|
|
|
|