removed IEpisodeProvider, ILogProvider

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

@ -36,14 +36,23 @@ namespace AutoMoq
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;
var type = GetTheMockType<T>();
if (GetMockHasNotBeenCalledForThisType(type))
CreateANewMockAndRegisterIt<T>(type);
{
CreateANewMockAndRegisterIt<T>(type, behavior);
}
return TheRegisteredMockForThisType<T>(type);
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 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;
}
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);
SetMock(type, mock);
}
@ -129,5 +138,14 @@ namespace AutoMoq
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.Linq.Expressions;
using System.Text;
using AutoMoq;
using FizzWare.NBuilder;
using Gallio.Framework;
using MbUnit.Framework;
@ -41,32 +42,29 @@ namespace NzbDrone.Core.Test
var fakeEpisode = Builder<Episode>.CreateNew().With(c => c.SeriesId = fakeSeries.SeriesId).Build();
//Mocks
var repository = new Mock<IRepository>();
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 mocker = new AutoMoqer();
var episodeProvider = new Mock<IEpisodeProvider>();
episodeProvider.Setup(e => e.GetEpisode(fakeSeries.SeriesId, seasonNumber, episodeNumner)).Returns(fakeEpisode).Verifiable();
mocker.GetMock<IRepository>()
.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>();
diskProvider.Setup(e => e.GetSize(fileName)).Returns(12345).Verifiable();
mocker.GetMock<EpisodeProvider>()
.Setup(e => e.GetEpisode(fakeSeries.SeriesId, seasonNumber, episodeNumner)).Returns(fakeEpisode).Verifiable();
var kernel = new MockingKernel();
kernel.Bind<IRepository>().ToConstant(repository.Object);
mocker.GetMock<DiskProvider>()
.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
var result = kernel.Get<IMediaFileProvider>().ImportFile(fakeSeries, fileName);
var result = mocker.Resolve<MediaFileProvider>().ImportFile(fakeSeries, fileName);
//Assert
repository.VerifyAll();
episodeProvider.VerifyAll();
diskProvider.VerifyAll();
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
//Dynamically by SubSonic
@ -93,31 +91,25 @@ namespace NzbDrone.Core.Test
//Fakes
var fakeSeries = Builder<Series>.CreateNew().Build();
var fakeEpisode = Builder<Episode>.CreateNew().With(c => c.SeriesId = fakeSeries.SeriesId).Build();
//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();
kernel.Bind<IRepository>().ToConstant(repository.Object);
var mocker = new AutoMoqer();
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
var result = kernel.Get<IMediaFileProvider>().ImportFile(fakeSeries, fileName);
var result = mocker.Resolve<MediaFileProvider>().ImportFile(fakeSeries, fileName);
//Assert
repository.VerifyAll();
episodeProvider.VerifyAll();
diskProvider.VerifyAll();
mocker.GetMock<IRepository>().VerifyAll();
mocker.GetMock<EpisodeProvider>().VerifyAll();
mocker.GetMock<DiskProvider>(MockBehavior.Strict).VerifyAll();
Assert.IsNull(result);
repository.Verify(r => r.Add<EpisodeFile>(result), Times.Never());
mocker.GetMock<IRepository>().Verify(r => r.Add<EpisodeFile>(result), Times.Never());
}
[Test]
@ -136,30 +128,23 @@ namespace NzbDrone.Core.Test
var fakeSeries = Builder<Series>.CreateNew().Build();
//Mocks
var repository = new Mock<IRepository>(MockBehavior.Strict);
repository.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 mocker = new AutoMoqer();
mocker.GetMock<IRepository>(MockBehavior.Strict)
.Setup(r => r.Exists<EpisodeFile>(It.IsAny<Expression<Func<EpisodeFile, Boolean>>>())).Returns(false).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
var result = kernel.Get<IMediaFileProvider>().ImportFile(fakeSeries, fileName);
var result = mocker.Resolve<MediaFileProvider>().ImportFile(fakeSeries, fileName);
//Assert
repository.VerifyAll();
episodeProvider.VerifyAll();
diskProvider.VerifyAll();
mocker.VerifyAllMocks();
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 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)
{
}

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

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

@ -9,7 +9,7 @@ using SubSonic.Repository;
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
@ -33,27 +33,32 @@ namespace NzbDrone.Core.Providers
_quality = quality;
}
public Episode GetEpisode(long id)
public EpisodeProvider()
{
}
public virtual Episode GetEpisode(long 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);
}
public IList<Episode> GetEpisodeBySeries(long seriesId)
public virtual IList<Episode> GetEpisodeBySeries(long 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);
}
public String GetSabTitle(Episode episode)
public virtual String GetSabTitle(Episode episode)
{
var series = _series.GetSeries(episode.SeriesId);
if (series == null) throw new ArgumentException("Unknown series. ID: " + episode.SeriesId);
@ -67,7 +72,7 @@ namespace NzbDrone.Core.Providers
/// </summary>
/// <param name="parsedReport">Episode that needs to be checked</param>
/// <returns></returns>
public bool IsNeeded(EpisodeParseResult parsedReport)
public virtual bool IsNeeded(EpisodeParseResult parsedReport)
{
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);
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);
}
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);
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);
}
public void DeleteEpisode(int episodeId)
public virtual void DeleteEpisode(int episodeId)
{
_sonicRepo.Delete<Episode>(episodeId);
}
public void UpdateEpisode(Episode episode)
public virtual void UpdateEpisode(Episode 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 ISeasonProvider _seasonProvider;
protected readonly IEpisodeProvider _episodeProvider;
protected readonly EpisodeProvider _episodeProvider;
protected readonly IConfigProvider _configProvider;
private readonly HttpProvider _httpProvider;
protected static readonly Logger Logger = LogManager.GetCurrentClassLogger();
public FeedProviderBase(SeriesProvider seriesProvider, ISeasonProvider seasonProvider,
IEpisodeProvider episodeProvider, IConfigProvider configProvider, HttpProvider httpProvider)
EpisodeProvider episodeProvider, IConfigProvider configProvider, HttpProvider httpProvider)
{
_seriesProvider = seriesProvider;
_seasonProvider = seasonProvider;

@ -9,7 +9,7 @@ namespace NzbDrone.Core.Providers.Feed
{
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)
{
}

@ -20,33 +20,37 @@ namespace NzbDrone.Core.Providers
_sonicRepo = sonicRepo;
}
public HistoryProvider()
{
}
#region HistoryProvider Members
public virtual List<History> AllItems()
{
return _sonicRepo.All<History>().ToList();
}
public virtual void Purge()
{
var all = _sonicRepo.All<History>();
_sonicRepo.DeleteMany(all);
Logger.Info("History has been Purged");
}
public virtual void Trim()
{
var old = _sonicRepo.All<History>().Where(h => h.Date < DateTime.Now.AddDays(-30));
_sonicRepo.DeleteMany(old);
Logger.Info("History has been trimmed, items older than 30 days have been removed");
}
public virtual void Insert(History item)
{
_sonicRepo.Add(item);
//Logger.Info("Item added to history: {0} - {1}x{2:00}", item.Episode.Series.Title, item.Episode.SeasonNumber, item.Episode.EpisodeNumber);
}
public virtual bool Exists(int episodeId, QualityTypes quality, bool proper)
{
//Looks for the existance of this episode in History

@ -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 IConfigProvider _configProvider;
private readonly DiskProvider _diskProvider;
private readonly IEpisodeProvider _episodeProvider;
private readonly EpisodeProvider _episodeProvider;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
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;
_configProvider = configProvider;
@ -145,7 +145,7 @@ namespace NzbDrone.Core.Providers
}
}
public void DeleteFromDb(int fileId)
{
_repository.Delete<EpisodeFile>(fileId);

@ -16,7 +16,7 @@ namespace NzbDrone.Core.Providers
{
private readonly SeriesProvider _seriesProvider;
private readonly ISeasonProvider _seasonProvider;
private readonly IEpisodeProvider _episodeProvider;
private readonly EpisodeProvider _episodeProvider;
private readonly IMediaFileProvider _mediaFileProvider;
private readonly DiskProvider _diskProvider;
private readonly IConfigProvider _configProvider;
@ -28,7 +28,7 @@ namespace NzbDrone.Core.Providers
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
public RenameProvider(SeriesProvider seriesProvider, ISeasonProvider seasonProvider,
IEpisodeProvider episodeProvider, IMediaFileProvider mediaFileProvider,
EpisodeProvider episodeProvider, IMediaFileProvider mediaFileProvider,
DiskProvider diskProvider, IConfigProvider configProvider,
ExternalNotificationProvider extenalNotificationProvider)
{
@ -61,7 +61,7 @@ namespace NzbDrone.Core.Providers
StartRename();
}
}
public virtual void RenameSeries(int seriesId)
{
//Get a list of all applicable episode files/episodes and rename them
@ -83,7 +83,7 @@ namespace NzbDrone.Core.Providers
StartRename();
}
}
public virtual void RenameSeason(int seasonId)
{
//Get a list of all applicable episode files/episodes and rename them
@ -105,7 +105,7 @@ namespace NzbDrone.Core.Providers
StartRename();
}
}
public virtual void RenameEpisode(int episodeId)
{
//This will properly rename multi-episode files if asked to rename either of the episode
@ -126,7 +126,7 @@ namespace NzbDrone.Core.Providers
_epsToRename.Add(erm);
StartRename();
}
public virtual void RenameEpisodeFile(int episodeFileId, bool newDownload)
{
//This will properly rename multi-episode files if asked to rename either of the episode

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

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

@ -13,7 +13,7 @@ namespace NzbDrone.Core.Providers
private readonly RssSyncProvider _rssSyncProvider;
private readonly SeriesProvider _seriesProvider;
private readonly ISeasonProvider _seasonProvider;
private readonly IEpisodeProvider _episodeProvider;
private readonly EpisodeProvider _episodeProvider;
private readonly IMediaFileProvider _mediaFileProvider;
private Timer _rssSyncTimer;
@ -21,7 +21,7 @@ namespace NzbDrone.Core.Providers
private DateTime _rssSyncNextInterval;
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;
_seriesProvider = seriesProvider;
@ -40,7 +40,7 @@ namespace NzbDrone.Core.Providers
double interval = _rssSyncTimer.Interval;
_rssSyncTimer.Interval = interval;
}
public virtual void StartRssSyncTimer()
{
if (_rssSyncTimer.Interval < 900000) //If Timer is less than 15 minutes, throw an error! This should also be handled when saving the config, though a user could by-pass it by editing the DB directly... TNO (Trust No One)
@ -53,34 +53,34 @@ namespace NzbDrone.Core.Providers
_rssSyncTimer.Start();
_rssSyncNextInterval = DateTime.Now.AddMilliseconds(_rssSyncTimer.Interval);
}
public virtual void StopRssSyncTimer()
{
_rssSyncTimer.Stop();
}
public virtual void SetRssSyncTimer(int minutes)
{
long ms = minutes * 60 * 1000;
_rssSyncTimer.Interval = ms;
}
public virtual TimeSpan RssSyncTimeLeft()
{
return _rssSyncNextInterval.Subtract(DateTime.Now);
}
public virtual DateTime NextRssSyncTime()
{
return _rssSyncNextInterval;
}
public virtual void StartMinuteTimer()
{
_minuteTimer.Elapsed += new ElapsedEventHandler(MinuteTimer_Elapsed);
_minuteTimer.Start();
}
public virtual void StopMinuteTimer()
{
_minuteTimer.Stop();

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

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

Loading…
Cancel
Save