|
|
@ -12,6 +12,7 @@ using Ninject;
|
|
|
|
using Ninject.Moq;
|
|
|
|
using Ninject.Moq;
|
|
|
|
using NzbDrone.Core.Providers;
|
|
|
|
using NzbDrone.Core.Providers;
|
|
|
|
using NzbDrone.Core.Repository;
|
|
|
|
using NzbDrone.Core.Repository;
|
|
|
|
|
|
|
|
using NzbDrone.Core.Repository.Quality;
|
|
|
|
using SubSonic.Repository;
|
|
|
|
using SubSonic.Repository;
|
|
|
|
using TvdbLib.Data;
|
|
|
|
using TvdbLib.Data;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
@ -96,26 +97,69 @@ namespace NzbDrone.Core.Test
|
|
|
|
//Assert.AreEqual(title, result, postTitle);
|
|
|
|
//Assert.AreEqual(title, result, postTitle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//[Test]
|
|
|
|
[Test]
|
|
|
|
//public void get_unmapped()
|
|
|
|
public void Test_is_monitored()
|
|
|
|
//{
|
|
|
|
{
|
|
|
|
// //Setup
|
|
|
|
var kernel = new MockingKernel();
|
|
|
|
// var kernel = new MockingKernel();
|
|
|
|
var repo = MockLib.GetEmptyRepository();
|
|
|
|
|
|
|
|
kernel.Bind<IRepository>().ToConstant(repo);
|
|
|
|
|
|
|
|
kernel.Bind<ISeriesProvider>().To<SeriesProvider>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
repo.Add(Builder<Series>.CreateNew()
|
|
|
|
|
|
|
|
.With(c => c.Monitored = true)
|
|
|
|
|
|
|
|
.With(c => c.SeriesId = 12)
|
|
|
|
|
|
|
|
.Build());
|
|
|
|
|
|
|
|
|
|
|
|
// kernel.Bind<ISeriesProvider>().To<SeriesProvider>();
|
|
|
|
repo.Add(Builder<Series>.CreateNew()
|
|
|
|
// kernel.Bind<IDiskProvider>().ToConstant(MockLib.GetStandardDisk(0, 0));
|
|
|
|
.With(c => c.Monitored = false)
|
|
|
|
// kernel.Bind<IConfigProvider>().ToConstant(MockLib.StandardConfig);
|
|
|
|
.With(c => c.SeriesId = 11)
|
|
|
|
|
|
|
|
.Build());
|
|
|
|
|
|
|
|
|
|
|
|
// var seriesController = kernel.Get<ISeriesProvider>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// //Act
|
|
|
|
//Act, Assert
|
|
|
|
// var unmappedFolder = seriesController.GetUnmappedFolders();
|
|
|
|
var provider = kernel.Get<ISeriesProvider>();
|
|
|
|
|
|
|
|
Assert.IsTrue(provider.IsMonitored(12));
|
|
|
|
|
|
|
|
Assert.IsFalse(provider.IsMonitored(11));
|
|
|
|
|
|
|
|
Assert.IsFalse(provider.IsMonitored(1));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// //Assert
|
|
|
|
|
|
|
|
// Assert.AreElementsEqualIgnoringOrder(MockLib.StandardSeries, unmappedFolder.Values);
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
[Row(12, QualityTypes.TV, true)]
|
|
|
|
|
|
|
|
[Row(12, QualityTypes.Unknown, false)]
|
|
|
|
|
|
|
|
[Row(12, QualityTypes.Bluray1080, false)]
|
|
|
|
|
|
|
|
[Row(12, QualityTypes.Bluray720, false)]
|
|
|
|
|
|
|
|
[Row(12, QualityTypes.HDTV, false)]
|
|
|
|
|
|
|
|
[Row(12, QualityTypes.WEBDL, false)]
|
|
|
|
|
|
|
|
public void QualityWanted(int seriesId, QualityTypes qualityTypes, Boolean result)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var kernel = new MockingKernel();
|
|
|
|
|
|
|
|
var repo = MockLib.GetEmptyRepository();
|
|
|
|
|
|
|
|
kernel.Bind<IRepository>().ToConstant(repo);
|
|
|
|
|
|
|
|
kernel.Bind<ISeriesProvider>().To<SeriesProvider>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var quality = Builder<QualityProfile>.CreateNew()
|
|
|
|
|
|
|
|
.With(q => q.Allowed = new List<QualityTypes>() { QualityTypes.BDRip, QualityTypes.DVD, QualityTypes.TV })
|
|
|
|
|
|
|
|
.With(q => q.Cutoff = QualityTypes.DVD)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var qualityProviderMock = new Mock<IQualityProvider>();
|
|
|
|
|
|
|
|
qualityProviderMock.Setup(c => c.Find(quality.QualityProfileId)).Returns(quality).Verifiable();
|
|
|
|
|
|
|
|
kernel.Bind<IQualityProvider>().ToConstant(qualityProviderMock.Object);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
repo.Add(Builder<Series>.CreateNew()
|
|
|
|
|
|
|
|
.With(c => c.SeriesId = 12)
|
|
|
|
|
|
|
|
.With(c => c.QualityProfileId = quality.QualityProfileId)
|
|
|
|
|
|
|
|
.Build());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
|
|
|
var needed = kernel.Get<ISeriesProvider>().QualityWanted(seriesId, qualityTypes);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Assert.AreEqual(result, needed);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|