removed IEpisodeProvider, ILogProvider

fixed some broken tests.
pull/3113/head
kay.one 14 years ago
parent 8fbc79c50d
commit 7efbfdbb89

@ -36,14 +36,23 @@ namespace AutoMoq
return result; return result;
} }
public virtual Mock<T> GetMock<T>() where T : class public virtual Mock<T> GetMock<T>(MockBehavior behavior = MockBehavior.Default) where T : class
{ {
ResolveType = null; ResolveType = null;
var type = GetTheMockType<T>(); var type = GetTheMockType<T>();
if (GetMockHasNotBeenCalledForThisType(type)) if (GetMockHasNotBeenCalledForThisType(type))
CreateANewMockAndRegisterIt<T>(type); {
CreateANewMockAndRegisterIt<T>(type, behavior);
}
var mock = TheRegisteredMockForThisType<T>(type);
if (behavior != MockBehavior.Default && mock.Behavior == MockBehavior.Default)
{
throw new InvalidOperationException("Unable to change be behaviour of a an existing mock.");
}
return TheRegisteredMockForThisType<T>(type); return mock;
} }
internal virtual void SetMock(Type type, Mock mock) internal virtual void SetMock(Type type, Mock mock)
@ -80,9 +89,9 @@ namespace AutoMoq
return (Mock<T>)registeredMocks.Where(x => x.Key == type).First().Value; return (Mock<T>)registeredMocks.Where(x => x.Key == type).First().Value;
} }
private void CreateANewMockAndRegisterIt<T>(Type type) where T : class private void CreateANewMockAndRegisterIt<T>(Type type, MockBehavior behavior) where T : class
{ {
var mock = new Mock<T>(); var mock = new Mock<T>(behavior);
container.RegisterInstance(mock.Object); container.RegisterInstance(mock.Object);
SetMock(type, mock); SetMock(type, mock);
} }
@ -129,5 +138,14 @@ namespace AutoMoq
GetMock<T>().Verify(expression, times, failMessage); GetMock<T>().Verify(expression, times, failMessage);
} }
public void VerifyAllMocks()
{
foreach (var registeredMock in registeredMocks)
{
var mock = registeredMock.Value as Mock;
mock.VerifyAll();
}
}
} }
} }

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Text; using System.Text;
using AutoMoq;
using FizzWare.NBuilder; using FizzWare.NBuilder;
using Gallio.Framework; using Gallio.Framework;
using MbUnit.Framework; using MbUnit.Framework;
@ -41,32 +42,29 @@ namespace NzbDrone.Core.Test
var fakeEpisode = Builder<Episode>.CreateNew().With(c => c.SeriesId = fakeSeries.SeriesId).Build(); var fakeEpisode = Builder<Episode>.CreateNew().With(c => c.SeriesId = fakeSeries.SeriesId).Build();
//Mocks //Mocks
var repository = new Mock<IRepository>(); var mocker = new AutoMoqer();
repository.Setup(r => r.Exists<EpisodeFile>(It.IsAny<Expression<Func<EpisodeFile, Boolean>>>())).Returns(false).Verifiable();
repository.Setup(r => r.Add(It.IsAny<EpisodeFile>())).Returns(0).Verifiable();
var episodeProvider = new Mock<IEpisodeProvider>(); mocker.GetMock<IRepository>()
episodeProvider.Setup(e => e.GetEpisode(fakeSeries.SeriesId, seasonNumber, episodeNumner)).Returns(fakeEpisode).Verifiable(); .Setup(r => r.Exists<EpisodeFile>(It.IsAny<Expression<Func<EpisodeFile, Boolean>>>())).Returns(false).Verifiable();
mocker.GetMock<IRepository>()
.Setup(r => r.Add(It.IsAny<EpisodeFile>())).Returns(0).Verifiable();
var diskProvider = new Mock<DiskProvider>(); mocker.GetMock<EpisodeProvider>()
diskProvider.Setup(e => e.GetSize(fileName)).Returns(12345).Verifiable(); .Setup(e => e.GetEpisode(fakeSeries.SeriesId, seasonNumber, episodeNumner)).Returns(fakeEpisode).Verifiable();
var kernel = new MockingKernel(); mocker.GetMock<DiskProvider>()
kernel.Bind<IRepository>().ToConstant(repository.Object); .Setup(e => e.GetSize(fileName)).Returns(12345).Verifiable();
kernel.Bind<IEpisodeProvider>().ToConstant(episodeProvider.Object);
kernel.Bind<DiskProvider>().ToConstant(diskProvider.Object);
kernel.Bind<IMediaFileProvider>().To<MediaFileProvider>();
//Act //Act
var result = kernel.Get<IMediaFileProvider>().ImportFile(fakeSeries, fileName); var result = mocker.Resolve<MediaFileProvider>().ImportFile(fakeSeries, fileName);
//Assert //Assert
repository.VerifyAll();
episodeProvider.VerifyAll();
diskProvider.VerifyAll();
Assert.IsNotNull(result); Assert.IsNotNull(result);
repository.Verify(r => r.Add<EpisodeFile>(result), Times.Once()); mocker.GetMock<IRepository>().VerifyAll();
mocker.GetMock<IRepository>().Verify(r => r.Add<EpisodeFile>(result), Times.Once());
mocker.GetMock<EpisodeProvider>().VerifyAll();
mocker.GetMock<DiskProvider>().VerifyAll();
//Currently can't verify this since the list of episodes are loaded //Currently can't verify this since the list of episodes are loaded
//Dynamically by SubSonic //Dynamically by SubSonic
@ -93,31 +91,25 @@ namespace NzbDrone.Core.Test
//Fakes //Fakes
var fakeSeries = Builder<Series>.CreateNew().Build(); var fakeSeries = Builder<Series>.CreateNew().Build();
var fakeEpisode = Builder<Episode>.CreateNew().With(c => c.SeriesId = fakeSeries.SeriesId).Build();
//Mocks //Mocks
var repository = new Mock<IRepository>(MockBehavior.Strict);
repository.Setup(r => r.Exists<EpisodeFile>(It.IsAny<Expression<Func<EpisodeFile, Boolean>>>())).Returns(true).Verifiable();
var episodeProvider = new Mock<IEpisodeProvider>(MockBehavior.Strict);
var diskProvider = new Mock<DiskProvider>(MockBehavior.Strict);
var kernel = new MockingKernel(); var mocker = new AutoMoqer();
kernel.Bind<IRepository>().ToConstant(repository.Object); mocker.GetMock<IRepository>(MockBehavior.Strict)
.Setup(r => r.Exists<EpisodeFile>(It.IsAny<Expression<Func<EpisodeFile, Boolean>>>())).Returns(true).Verifiable();
mocker.GetMock<EpisodeProvider>(MockBehavior.Strict);
mocker.GetMock<DiskProvider>(MockBehavior.Strict);
kernel.Bind<IEpisodeProvider>().ToConstant(episodeProvider.Object);
kernel.Bind<DiskProvider>().ToConstant(diskProvider.Object);
kernel.Bind<IMediaFileProvider>().To<MediaFileProvider>();
//Act //Act
var result = kernel.Get<IMediaFileProvider>().ImportFile(fakeSeries, fileName); var result = mocker.Resolve<MediaFileProvider>().ImportFile(fakeSeries, fileName);
//Assert //Assert
repository.VerifyAll(); mocker.GetMock<IRepository>().VerifyAll();
episodeProvider.VerifyAll(); mocker.GetMock<EpisodeProvider>().VerifyAll();
diskProvider.VerifyAll(); mocker.GetMock<DiskProvider>(MockBehavior.Strict).VerifyAll();
Assert.IsNull(result); Assert.IsNull(result);
repository.Verify(r => r.Add<EpisodeFile>(result), Times.Never()); mocker.GetMock<IRepository>().Verify(r => r.Add<EpisodeFile>(result), Times.Never());
} }
[Test] [Test]
@ -136,30 +128,23 @@ namespace NzbDrone.Core.Test
var fakeSeries = Builder<Series>.CreateNew().Build(); var fakeSeries = Builder<Series>.CreateNew().Build();
//Mocks //Mocks
var repository = new Mock<IRepository>(MockBehavior.Strict); var mocker = new AutoMoqer();
repository.Setup(r => r.Exists<EpisodeFile>(It.IsAny<Expression<Func<EpisodeFile, Boolean>>>())).Returns(false).Verifiable(); mocker.GetMock<IRepository>(MockBehavior.Strict)
.Setup(r => r.Exists<EpisodeFile>(It.IsAny<Expression<Func<EpisodeFile, Boolean>>>())).Returns(false).Verifiable();
var episodeProvider = new Mock<IEpisodeProvider>(MockBehavior.Strict);
episodeProvider.Setup(e => e.GetEpisode(fakeSeries.SeriesId, seasonNumber, episodeNumner)).Returns<Episode>(null).Verifiable();
var diskProvider = new Mock<DiskProvider>(MockBehavior.Strict); mocker.GetMock<EpisodeProvider>(MockBehavior.Strict)
.Setup(e => e.GetEpisode(fakeSeries.SeriesId, seasonNumber, episodeNumner)).Returns<Episode>(null).Verifiable();
mocker.GetMock<DiskProvider>(MockBehavior.Strict);
var kernel = new MockingKernel();
kernel.Bind<IRepository>().ToConstant(repository.Object);
kernel.Bind<IEpisodeProvider>().ToConstant(episodeProvider.Object);
kernel.Bind<DiskProvider>().ToConstant(diskProvider.Object);
kernel.Bind<IMediaFileProvider>().To<MediaFileProvider>();
//Act //Act
var result = kernel.Get<IMediaFileProvider>().ImportFile(fakeSeries, fileName); var result = mocker.Resolve<MediaFileProvider>().ImportFile(fakeSeries, fileName);
//Assert //Assert
repository.VerifyAll(); mocker.VerifyAllMocks();
episodeProvider.VerifyAll();
diskProvider.VerifyAll();
Assert.IsNull(result); Assert.IsNull(result);
repository.Verify(r => r.Add<EpisodeFile>(result), Times.Never()); mocker.GetMock<IRepository>().Verify(r => r.Add<EpisodeFile>(result), Times.Never());
} }

@ -43,7 +43,7 @@ namespace NzbDrone.Core.Test
public class MockFeedProvider : FeedProviderBase public class MockFeedProvider : FeedProviderBase
{ {
public MockFeedProvider(SeriesProvider seriesProvider, ISeasonProvider seasonProvider, IEpisodeProvider episodeProvider, IConfigProvider configProvider, HttpProvider httpProvider) public MockFeedProvider(SeriesProvider seriesProvider, ISeasonProvider seasonProvider, EpisodeProvider episodeProvider, IConfigProvider configProvider, HttpProvider httpProvider)
: base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider) : base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider)
{ {
} }

@ -24,13 +24,13 @@ namespace NzbDrone.Core
public static class CentralDispatch public static class CentralDispatch
{ {
private static StandardKernel _kernel; private static StandardKernel _kernel;
private static readonly Object kernelLock = new object(); private static readonly Object KernelLock = new object();
private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private static string _startupPath; private static string _startupPath;
public static void BindKernel() public static void BindKernel()
{ {
lock (kernelLock) lock (KernelLock)
{ {
Logger.Debug("Binding Ninject's Kernel"); Logger.Debug("Binding Ninject's Kernel");
_kernel = new StandardKernel(); _kernel = new StandardKernel();
@ -57,27 +57,27 @@ namespace NzbDrone.Core
dbProvider.Log = new NlogWriter(); dbProvider.Log = new NlogWriter();
_kernel.Bind<QualityProvider>().ToSelf(); _kernel.Bind<QualityProvider>().ToSelf().InSingletonScope();
_kernel.Bind<TvDbProvider>().ToSelf(); _kernel.Bind<TvDbProvider>().ToSelf().InSingletonScope();
_kernel.Bind<HttpProvider>().ToSelf(); _kernel.Bind<HttpProvider>().ToSelf().InSingletonScope();
_kernel.Bind<SeriesProvider>().ToSelf().InSingletonScope(); _kernel.Bind<SeriesProvider>().ToSelf().InSingletonScope();
_kernel.Bind<ISeasonProvider>().To<SeasonProvider>().InSingletonScope();
_kernel.Bind<RssSyncProvider>().ToSelf().InSingletonScope(); _kernel.Bind<RssSyncProvider>().ToSelf().InSingletonScope();
_kernel.Bind<ISeasonProvider>().To<SeasonProvider>(); _kernel.Bind<EpisodeProvider>().ToSelf().InSingletonScope();
_kernel.Bind<IEpisodeProvider>().To<EpisodeProvider>(); _kernel.Bind<UpcomingEpisodesProvider>().ToSelf().InSingletonScope();
_kernel.Bind<UpcomingEpisodesProvider>().ToSelf(); _kernel.Bind<DiskProvider>().ToSelf().InSingletonScope();
_kernel.Bind<DiskProvider>().ToSelf(); _kernel.Bind<SabProvider>().ToSelf().InSingletonScope();
_kernel.Bind<SabProvider>().ToSelf(); _kernel.Bind<HistoryProvider>().ToSelf().InSingletonScope();
_kernel.Bind<HistoryProvider>().ToSelf(); _kernel.Bind<RootDirProvider>().ToSelf().InSingletonScope();
_kernel.Bind<RootDirProvider>().ToSelf(); _kernel.Bind<ExternalNotificationProvider>().ToSelf().InSingletonScope();
_kernel.Bind<ExternalNotificationProvider>().ToSelf(); _kernel.Bind<XbmcProvider>().ToSelf().InSingletonScope();
_kernel.Bind<XbmcProvider>().ToSelf(); _kernel.Bind<PostProcessingProvider>().ToSelf().InSingletonScope();
_kernel.Bind<PostProcessingProvider>().ToSelf();
_kernel.Bind<IConfigProvider>().To<ConfigProvider>().InSingletonScope(); _kernel.Bind<IConfigProvider>().To<ConfigProvider>().InSingletonScope();
_kernel.Bind<ISyncProvider>().To<SyncProvider>().InSingletonScope(); _kernel.Bind<ISyncProvider>().To<SyncProvider>().InSingletonScope();
_kernel.Bind<IndexerProvider>().ToSelf().InSingletonScope(); _kernel.Bind<IndexerProvider>().ToSelf().InSingletonScope();
_kernel.Bind<RenameProvider>().ToSelf().InSingletonScope(); _kernel.Bind<RenameProvider>().ToSelf().InSingletonScope();
_kernel.Bind<NotificationProvider>().ToSelf().InSingletonScope(); _kernel.Bind<NotificationProvider>().ToSelf().InSingletonScope();
_kernel.Bind<ILogProvider>().To<LogProvider>().InSingletonScope(); _kernel.Bind<LogProvider>().ToSelf().InSingletonScope();
_kernel.Bind<IMediaFileProvider>().To<MediaFileProvider>().InSingletonScope(); _kernel.Bind<IMediaFileProvider>().To<MediaFileProvider>().InSingletonScope();
_kernel.Bind<TimerProvider>().ToSelf().InSingletonScope(); _kernel.Bind<TimerProvider>().ToSelf().InSingletonScope();
_kernel.Bind<IRepository>().ToMethod(c => new SimpleRepository(dbProvider, SimpleRepositoryOptions.RunMigrations)).InSingletonScope(); _kernel.Bind<IRepository>().ToMethod(c => new SimpleRepository(dbProvider, SimpleRepositoryOptions.RunMigrations)).InSingletonScope();

@ -1,11 +0,0 @@
using System.Collections.Generic;
using System.Linq;
namespace NzbDrone.Core.Instrumentation
{
public interface ILogProvider
{
IQueryable<Log> GetAllLogs();
void DeleteAll();
}
}

@ -8,7 +8,7 @@ using SubSonic.Repository;
namespace NzbDrone.Core.Instrumentation namespace NzbDrone.Core.Instrumentation
{ {
public class LogProvider : ILogProvider public class LogProvider
{ {
private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private readonly IRepository _repository; private readonly IRepository _repository;

@ -163,7 +163,6 @@
<Compile Include="Helpers\EpisodeSortingHelper.cs" /> <Compile Include="Helpers\EpisodeSortingHelper.cs" />
<Compile Include="Helpers\SceneNameHelper.cs" /> <Compile Include="Helpers\SceneNameHelper.cs" />
<Compile Include="Helpers\ServerHelper.cs" /> <Compile Include="Helpers\ServerHelper.cs" />
<Compile Include="Instrumentation\ILogProvider.cs" />
<Compile Include="Instrumentation\LogLevel.cs" /> <Compile Include="Instrumentation\LogLevel.cs" />
<Compile Include="Instrumentation\LogProvider.cs" /> <Compile Include="Instrumentation\LogProvider.cs" />
<Compile Include="Instrumentation\SubsonicTarget.cs" /> <Compile Include="Instrumentation\SubsonicTarget.cs" />
@ -208,7 +207,6 @@
<Compile Include="Providers\Core\ConfigProvider.cs" /> <Compile Include="Providers\Core\ConfigProvider.cs" />
<Compile Include="Providers\EpisodeProvider.cs" /> <Compile Include="Providers\EpisodeProvider.cs" />
<Compile Include="Providers\Core\HttpProvider.cs" /> <Compile Include="Providers\Core\HttpProvider.cs" />
<Compile Include="Providers\IEpisodeProvider.cs" />
<Compile Include="Providers\ISeasonProvider.cs" /> <Compile Include="Providers\ISeasonProvider.cs" />
<Compile Include="Providers\SabProvider.cs" /> <Compile Include="Providers\SabProvider.cs" />
<Compile Include="Providers\SeasonProvider.cs" /> <Compile Include="Providers\SeasonProvider.cs" />

@ -9,7 +9,7 @@ using SubSonic.Repository;
namespace NzbDrone.Core.Providers namespace NzbDrone.Core.Providers
{ {
public class EpisodeProvider : IEpisodeProvider public class EpisodeProvider
{ {
//TODO: Remove parsing of the series name, it should be done in series provider //TODO: Remove parsing of the series name, it should be done in series provider
@ -33,27 +33,32 @@ namespace NzbDrone.Core.Providers
_quality = quality; _quality = quality;
} }
public Episode GetEpisode(long id) public EpisodeProvider()
{
}
public virtual Episode GetEpisode(long id)
{ {
return _sonicRepo.Single<Episode>(id); return _sonicRepo.Single<Episode>(id);
} }
public Episode GetEpisode(int seriesId, int seasonNumber, int episodeNumber) public virtual Episode GetEpisode(int seriesId, int seasonNumber, int episodeNumber)
{ {
return _sonicRepo.Single<Episode>(c => c.SeriesId == seriesId && c.SeasonNumber == seasonNumber && c.EpisodeNumber == episodeNumber); return _sonicRepo.Single<Episode>(c => c.SeriesId == seriesId && c.SeasonNumber == seasonNumber && c.EpisodeNumber == episodeNumber);
} }
public IList<Episode> GetEpisodeBySeries(long seriesId) public virtual IList<Episode> GetEpisodeBySeries(long seriesId)
{ {
return _sonicRepo.Find<Episode>(e => e.SeriesId == seriesId); return _sonicRepo.Find<Episode>(e => e.SeriesId == seriesId);
} }
public IList<Episode> GetEpisodeBySeason(long seasonId) public virtual IList<Episode> GetEpisodeBySeason(long seasonId)
{ {
return _sonicRepo.Find<Episode>(e => e.SeasonId == seasonId); return _sonicRepo.Find<Episode>(e => e.SeasonId == seasonId);
} }
public String GetSabTitle(Episode episode) public virtual String GetSabTitle(Episode episode)
{ {
var series = _series.GetSeries(episode.SeriesId); var series = _series.GetSeries(episode.SeriesId);
if (series == null) throw new ArgumentException("Unknown series. ID: " + episode.SeriesId); if (series == null) throw new ArgumentException("Unknown series. ID: " + episode.SeriesId);
@ -67,7 +72,7 @@ namespace NzbDrone.Core.Providers
/// </summary> /// </summary>
/// <param name="parsedReport">Episode that needs to be checked</param> /// <param name="parsedReport">Episode that needs to be checked</param>
/// <returns></returns> /// <returns></returns>
public bool IsNeeded(EpisodeParseResult parsedReport) public virtual bool IsNeeded(EpisodeParseResult parsedReport)
{ {
foreach (var episode in parsedReport.Episodes) foreach (var episode in parsedReport.Episodes)
{ {
@ -114,7 +119,7 @@ namespace NzbDrone.Core.Providers
} }
public void RefreshEpisodeInfo(int seriesId) public virtual void RefreshEpisodeInfo(int seriesId)
{ {
Logger.Info("Starting episode info refresh for series:{0}", seriesId); Logger.Info("Starting episode info refresh for series:{0}", seriesId);
int successCount = 0; int successCount = 0;
@ -178,7 +183,7 @@ namespace NzbDrone.Core.Providers
Logger.Debug("Finished episode refresh for series:{0}. Successful:{1} - Failed:{2} ", targetSeries.SeriesName, successCount, failCount); Logger.Debug("Finished episode refresh for series:{0}. Successful:{1} - Failed:{2} ", targetSeries.SeriesName, successCount, failCount);
} }
public void RefreshEpisodeInfo(Season season) public virtual void RefreshEpisodeInfo(Season season)
{ {
Logger.Info("Starting episode info refresh for season {0} of series:{1}", season.SeasonNumber, season.SeriesId); Logger.Info("Starting episode info refresh for season {0} of series:{1}", season.SeasonNumber, season.SeriesId);
int successCount = 0; int successCount = 0;
@ -237,27 +242,15 @@ namespace NzbDrone.Core.Providers
Logger.Debug("Finished episode refresh for series:{0}. Successful:{1} - Failed:{2} ", targetSeries.SeriesName, successCount, failCount); Logger.Debug("Finished episode refresh for series:{0}. Successful:{1} - Failed:{2} ", targetSeries.SeriesName, successCount, failCount);
} }
public void DeleteEpisode(int episodeId) public virtual void DeleteEpisode(int episodeId)
{ {
_sonicRepo.Delete<Episode>(episodeId); _sonicRepo.Delete<Episode>(episodeId);
} }
public void UpdateEpisode(Episode episode) public virtual void UpdateEpisode(Episode episode)
{ {
_sonicRepo.Update(episode); _sonicRepo.Update(episode);
} }
private bool IsSeasonIgnored(EpisodeParseResult episode)
{
//Check if this Season is ignored
if (_seasons.IsIgnored(episode.SeriesId, episode.SeasonNumber))
{
Logger.Debug("Season {0} is ignored for: {1}", episode.SeasonNumber, episode.SeriesTitle);
return true;
}
Logger.Debug("Season {0} is wanted for: {1}", episode.SeasonNumber, episode.SeriesTitle);
return false;
}
} }
} }

@ -10,13 +10,13 @@ namespace NzbDrone.Core.Providers.Feed
{ {
protected readonly SeriesProvider _seriesProvider; protected readonly SeriesProvider _seriesProvider;
protected readonly ISeasonProvider _seasonProvider; protected readonly ISeasonProvider _seasonProvider;
protected readonly IEpisodeProvider _episodeProvider; protected readonly EpisodeProvider _episodeProvider;
protected readonly IConfigProvider _configProvider; protected readonly IConfigProvider _configProvider;
private readonly HttpProvider _httpProvider; private readonly HttpProvider _httpProvider;
protected static readonly Logger Logger = LogManager.GetCurrentClassLogger(); protected static readonly Logger Logger = LogManager.GetCurrentClassLogger();
public FeedProviderBase(SeriesProvider seriesProvider, ISeasonProvider seasonProvider, public FeedProviderBase(SeriesProvider seriesProvider, ISeasonProvider seasonProvider,
IEpisodeProvider episodeProvider, IConfigProvider configProvider, HttpProvider httpProvider) EpisodeProvider episodeProvider, IConfigProvider configProvider, HttpProvider httpProvider)
{ {
_seriesProvider = seriesProvider; _seriesProvider = seriesProvider;
_seasonProvider = seasonProvider; _seasonProvider = seasonProvider;

@ -9,7 +9,7 @@ namespace NzbDrone.Core.Providers.Feed
{ {
class NzbsOrgFeedProvider : FeedProviderBase class NzbsOrgFeedProvider : FeedProviderBase
{ {
public NzbsOrgFeedProvider(SeriesProvider seriesProvider, ISeasonProvider seasonProvider, IEpisodeProvider episodeProvider, IConfigProvider configProvider, HttpProvider httpProvider) public NzbsOrgFeedProvider(SeriesProvider seriesProvider, ISeasonProvider seasonProvider, EpisodeProvider episodeProvider, IConfigProvider configProvider, HttpProvider httpProvider)
: base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider) : base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider)
{ {
} }

@ -20,6 +20,10 @@ namespace NzbDrone.Core.Providers
_sonicRepo = sonicRepo; _sonicRepo = sonicRepo;
} }
public HistoryProvider()
{
}
#region HistoryProvider Members #region HistoryProvider Members
public virtual List<History> AllItems() public virtual List<History> AllItems()

@ -1,28 +0,0 @@
using System;
using System.Collections.Generic;
using NzbDrone.Core.Model;
using NzbDrone.Core.Repository;
namespace NzbDrone.Core.Providers
{
public interface IEpisodeProvider
{
Episode GetEpisode(long id);
Episode GetEpisode(int seriesId, int seasonNumber, int episodeNumber);
IList<Episode> GetEpisodeBySeries(long seriesId);
String GetSabTitle(Episode episode);
/// <summary>
/// Comprehensive check on whether or not this episode is needed.
/// </summary>
/// <param name="episode">Episode that needs to be checked</param>
/// <returns></returns>
bool IsNeeded(EpisodeParseResult episode);
void RefreshEpisodeInfo(int seriesId);
void RefreshEpisodeInfo(Season season);
IList<Episode> GetEpisodeBySeason(long seasonId);
void DeleteEpisode(int episodeId);
void UpdateEpisode(Episode episode);
}
}

@ -17,12 +17,12 @@ namespace NzbDrone.Core.Providers
private readonly IRepository _repository; private readonly IRepository _repository;
private readonly IConfigProvider _configProvider; private readonly IConfigProvider _configProvider;
private readonly DiskProvider _diskProvider; private readonly DiskProvider _diskProvider;
private readonly IEpisodeProvider _episodeProvider; private readonly EpisodeProvider _episodeProvider;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private static readonly string[] MediaExtentions = new[] { "*.mkv", "*.avi", "*.wmv" }; private static readonly string[] MediaExtentions = new[] { "*.mkv", "*.avi", "*.wmv" };
public MediaFileProvider(IRepository repository, IConfigProvider configProvider, DiskProvider diskProvider, IEpisodeProvider episodeProvider) public MediaFileProvider(IRepository repository, IConfigProvider configProvider, DiskProvider diskProvider, EpisodeProvider episodeProvider)
{ {
_repository = repository; _repository = repository;
_configProvider = configProvider; _configProvider = configProvider;

@ -16,7 +16,7 @@ namespace NzbDrone.Core.Providers
{ {
private readonly SeriesProvider _seriesProvider; private readonly SeriesProvider _seriesProvider;
private readonly ISeasonProvider _seasonProvider; private readonly ISeasonProvider _seasonProvider;
private readonly IEpisodeProvider _episodeProvider; private readonly EpisodeProvider _episodeProvider;
private readonly IMediaFileProvider _mediaFileProvider; private readonly IMediaFileProvider _mediaFileProvider;
private readonly DiskProvider _diskProvider; private readonly DiskProvider _diskProvider;
private readonly IConfigProvider _configProvider; private readonly IConfigProvider _configProvider;
@ -28,7 +28,7 @@ namespace NzbDrone.Core.Providers
private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
public RenameProvider(SeriesProvider seriesProvider, ISeasonProvider seasonProvider, public RenameProvider(SeriesProvider seriesProvider, ISeasonProvider seasonProvider,
IEpisodeProvider episodeProvider, IMediaFileProvider mediaFileProvider, EpisodeProvider episodeProvider, IMediaFileProvider mediaFileProvider,
DiskProvider diskProvider, IConfigProvider configProvider, DiskProvider diskProvider, IConfigProvider configProvider,
ExternalNotificationProvider extenalNotificationProvider) ExternalNotificationProvider extenalNotificationProvider)
{ {

@ -34,6 +34,10 @@ namespace NzbDrone.Core.Providers
_quality = quality; _quality = quality;
} }
public SeriesProvider()
{
}
#region SeriesProvider Members #region SeriesProvider Members
public virtual IQueryable<Series> GetAllSeries() public virtual IQueryable<Series> GetAllSeries()

@ -14,7 +14,7 @@ namespace NzbDrone.Core.Providers
public class SyncProvider : ISyncProvider public class SyncProvider : ISyncProvider
{ {
private readonly SeriesProvider _seriesProvider; private readonly SeriesProvider _seriesProvider;
private readonly IEpisodeProvider _episodeProvider; private readonly EpisodeProvider _episodeProvider;
private readonly IMediaFileProvider _mediaFileProvider; private readonly IMediaFileProvider _mediaFileProvider;
private readonly NotificationProvider _notificationProvider; private readonly NotificationProvider _notificationProvider;
private readonly DiskProvider _diskProvider; private readonly DiskProvider _diskProvider;
@ -24,7 +24,7 @@ namespace NzbDrone.Core.Providers
private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
public SyncProvider(SeriesProvider seriesProvider, IEpisodeProvider episodeProvider, public SyncProvider(SeriesProvider seriesProvider, EpisodeProvider episodeProvider,
IMediaFileProvider mediaFileProvider, NotificationProvider notificationProvider, IMediaFileProvider mediaFileProvider, NotificationProvider notificationProvider,
DiskProvider diskProvider) DiskProvider diskProvider)
{ {

@ -13,7 +13,7 @@ namespace NzbDrone.Core.Providers
private readonly RssSyncProvider _rssSyncProvider; private readonly RssSyncProvider _rssSyncProvider;
private readonly SeriesProvider _seriesProvider; private readonly SeriesProvider _seriesProvider;
private readonly ISeasonProvider _seasonProvider; private readonly ISeasonProvider _seasonProvider;
private readonly IEpisodeProvider _episodeProvider; private readonly EpisodeProvider _episodeProvider;
private readonly IMediaFileProvider _mediaFileProvider; private readonly IMediaFileProvider _mediaFileProvider;
private Timer _rssSyncTimer; private Timer _rssSyncTimer;
@ -21,7 +21,7 @@ namespace NzbDrone.Core.Providers
private DateTime _rssSyncNextInterval; private DateTime _rssSyncNextInterval;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
public TimerProvider(RssSyncProvider rssSyncProvider, SeriesProvider seriesProvider, ISeasonProvider seasonProvider, IEpisodeProvider episodeProvider, IMediaFileProvider mediaFileProvider) public TimerProvider(RssSyncProvider rssSyncProvider, SeriesProvider seriesProvider, ISeasonProvider seasonProvider, EpisodeProvider episodeProvider, IMediaFileProvider mediaFileProvider)
{ {
_rssSyncProvider = rssSyncProvider; _rssSyncProvider = rssSyncProvider;
_seriesProvider = seriesProvider; _seriesProvider = seriesProvider;

@ -11,9 +11,9 @@ namespace NzbDrone.Web.Controllers
{ {
public class LogController : Controller public class LogController : Controller
{ {
private readonly ILogProvider _logProvider; private readonly LogProvider _logProvider;
public LogController(ILogProvider logProvider) public LogController(LogProvider logProvider)
{ {
_logProvider = logProvider; _logProvider = logProvider;
} }

@ -22,7 +22,7 @@ namespace NzbDrone.Web.Controllers
public class SeriesController : Controller public class SeriesController : Controller
{ {
private readonly SeriesProvider _seriesProvider; private readonly SeriesProvider _seriesProvider;
private readonly IEpisodeProvider _episodeProvider; private readonly EpisodeProvider _episodeProvider;
private readonly ISyncProvider _syncProvider; private readonly ISyncProvider _syncProvider;
private readonly RssSyncProvider _rssSyncProvider; private readonly RssSyncProvider _rssSyncProvider;
private readonly QualityProvider _qualityProvider; private readonly QualityProvider _qualityProvider;
@ -34,7 +34,7 @@ namespace NzbDrone.Web.Controllers
// GET: /Series/ // GET: /Series/
public SeriesController(ISyncProvider syncProvider, SeriesProvider seriesProvider, public SeriesController(ISyncProvider syncProvider, SeriesProvider seriesProvider,
IEpisodeProvider episodeProvider, RssSyncProvider rssSyncProvider, EpisodeProvider episodeProvider, RssSyncProvider rssSyncProvider,
QualityProvider qualityProvider, IMediaFileProvider mediaFileProvider, QualityProvider qualityProvider, IMediaFileProvider mediaFileProvider,
RenameProvider renameProvider, RootDirProvider rootDirProvider, RenameProvider renameProvider, RootDirProvider rootDirProvider,
TvDbProvider tvDbProvider) TvDbProvider tvDbProvider)

Loading…
Cancel
Save