mirror of https://github.com/Radarr/Radarr
Merge branch 'master' of git://github.com/kayone/NzbDrone
Conflicts: NzbDrone.Web/NzbDrone.Web.csproj
This commit is contained in:
commit
7deea327b8
|
@ -3,13 +3,14 @@ using MbUnit.Framework;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
|
using NzbDrone.Core.Test.Framework;
|
||||||
using SubSonic.Repository;
|
using SubSonic.Repository;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test
|
namespace NzbDrone.Core.Test
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
public class DbConfigControllerTest
|
public class ConfigProviderTest : TestBase
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void Overwrite_existing_value()
|
public void Overwrite_existing_value()
|
Binary file not shown.
|
@ -3,6 +3,7 @@ using System.IO;
|
||||||
using MbUnit.Framework;
|
using MbUnit.Framework;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NLog.Config;
|
using NLog.Config;
|
||||||
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test
|
namespace NzbDrone.Core.Test
|
||||||
{
|
{
|
||||||
|
@ -50,6 +51,11 @@ namespace NzbDrone.Core.Test
|
||||||
LogManager.Configuration =
|
LogManager.Configuration =
|
||||||
new XmlLoggingConfiguration(Path.Combine(CentralDispatch.AppPath, "log.config"), false);
|
new XmlLoggingConfiguration(Path.Combine(CentralDispatch.AppPath, "log.config"), false);
|
||||||
LogManager.ThrowExceptions = true;
|
LogManager.ThrowExceptions = true;
|
||||||
|
|
||||||
|
var exceptionVerification = new ExceptionVerification();
|
||||||
|
LogManager.Configuration.AddTarget("ExceptionVerification", exceptionVerification);
|
||||||
|
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Info, exceptionVerification));
|
||||||
|
LogManager.Configuration.Reload();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,21 +10,21 @@ namespace AutoMoq.Unity
|
||||||
{
|
{
|
||||||
internal class AutoMockingBuilderStrategy : BuilderStrategy
|
internal class AutoMockingBuilderStrategy : BuilderStrategy
|
||||||
{
|
{
|
||||||
private readonly IUnityContainer container;
|
private readonly IUnityContainer _container;
|
||||||
private readonly MockFactory mockFactory;
|
private readonly MockRepository _mockFactory;
|
||||||
private readonly IEnumerable<Type> registeredTypes;
|
private readonly IEnumerable<Type> _registeredTypes;
|
||||||
|
|
||||||
public AutoMockingBuilderStrategy(IEnumerable<Type> registeredTypes, IUnityContainer container)
|
public AutoMockingBuilderStrategy(IEnumerable<Type> registeredTypes, IUnityContainer container)
|
||||||
{
|
{
|
||||||
var autoMoqer = container.Resolve<AutoMoqer>();
|
var autoMoqer = container.Resolve<AutoMoqer>();
|
||||||
mockFactory = new MockFactory(autoMoqer.DefaultBehavior);
|
_mockFactory = new MockRepository(autoMoqer.DefaultBehavior);
|
||||||
this.registeredTypes = registeredTypes;
|
_registeredTypes = registeredTypes;
|
||||||
this.container = container;
|
_container = container;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PreBuildUp(IBuilderContext context)
|
public override void PreBuildUp(IBuilderContext context)
|
||||||
{
|
{
|
||||||
var autoMoqer = container.Resolve<AutoMoqer>();
|
var autoMoqer = _container.Resolve<AutoMoqer>();
|
||||||
|
|
||||||
var type = GetTheTypeFromTheBuilderContext(context);
|
var type = GetTheTypeFromTheBuilderContext(context);
|
||||||
if (AMockObjectShouldBeCreatedForThisType(type))
|
if (AMockObjectShouldBeCreatedForThisType(type))
|
||||||
|
@ -39,7 +39,7 @@ namespace AutoMoq.Unity
|
||||||
|
|
||||||
private bool AMockObjectShouldBeCreatedForThisType(Type type)
|
private bool AMockObjectShouldBeCreatedForThisType(Type type)
|
||||||
{
|
{
|
||||||
var mocker = container.Resolve<AutoMoqer>();
|
var mocker = _container.Resolve<AutoMoqer>();
|
||||||
return TypeIsNotRegistered(type) && (mocker.ResolveType == null || mocker.ResolveType != type);
|
return TypeIsNotRegistered(type) && (mocker.ResolveType == null || mocker.ResolveType != type);
|
||||||
//return TypeIsNotRegistered(type) && type.IsInterface;
|
//return TypeIsNotRegistered(type) && type.IsInterface;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ namespace AutoMoq.Unity
|
||||||
|
|
||||||
private bool TypeIsNotRegistered(Type type)
|
private bool TypeIsNotRegistered(Type type)
|
||||||
{
|
{
|
||||||
return registeredTypes.Any(x => x.Equals(type)) == false;
|
return _registeredTypes.Any(x => x.Equals(type)) == false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Mock CreateAMockObject(Type type)
|
private Mock CreateAMockObject(Type type)
|
||||||
|
@ -63,12 +63,12 @@ namespace AutoMoq.Unity
|
||||||
|
|
||||||
private Mock InvokeTheMockCreationMethod(MethodInfo createMethod)
|
private Mock InvokeTheMockCreationMethod(MethodInfo createMethod)
|
||||||
{
|
{
|
||||||
return (Mock)createMethod.Invoke(mockFactory, new object[] { new List<object>().ToArray() });
|
return (Mock)createMethod.Invoke(_mockFactory, new object[] { new List<object>().ToArray() });
|
||||||
}
|
}
|
||||||
|
|
||||||
private MethodInfo GenerateAnInterfaceMockCreationMethod(Type type)
|
private MethodInfo GenerateAnInterfaceMockCreationMethod(Type type)
|
||||||
{
|
{
|
||||||
var createMethodWithNoParameters = mockFactory.GetType().GetMethod("Create", EmptyArgumentList());
|
var createMethodWithNoParameters = _mockFactory.GetType().GetMethod("Create", EmptyArgumentList());
|
||||||
|
|
||||||
return createMethodWithNoParameters.MakeGenericMethod(new[] { type });
|
return createMethodWithNoParameters.MakeGenericMethod(new[] { type });
|
||||||
}
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using NLog;
|
||||||
|
using NLog.Targets;
|
||||||
|
using MbUnit.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Test.Framework
|
||||||
|
{
|
||||||
|
public class ExceptionVerification : Target
|
||||||
|
{
|
||||||
|
private static List<LogEventInfo> _logs = new List<LogEventInfo>();
|
||||||
|
|
||||||
|
protected override void Write(LogEventInfo logEvent)
|
||||||
|
{
|
||||||
|
if (logEvent.Level >= LogLevel.Warn)
|
||||||
|
{
|
||||||
|
_logs.Add(logEvent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void Reset()
|
||||||
|
{
|
||||||
|
_logs = new List<LogEventInfo>();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void AssertNoError()
|
||||||
|
{
|
||||||
|
if (_logs.Count != 0)
|
||||||
|
{
|
||||||
|
string errors = GetLogsString(_logs);
|
||||||
|
|
||||||
|
var message = String.Format("{0} unexpected Fatal/Error/Warning were logged during execution.\n\r Use ExceptionVerification.Excpected methods if errors are excepted for this test.{1}{2}",
|
||||||
|
_logs.Count,
|
||||||
|
Environment.NewLine,
|
||||||
|
errors);
|
||||||
|
|
||||||
|
Assert.Fail(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GetLogsString(IEnumerable<LogEventInfo> logs)
|
||||||
|
{
|
||||||
|
string errors = "";
|
||||||
|
foreach (var log in logs)
|
||||||
|
{
|
||||||
|
string exception = "";
|
||||||
|
if (log.Exception != null)
|
||||||
|
{
|
||||||
|
exception = log.Exception.ToString();
|
||||||
|
}
|
||||||
|
errors += Environment.NewLine + String.Format("[{0}] {1}: {2} {3}", log.Level, log.LoggerName, log.FormattedMessage, exception);
|
||||||
|
}
|
||||||
|
return errors;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void ExcpectedErrors(int count)
|
||||||
|
{
|
||||||
|
Excpected(LogLevel.Error, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void ExcpectedFatals(int count)
|
||||||
|
{
|
||||||
|
Excpected(LogLevel.Fatal, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void ExcpectedWarns(int count)
|
||||||
|
{
|
||||||
|
Excpected(LogLevel.Warn, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void Excpected(LogLevel level, int count)
|
||||||
|
{
|
||||||
|
var levelLogs = _logs.Where(l => l.Level == level).ToList();
|
||||||
|
|
||||||
|
if (levelLogs.Count != count)
|
||||||
|
{
|
||||||
|
var message = String.Format("{0} {1}(s) were expected but {2} were logged.\n\r{3}",
|
||||||
|
count, level, _logs.Count, GetLogsString(levelLogs));
|
||||||
|
|
||||||
|
Assert.Fail(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
levelLogs.ForEach(c => _logs.Remove(c));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,7 +11,7 @@ using NzbDrone.Core.Repository.Quality;
|
||||||
using SubSonic.DataProviders;
|
using SubSonic.DataProviders;
|
||||||
using SubSonic.Repository;
|
using SubSonic.Repository;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test
|
namespace NzbDrone.Core.Test.Framework
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides the standard Mocks needed for a typical test
|
/// Provides the standard Mocks needed for a typical test
|
|
@ -0,0 +1,21 @@
|
||||||
|
using MbUnit.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Test.Framework
|
||||||
|
{
|
||||||
|
public class TestBase
|
||||||
|
{
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void Setup()
|
||||||
|
{
|
||||||
|
ExceptionVerification.Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
[TearDown]
|
||||||
|
public void TearDown()
|
||||||
|
{
|
||||||
|
if (!Assert.IsFailurePending) ExceptionVerification.AssertNoError();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,28 +7,20 @@ using Moq;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
using NzbDrone.Core.Repository.Quality;
|
using NzbDrone.Core.Repository.Quality;
|
||||||
|
using NzbDrone.Core.Test.Framework;
|
||||||
using SubSonic.Repository;
|
using SubSonic.Repository;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test
|
namespace NzbDrone.Core.Test
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class HistoryProviderTest
|
// ReSharper disable InconsistentNaming
|
||||||
|
public class HistoryProviderTest : TestBase
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void AllItems()
|
public void AllItems()
|
||||||
{
|
{
|
||||||
//Setup
|
//Setup
|
||||||
var series = new Series
|
Season season = new Season { SeasonId = 4321, SeasonNumber = 1, SeriesId = 5656, Monitored = true };
|
||||||
{
|
|
||||||
SeriesId = 5656,
|
|
||||||
CleanTitle = "rock",
|
|
||||||
Monitored = true,
|
|
||||||
Overview = "Series Overview",
|
|
||||||
QualityProfileId = 1,
|
|
||||||
Title = "30 Rock",
|
|
||||||
Path = @"C:\Test\TV\30 Rock"
|
|
||||||
};
|
|
||||||
var season = new Season { SeasonId = 4321, SeasonNumber = 1, SeriesId = 5656, Monitored = true };
|
|
||||||
var episode = new Episode
|
var episode = new Episode
|
||||||
{
|
{
|
||||||
AirDate = DateTime.Today.AddDays(-1),
|
AirDate = DateTime.Today.AddDays(-1),
|
||||||
|
@ -42,15 +34,17 @@ namespace NzbDrone.Core.Test
|
||||||
SeriesId = 5656
|
SeriesId = 5656
|
||||||
};
|
};
|
||||||
|
|
||||||
var list = new List<History>();
|
var list = new List<History>
|
||||||
list.Add(new History
|
{
|
||||||
|
new History
|
||||||
{
|
{
|
||||||
HistoryId = new int(),
|
HistoryId = new int(),
|
||||||
Date = DateTime.Now,
|
Date = DateTime.Now,
|
||||||
IsProper = false,
|
IsProper = false,
|
||||||
Quality = QualityTypes.TV,
|
Quality = QualityTypes.TV,
|
||||||
EpisodeId = episode.EpisodeId
|
EpisodeId = episode.EpisodeId
|
||||||
});
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var repo = new Mock<IRepository>();
|
var repo = new Mock<IRepository>();
|
||||||
repo.Setup(r => r.All<History>()).Returns(list.AsQueryable());
|
repo.Setup(r => r.All<History>()).Returns(list.AsQueryable());
|
||||||
|
@ -68,6 +62,7 @@ namespace NzbDrone.Core.Test
|
||||||
[Test]
|
[Test]
|
||||||
public void add_item()
|
public void add_item()
|
||||||
{
|
{
|
||||||
|
//Arange
|
||||||
var mocker = new AutoMoqer();
|
var mocker = new AutoMoqer();
|
||||||
var repo = MockLib.GetEmptyRepository();
|
var repo = MockLib.GetEmptyRepository();
|
||||||
|
|
||||||
|
@ -82,10 +77,22 @@ namespace NzbDrone.Core.Test
|
||||||
{
|
{
|
||||||
Date = DateTime.Now,
|
Date = DateTime.Now,
|
||||||
EpisodeId = episode.EpisodeId,
|
EpisodeId = episode.EpisodeId,
|
||||||
NzbTitle = "my title"
|
NzbTitle = "my title",
|
||||||
|
Indexer = "Fake Indexer"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//Act
|
||||||
mocker.Resolve<HistoryProvider>().Add(history);
|
mocker.Resolve<HistoryProvider>().Add(history);
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
var storedHistory = repo.All<History>();
|
||||||
|
var newHistiory = repo.All<History>().First();
|
||||||
|
|
||||||
|
Assert.Count(1, storedHistory);
|
||||||
|
Assert.AreEqual(history.Date, newHistiory.Date);
|
||||||
|
Assert.AreEqual(history.EpisodeId, newHistiory.EpisodeId);
|
||||||
|
Assert.AreEqual(history.NzbTitle, newHistiory.NzbTitle);
|
||||||
|
Assert.AreEqual(history.Indexer, newHistiory.Indexer);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -94,16 +101,6 @@ namespace NzbDrone.Core.Test
|
||||||
{
|
{
|
||||||
//Todo: This test fails... Moq Setup doesn't return the expected value
|
//Todo: This test fails... Moq Setup doesn't return the expected value
|
||||||
//Setup
|
//Setup
|
||||||
var series = new Series
|
|
||||||
{
|
|
||||||
SeriesId = 5656,
|
|
||||||
CleanTitle = "rock",
|
|
||||||
Monitored = true,
|
|
||||||
Overview = "Series Overview",
|
|
||||||
QualityProfileId = 1,
|
|
||||||
Title = "30 Rock",
|
|
||||||
Path = @"C:\Test\TV\30 Rock"
|
|
||||||
};
|
|
||||||
var season = new Season { SeasonId = 4321, SeasonNumber = 1, SeriesId = 5656, Monitored = true };
|
var season = new Season { SeasonId = 4321, SeasonNumber = 1, SeriesId = 5656, Monitored = true };
|
||||||
var episode = new Episode
|
var episode = new Episode
|
||||||
{
|
{
|
||||||
|
@ -118,16 +115,6 @@ namespace NzbDrone.Core.Test
|
||||||
SeriesId = 5656
|
SeriesId = 5656
|
||||||
};
|
};
|
||||||
|
|
||||||
var list = new List<History>();
|
|
||||||
list.Add(new History
|
|
||||||
{
|
|
||||||
HistoryId = new int(),
|
|
||||||
Date = DateTime.Now,
|
|
||||||
IsProper = false,
|
|
||||||
Quality = QualityTypes.TV,
|
|
||||||
EpisodeId = episode.EpisodeId
|
|
||||||
});
|
|
||||||
|
|
||||||
var proper = false;
|
var proper = false;
|
||||||
|
|
||||||
var repo = new Mock<IRepository>();
|
var repo = new Mock<IRepository>();
|
||||||
|
@ -150,16 +137,6 @@ namespace NzbDrone.Core.Test
|
||||||
//Todo: This test fails... Moq Setup doesn't return the expected value
|
//Todo: This test fails... Moq Setup doesn't return the expected value
|
||||||
|
|
||||||
//Setup
|
//Setup
|
||||||
var series = new Series
|
|
||||||
{
|
|
||||||
SeriesId = 5656,
|
|
||||||
CleanTitle = "rock",
|
|
||||||
Monitored = true,
|
|
||||||
Overview = "Series Overview",
|
|
||||||
QualityProfileId = 1,
|
|
||||||
Title = "30 Rock",
|
|
||||||
Path = @"C:\Test\TV\30 Rock"
|
|
||||||
};
|
|
||||||
var season = new Season { SeasonId = 4321, SeasonNumber = 1, SeriesId = 5656, Monitored = true };
|
var season = new Season { SeasonId = 4321, SeasonNumber = 1, SeriesId = 5656, Monitored = true };
|
||||||
var episode = new Episode
|
var episode = new Episode
|
||||||
{
|
{
|
||||||
|
@ -174,15 +151,17 @@ namespace NzbDrone.Core.Test
|
||||||
SeriesId = 5656
|
SeriesId = 5656
|
||||||
};
|
};
|
||||||
|
|
||||||
var list = new List<History>();
|
var list = new List<History>
|
||||||
list.Add(new History
|
{
|
||||||
|
new History
|
||||||
{
|
{
|
||||||
HistoryId = new int(),
|
HistoryId = new int(),
|
||||||
Date = DateTime.Now,
|
Date = DateTime.Now,
|
||||||
IsProper = false,
|
IsProper = false,
|
||||||
Quality = QualityTypes.TV,
|
Quality = QualityTypes.TV,
|
||||||
EpisodeId = episode.EpisodeId
|
EpisodeId = episode.EpisodeId
|
||||||
});
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var repo = new Mock<IRepository>();
|
var repo = new Mock<IRepository>();
|
||||||
repo.Setup(r => r.Exists<History>(h => h.Episode == episode && h.IsProper == list[0].IsProper)).Returns(
|
repo.Setup(r => r.Exists<History>(h => h.Episode == episode && h.IsProper == list[0].IsProper)).Returns(
|
||||||
|
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.ServiceModel.Syndication;
|
using System.ServiceModel.Syndication;
|
||||||
using System.Xml;
|
|
||||||
using AutoMoq;
|
using AutoMoq;
|
||||||
using FizzWare.NBuilder;
|
using FizzWare.NBuilder;
|
||||||
using MbUnit.Framework;
|
using MbUnit.Framework;
|
||||||
|
@ -14,13 +13,13 @@ using NzbDrone.Core.Providers.ExternalNotification;
|
||||||
using NzbDrone.Core.Providers.Indexer;
|
using NzbDrone.Core.Providers.Indexer;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
using NzbDrone.Core.Repository.Quality;
|
using NzbDrone.Core.Repository.Quality;
|
||||||
using SubSonic.Repository;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test
|
namespace NzbDrone.Core.Test
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class IndexerProviderTest
|
|
||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
|
public class IndexerProviderTest : TestBase
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
[Row("nzbsorg.xml")]
|
[Row("nzbsorg.xml")]
|
||||||
|
@ -58,7 +57,7 @@ namespace NzbDrone.Core.Test
|
||||||
{
|
{
|
||||||
var mocker = new AutoMoqer();
|
var mocker = new AutoMoqer();
|
||||||
|
|
||||||
var summary = "My fake summary";
|
const string summary = "My fake summary";
|
||||||
|
|
||||||
var fakeSettings = Builder<IndexerSetting>.CreateNew().Build();
|
var fakeSettings = Builder<IndexerSetting>.CreateNew().Build();
|
||||||
mocker.GetMock<IndexerProvider>()
|
mocker.GetMock<IndexerProvider>()
|
||||||
|
@ -104,6 +103,7 @@ namespace NzbDrone.Core.Test
|
||||||
var result = mocker.Resolve<CustomParserIndexer>().ParseFeed(fakeRssItem);
|
var result = mocker.Resolve<CustomParserIndexer>().ParseFeed(fakeRssItem);
|
||||||
|
|
||||||
Assert.IsNull(result);
|
Assert.IsNull(result);
|
||||||
|
ExceptionVerification.ExcpectedWarns(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ namespace NzbDrone.Core.Test
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
var indexerProvider = mocker.Resolve<IndexerProvider>();
|
var indexerProvider = mocker.Resolve<IndexerProvider>();
|
||||||
indexerProvider.InitializeIndexers(new List<IndexerProviderBase>() { mocker.Resolve<MockIndexerProvider>() });
|
indexerProvider.InitializeIndexers(new List<IndexerProviderBase> { mocker.Resolve<MockIndexerProvider>() });
|
||||||
var indexers = indexerProvider.All();
|
var indexers = indexerProvider.All();
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
|
|
|
@ -5,12 +5,13 @@ using AutoMoq;
|
||||||
using MbUnit.Framework;
|
using MbUnit.Framework;
|
||||||
using NzbDrone.Core.Model.Notification;
|
using NzbDrone.Core.Model.Notification;
|
||||||
using NzbDrone.Core.Providers.Jobs;
|
using NzbDrone.Core.Providers.Jobs;
|
||||||
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test
|
namespace NzbDrone.Core.Test
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
public class JobProviderTest
|
public class JobProviderTest : TestBase
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void Run_Jobs_Updates_Last_Execution()
|
public void Run_Jobs_Updates_Last_Execution()
|
||||||
|
@ -53,6 +54,7 @@ namespace NzbDrone.Core.Test
|
||||||
Assert.IsNotEmpty(settings);
|
Assert.IsNotEmpty(settings);
|
||||||
Assert.AreNotEqual(DateTime.MinValue, settings[0].LastExecution);
|
Assert.AreNotEqual(DateTime.MinValue, settings[0].LastExecution);
|
||||||
Assert.IsFalse(settings[0].Success);
|
Assert.IsFalse(settings[0].Success);
|
||||||
|
ExceptionVerification.ExcpectedErrors(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -76,27 +78,6 @@ namespace NzbDrone.Core.Test
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
|
||||||
//This test will confirm that the concurrency checks are rest
|
|
||||||
//after execution so the job can successfully run.
|
|
||||||
public void can_run_broken_job_again()
|
|
||||||
{
|
|
||||||
IEnumerable<IJob> fakeJobs = new List<IJob> { new BrokenJob() };
|
|
||||||
var mocker = new AutoMoqer();
|
|
||||||
|
|
||||||
mocker.SetConstant(MockLib.GetEmptyRepository());
|
|
||||||
mocker.SetConstant(fakeJobs);
|
|
||||||
|
|
||||||
var timerProvider = mocker.Resolve<JobProvider>();
|
|
||||||
timerProvider.Initialize();
|
|
||||||
var firstRun = timerProvider.RunScheduled();
|
|
||||||
Thread.Sleep(2000);
|
|
||||||
var secondRun = timerProvider.RunScheduled();
|
|
||||||
|
|
||||||
Assert.IsTrue(firstRun);
|
|
||||||
Assert.IsTrue(secondRun);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
//This test will confirm that the concurrency checks are rest
|
//This test will confirm that the concurrency checks are rest
|
||||||
//after execution so the job can successfully run.
|
//after execution so the job can successfully run.
|
||||||
|
@ -132,12 +113,14 @@ namespace NzbDrone.Core.Test
|
||||||
|
|
||||||
var timerProvider = mocker.Resolve<JobProvider>();
|
var timerProvider = mocker.Resolve<JobProvider>();
|
||||||
timerProvider.Initialize();
|
timerProvider.Initialize();
|
||||||
var firstRun = timerProvider.QueueJob(typeof(FakeJob));
|
var firstRun = timerProvider.QueueJob(typeof(BrokenJob));
|
||||||
Thread.Sleep(2000);
|
Thread.Sleep(2000);
|
||||||
var secondRun = timerProvider.QueueJob(typeof(FakeJob));
|
var secondRun = timerProvider.QueueJob(typeof(BrokenJob));
|
||||||
|
|
||||||
Assert.IsTrue(firstRun);
|
Assert.IsTrue(firstRun);
|
||||||
Assert.IsTrue(secondRun);
|
Assert.IsTrue(secondRun);
|
||||||
|
Thread.Sleep(2000);
|
||||||
|
ExceptionVerification.ExcpectedErrors(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
|
@ -1,26 +1,25 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using AutoMoq;
|
using AutoMoq;
|
||||||
using FizzWare.NBuilder;
|
using FizzWare.NBuilder;
|
||||||
using MbUnit.Framework;
|
using MbUnit.Framework;
|
||||||
using Moq;
|
using Moq;
|
||||||
using Moq.Linq;
|
|
||||||
using NzbDrone.Core.Model.Notification;
|
using NzbDrone.Core.Model.Notification;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.Providers.Jobs;
|
using NzbDrone.Core.Providers.Jobs;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
using NzbDrone.Core.Repository.Quality;
|
using NzbDrone.Core.Repository.Quality;
|
||||||
|
using NzbDrone.Core.Test.Framework;
|
||||||
using SubSonic.Repository;
|
using SubSonic.Repository;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test
|
namespace NzbDrone.Core.Test
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
public class MediaFileProviderTests
|
public class MediaFileProviderTests : TestBase
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
[Description("Verifies that a new file imported properly")]
|
[Description("Verifies that a new file imported properly")]
|
||||||
|
@ -86,7 +85,7 @@ namespace NzbDrone.Core.Test
|
||||||
|
|
||||||
//Constants
|
//Constants
|
||||||
const string fileName = @"2011.01.10 - Denis Leary - HD TV.mkv";
|
const string fileName = @"2011.01.10 - Denis Leary - HD TV.mkv";
|
||||||
DateTime airDate = new DateTime(2011, 01, 10);
|
var airDate = new DateTime(2011, 01, 10);
|
||||||
const int size = 12345;
|
const int size = 12345;
|
||||||
//Fakes
|
//Fakes
|
||||||
var fakeSeries = Builder<Series>.CreateNew().Build();
|
var fakeSeries = Builder<Series>.CreateNew().Build();
|
||||||
|
@ -144,9 +143,6 @@ 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)
|
|
||||||
.With(c => c.EpisodeFileId = 12).Build();
|
|
||||||
|
|
||||||
//Mocks
|
//Mocks
|
||||||
var mocker = new AutoMoqer();
|
var mocker = new AutoMoqer();
|
||||||
|
@ -179,7 +175,7 @@ namespace NzbDrone.Core.Test
|
||||||
|
|
||||||
//Constants
|
//Constants
|
||||||
const string fileName = @"2011.01.10 - Denis Leary - sample - HD TV.mkv";
|
const string fileName = @"2011.01.10 - Denis Leary - sample - HD TV.mkv";
|
||||||
DateTime airDate = new DateTime(2011, 01, 10);
|
var airDate = new DateTime(2011, 01, 10);
|
||||||
const int size = 12345;
|
const int size = 12345;
|
||||||
//Fakes
|
//Fakes
|
||||||
var fakeSeries = Builder<Series>.CreateNew().Build();
|
var fakeSeries = Builder<Series>.CreateNew().Build();
|
||||||
|
@ -275,6 +271,7 @@ namespace NzbDrone.Core.Test
|
||||||
mocker.VerifyAllMocks();
|
mocker.VerifyAllMocks();
|
||||||
Assert.IsNull(result);
|
Assert.IsNull(result);
|
||||||
mocker.GetMock<IRepository>().Verify(r => r.Add(result), Times.Never());
|
mocker.GetMock<IRepository>().Verify(r => r.Add(result), Times.Never());
|
||||||
|
ExceptionVerification.ExcpectedWarns(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
using System;
|
|
||||||
using Ninject.Infrastructure;
|
|
||||||
using Ninject.Injection;
|
|
||||||
using Ninject.Planning.Bindings;
|
|
||||||
using Ninject.Syntax;
|
|
||||||
|
|
||||||
namespace Ninject.Moq
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Extensions for the fluent binding syntax API.
|
|
||||||
/// </summary>
|
|
||||||
public static class ExtensionsForBindingSyntax
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Indicates that the service should be bound to a mocked instance of the specified type.
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name = "T">The service that is being mocked.</typeparam>
|
|
||||||
/// <param name = "builder">The builder that is building the binding.</param>
|
|
||||||
public static IBindingWhenInNamedWithOrOnSyntax<T> ToMock<T>(this IBindingToSyntax<T> builder)
|
|
||||||
{
|
|
||||||
var haveBinding = builder as IHaveBinding;
|
|
||||||
|
|
||||||
if (haveBinding == null)
|
|
||||||
throw new NotSupportedException(
|
|
||||||
String.Format(
|
|
||||||
"The binding builder for {0} is of type {1}, which does not implement IHaveBinding and is therefore not extensible.",
|
|
||||||
typeof (T), builder.GetType()));
|
|
||||||
|
|
||||||
IBinding binding = haveBinding.Binding;
|
|
||||||
|
|
||||||
binding.ProviderCallback = ctx => new MockProvider(ctx.Kernel.Components.Get<IInjectorFactory>());
|
|
||||||
|
|
||||||
return builder as IBindingWhenInNamedWithOrOnSyntax<T>;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,80 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Moq;
|
|
||||||
using Ninject.Activation;
|
|
||||||
using Ninject.Injection;
|
|
||||||
|
|
||||||
namespace Ninject.Moq
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Creates mocked instances via Moq.
|
|
||||||
/// </summary>
|
|
||||||
public class MockProvider : IProvider
|
|
||||||
{
|
|
||||||
private static readonly Dictionary<Type, ConstructorInjector> _injectors =
|
|
||||||
new Dictionary<Type, ConstructorInjector>();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref = "MockProvider" /> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name = "injectorFactory">The injector factory component.</param>
|
|
||||||
public MockProvider(IInjectorFactory injectorFactory)
|
|
||||||
{
|
|
||||||
InjectorFactory = injectorFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the injector factory component.
|
|
||||||
/// </summary>
|
|
||||||
public IInjectorFactory InjectorFactory { get; private set; }
|
|
||||||
|
|
||||||
#region IProvider Members
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the type (or prototype) of instances the provider creates.
|
|
||||||
/// </summary>
|
|
||||||
public Type Type
|
|
||||||
{
|
|
||||||
get { return typeof (Mock<>); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates an instance within the specified context.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name = "context">The context.</param>
|
|
||||||
/// <returns>The created instance.</returns>
|
|
||||||
public object Create(IContext context)
|
|
||||||
{
|
|
||||||
ConstructorInjector injector = GetInjector(context.Request.Service);
|
|
||||||
var mock = injector.Invoke() as Mock;
|
|
||||||
return mock.Object;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private ConstructorInjector GetInjector(Type service)
|
|
||||||
{
|
|
||||||
lock (_injectors)
|
|
||||||
{
|
|
||||||
Type mockType = typeof (Mock<>).MakeGenericType(service);
|
|
||||||
|
|
||||||
if (_injectors.ContainsKey(mockType))
|
|
||||||
return _injectors[mockType];
|
|
||||||
|
|
||||||
ConstructorInjector injector = InjectorFactory.Create(mockType.GetConstructor(Type.EmptyTypes));
|
|
||||||
_injectors[mockType] = injector;
|
|
||||||
|
|
||||||
return injector;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a callback that creates an instance of the <see cref = "MockProvider" />.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>The created callback.</returns>
|
|
||||||
public static Func<IContext, IProvider> GetCreationCallback()
|
|
||||||
{
|
|
||||||
return ctx => new MockProvider(ctx.Kernel.Components.Get<IInjectorFactory>());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
using System;
|
|
||||||
using Ninject.Activation.Caching;
|
|
||||||
using Ninject.Planning.Bindings;
|
|
||||||
|
|
||||||
namespace Ninject.Moq
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A kernel that will create mocked instances (via Moq) for any service that is
|
|
||||||
/// requested for which no binding is registered.
|
|
||||||
/// </summary>
|
|
||||||
public class MockingKernel : StandardKernel
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Clears the kernel's cache, immediately deactivating all activated instances regardless of scope.
|
|
||||||
/// This does not remove any modules, extensions, or bindings.
|
|
||||||
/// </summary>
|
|
||||||
public void Reset()
|
|
||||||
{
|
|
||||||
Components.Get<ICache>().Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Attempts to handle a missing binding for a service.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name = "service">The service.</param>
|
|
||||||
/// <returns><c>True</c> if the missing binding can be handled; otherwise <c>false</c>.</returns>
|
|
||||||
protected override bool HandleMissingBinding(Type service)
|
|
||||||
{
|
|
||||||
var binding = new Binding(service)
|
|
||||||
{
|
|
||||||
ProviderCallback = MockProvider.GetCreationCallback(),
|
|
||||||
ScopeCallback = ctx => null,
|
|
||||||
IsImplicit = true
|
|
||||||
};
|
|
||||||
|
|
||||||
AddBinding(binding);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -85,34 +85,33 @@
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AutoMoq\AutoMoqer.cs" />
|
<Compile Include="Framework\AutoMoq\AutoMoqer.cs" />
|
||||||
<Compile Include="AutoMoq\AutoMoqerTest.cs" />
|
<Compile Include="Framework\AutoMoq\AutoMoqerTest.cs" />
|
||||||
<Compile Include="AutoMoq\Unity\AutoMockingBuilderStrategy.cs">
|
<Compile Include="Framework\AutoMoq\Unity\AutoMockingBuilderStrategy.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="AutoMoq\Unity\AutoMockingContainerExtension.cs">
|
<Compile Include="Framework\AutoMoq\Unity\AutoMockingContainerExtension.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Framework\ExceptionVerification.cs" />
|
||||||
|
<Compile Include="Framework\TestBase.cs" />
|
||||||
<Compile Include="JobProviderTest.cs" />
|
<Compile Include="JobProviderTest.cs" />
|
||||||
<Compile Include="SyncProviderTest.cs" />
|
<Compile Include="SyncProviderTest.cs" />
|
||||||
<Compile Include="RootDirProviderTest.cs" />
|
<Compile Include="RootDirProviderTest.cs" />
|
||||||
<Compile Include="IndexerProviderTest.cs" />
|
<Compile Include="IndexerProviderTest.cs" />
|
||||||
<Compile Include="HistoryProviderTest.cs" />
|
<Compile Include="HistoryProviderTest.cs" />
|
||||||
<Compile Include="MediaFileProviderTests.cs" />
|
<Compile Include="MediaFileProviderTests.cs" />
|
||||||
<Compile Include="DbConfigControllerTest.cs" />
|
<Compile Include="ConfigProviderTest.cs" />
|
||||||
<Compile Include="EpisodeProviderTest.cs" />
|
<Compile Include="EpisodeProviderTest.cs" />
|
||||||
<Compile Include="Fixtures.cs" />
|
<Compile Include="Fixtures.cs" />
|
||||||
<Compile Include="MockLib.cs" />
|
<Compile Include="Framework\MockLib.cs" />
|
||||||
<Compile Include="Ninject.Moq\ExtensionsForBindingSyntax.cs" />
|
|
||||||
<Compile Include="Ninject.Moq\MockingKernel.cs" />
|
|
||||||
<Compile Include="Ninject.Moq\MockProvider.cs" />
|
|
||||||
<Compile Include="ParserTest.cs" />
|
<Compile Include="ParserTest.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="QualityProfileTest.cs" />
|
<Compile Include="QualityProfileTest.cs" />
|
||||||
<Compile Include="RepoTest.cs" />
|
<Compile Include="RepoTest.cs" />
|
||||||
<Compile Include="SabControllerTest.cs" />
|
<Compile Include="SabProviderTest.cs" />
|
||||||
<Compile Include="SeriesProviderTest.cs" />
|
<Compile Include="SeriesProviderTest.cs" />
|
||||||
<Compile Include="TvDbControllerTest.cs" />
|
<Compile Include="TvDbProviderTest.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\NzbDrone.Core\NzbDrone.Core.csproj">
|
<ProjectReference Include="..\NzbDrone.Core\NzbDrone.Core.csproj">
|
||||||
|
@ -121,7 +120,7 @@
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="AutoMoq\License.txt" />
|
<Content Include="Framework\AutoMoq\License.txt" />
|
||||||
<Content Include="Files\Feed.nzbmatrix.com.xml">
|
<Content Include="Files\Feed.nzbmatrix.com.xml">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
|
||||||
using MbUnit.Framework;
|
using MbUnit.Framework;
|
||||||
using NzbDrone.Core.Repository.Quality;
|
using NzbDrone.Core.Repository.Quality;
|
||||||
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test
|
namespace NzbDrone.Core.Test
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
public class ParserTest
|
public class ParserTest : TestBase
|
||||||
{
|
{
|
||||||
/*Fucked-up hall of shame,
|
/*Fucked-up hall of shame,
|
||||||
* WWE.Wrestlemania.27.PPV.HDTV.XviD-KYR
|
* WWE.Wrestlemania.27.PPV.HDTV.XviD-KYR
|
||||||
|
@ -15,6 +15,10 @@ namespace NzbDrone.Core.Test
|
||||||
* Unreported.World.Chinas.Lost.Sons.WS.PDTV.XviD-FTP
|
* Unreported.World.Chinas.Lost.Sons.WS.PDTV.XviD-FTP
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Row("Sonny.With.a.Chance.S02E15", "Sonny.With.a.Chance", 2, 15)]
|
[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.103.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Me", 1, 3)]
|
||||||
|
|
|
@ -5,12 +5,13 @@ using FizzWare.NBuilder;
|
||||||
using MbUnit.Framework;
|
using MbUnit.Framework;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
using NzbDrone.Core.Repository.Quality;
|
using NzbDrone.Core.Repository.Quality;
|
||||||
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test
|
namespace NzbDrone.Core.Test
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
public class QualityProfileTest
|
public class QualityProfileTest : TestBase
|
||||||
{
|
{
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Test_s the storage.
|
/// Test_s the storage.
|
||||||
|
@ -57,11 +58,7 @@ namespace NzbDrone.Core.Test
|
||||||
var series = Builder<Series>.CreateNew().Build();
|
var series = Builder<Series>.CreateNew().Build();
|
||||||
series.QualityProfileId = profileId;
|
series.QualityProfileId = profileId;
|
||||||
|
|
||||||
var seriesID = (int) repo.Add(series);
|
|
||||||
|
|
||||||
|
|
||||||
var result = repo.All<Series>();
|
var result = repo.All<Series>();
|
||||||
var quality = repo.All<QualityProfile>();
|
|
||||||
|
|
||||||
Assert.Count(1, result);
|
Assert.Count(1, result);
|
||||||
Assert.AreEqual(result.ToList()[0].QualityProfile.Name, testProfile.Name);
|
Assert.AreEqual(result.ToList()[0].QualityProfile.Name, testProfile.Name);
|
||||||
|
|
|
@ -6,13 +6,14 @@ using NLog;
|
||||||
using NLog.Config;
|
using NLog.Config;
|
||||||
using NzbDrone.Core.Instrumentation;
|
using NzbDrone.Core.Instrumentation;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
|
using NzbDrone.Core.Test.Framework;
|
||||||
using LogLevel = NLog.LogLevel;
|
using LogLevel = NLog.LogLevel;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test
|
namespace NzbDrone.Core.Test
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
public class RepoTest
|
public class RepoTest : TestBase
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void to_many__series_to_episode()
|
public void to_many__series_to_episode()
|
||||||
|
@ -93,6 +94,8 @@ namespace NzbDrone.Core.Test
|
||||||
Assert.AreEqual(Logger.Name, logItem.Logger);
|
Assert.AreEqual(Logger.Name, logItem.Logger);
|
||||||
Assert.AreEqual(LogLevel.Info.Name, logItem.Level);
|
Assert.AreEqual(LogLevel.Info.Name, logItem.Level);
|
||||||
Assert.AreEqual("write_log", logItem.Method);
|
Assert.AreEqual("write_log", logItem.Method);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -126,6 +129,7 @@ namespace NzbDrone.Core.Test
|
||||||
Assert.AreEqual(LogLevel.Error.Name, logItem.Level);
|
Assert.AreEqual(LogLevel.Error.Name, logItem.Level);
|
||||||
Assert.AreEqual(ex.GetType().ToString(), logItem.ExceptionType);
|
Assert.AreEqual(ex.GetType().ToString(), logItem.ExceptionType);
|
||||||
Assert.AreEqual(ex.ToString(), logItem.Exception);
|
Assert.AreEqual(ex.ToString(), logItem.Exception);
|
||||||
|
ExceptionVerification.ExcpectedErrors(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -159,6 +163,7 @@ namespace NzbDrone.Core.Test
|
||||||
Assert.AreEqual(LogLevel.Error.Name, logItem.Level);
|
Assert.AreEqual(LogLevel.Error.Name, logItem.Level);
|
||||||
Assert.AreEqual(ex.GetType().ToString(), logItem.ExceptionType);
|
Assert.AreEqual(ex.GetType().ToString(), logItem.ExceptionType);
|
||||||
Assert.AreEqual(ex.ToString(), logItem.Exception);
|
Assert.AreEqual(ex.ToString(), logItem.Exception);
|
||||||
|
ExceptionVerification.ExcpectedErrors(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,13 +3,17 @@ using AutoMoq;
|
||||||
using MbUnit.Framework;
|
using MbUnit.Framework;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
using NzbDrone.Core.Repository;
|
using NzbDrone.Core.Repository;
|
||||||
|
using NzbDrone.Core.Test.Framework;
|
||||||
using SubSonic.Repository;
|
using SubSonic.Repository;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test
|
namespace NzbDrone.Core.Test
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class RootDirProviderTest
|
// ReSharper disable InconsistentNaming
|
||||||
|
public class RootDirProviderTest : TestBase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetRootDirs()
|
public void GetRootDirs()
|
||||||
{
|
{
|
||||||
|
@ -38,7 +42,7 @@ namespace NzbDrone.Core.Test
|
||||||
var mocker = new AutoMoqer();
|
var mocker = new AutoMoqer();
|
||||||
mocker.SetConstant(MockLib.GetEmptyRepository());
|
mocker.SetConstant(MockLib.GetEmptyRepository());
|
||||||
|
|
||||||
string path = @"C:\TV\";
|
const string path = @"C:\TV\";
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
var rootDirProvider = mocker.Resolve<RootDirProvider>();
|
var rootDirProvider = mocker.Resolve<RootDirProvider>();
|
||||||
|
@ -59,7 +63,7 @@ namespace NzbDrone.Core.Test
|
||||||
var mocker = new AutoMoqer();
|
var mocker = new AutoMoqer();
|
||||||
mocker.SetConstant(MockLib.GetEmptyRepository());
|
mocker.SetConstant(MockLib.GetEmptyRepository());
|
||||||
|
|
||||||
string path = @"C:\TV2";
|
const string path = @"C:\TV2";
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
var rootDirProvider = mocker.Resolve<RootDirProvider>();
|
var rootDirProvider = mocker.Resolve<RootDirProvider>();
|
||||||
|
@ -80,8 +84,6 @@ namespace NzbDrone.Core.Test
|
||||||
var mocker = new AutoMoqer();
|
var mocker = new AutoMoqer();
|
||||||
mocker.SetConstant(MockLib.GetEmptyRepository());
|
mocker.SetConstant(MockLib.GetEmptyRepository());
|
||||||
|
|
||||||
string path = @"C:\TV2";
|
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
var rootDirProvider = mocker.Resolve<RootDirProvider>();
|
var rootDirProvider = mocker.Resolve<RootDirProvider>();
|
||||||
rootDirProvider.Add(new RootDir {Path = @"C:\TV"});
|
rootDirProvider.Add(new RootDir {Path = @"C:\TV"});
|
||||||
|
@ -99,8 +101,8 @@ namespace NzbDrone.Core.Test
|
||||||
var mocker = new AutoMoqer();
|
var mocker = new AutoMoqer();
|
||||||
mocker.SetConstant(MockLib.GetEmptyRepository());
|
mocker.SetConstant(MockLib.GetEmptyRepository());
|
||||||
|
|
||||||
int id = 1;
|
const int id = 1;
|
||||||
string path = @"C:\TV";
|
const string path = @"C:\TV";
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
var rootDirProvider = mocker.Resolve<RootDirProvider>();
|
var rootDirProvider = mocker.Resolve<RootDirProvider>();
|
||||||
|
|
|
@ -7,26 +7,26 @@ using Moq;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
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.Quality;
|
using NzbDrone.Core.Repository.Quality;
|
||||||
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test
|
namespace NzbDrone.Core.Test
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
public class SabControllerTest
|
public class SabProviderTest : TestBase
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void AddByUrlSuccess()
|
public void AddByUrlSuccess()
|
||||||
{
|
{
|
||||||
//Setup
|
//Setup
|
||||||
string sabHost = "192.168.5.55";
|
const string sabHost = "192.168.5.55";
|
||||||
int sabPort = 2222;
|
const int sabPort = 2222;
|
||||||
string apikey = "5c770e3197e4fe763423ee7c392c25d1";
|
const string apikey = "5c770e3197e4fe763423ee7c392c25d1";
|
||||||
string username = "admin";
|
const string username = "admin";
|
||||||
string password = "pass";
|
const string password = "pass";
|
||||||
var priority = SabnzbdPriorityType.Normal;
|
const SabnzbdPriorityType priority = SabnzbdPriorityType.Normal;
|
||||||
string category = "tv";
|
const string category = "tv";
|
||||||
|
|
||||||
|
|
||||||
var mocker = new AutoMoqer();
|
var mocker = new AutoMoqer();
|
||||||
|
@ -101,6 +101,7 @@ namespace NzbDrone.Core.Test
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
Assert.IsFalse(result);
|
Assert.IsFalse(result);
|
||||||
|
ExceptionVerification.ExcpectedWarns(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
Binary file not shown.
|
@ -4,17 +4,18 @@ using MbUnit.Framework;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test
|
namespace NzbDrone.Core.Test
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
public class SyncProviderTest
|
public class SyncProviderTest : TestBase
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void None_existing_folder_returns_empty_list()
|
public void None_existing_folder_returns_empty_list()
|
||||||
{
|
{
|
||||||
string path = "d:\\bad folder";
|
const string path = "d:\\bad folder";
|
||||||
|
|
||||||
var mocker = new AutoMoqer();
|
var mocker = new AutoMoqer();
|
||||||
mocker.GetMock<DiskProvider>(MockBehavior.Strict)
|
mocker.GetMock<DiskProvider>(MockBehavior.Strict)
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
using System;
|
using System;
|
||||||
using MbUnit.Framework;
|
using MbUnit.Framework;
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test
|
namespace NzbDrone.Core.Test
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
public class TvDbControllerTest
|
public class TvDbProviderTest : TestBase
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
[Row("The Simpsons")]
|
[Row("The Simpsons")]
|
|
@ -1,6 +1,6 @@
|
||||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autoReload="true">
|
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autoReload="true">
|
||||||
<targets>
|
<targets>
|
||||||
<target name="consoleTarget" xsi:type="ColoredConsole" layout="${logger}: ${message} ${exception:ToString}" />
|
<target name="consoleTarget" xsi:type="ColoredConsole" layout="[${level}] ${logger}: ${message} ${exception:ToString}" />
|
||||||
<target name="udpTarget" xsi:type="Chainsaw" address="udp://127.0.0.1:20480"
|
<target name="udpTarget" xsi:type="Chainsaw" address="udp://127.0.0.1:20480"
|
||||||
includeCallSite="true" includeSourceInfo="true" includeNLogData="true" includeNDC="true" includeMDC="true">
|
includeCallSite="true" includeSourceInfo="true" includeNLogData="true" includeNDC="true" includeMDC="true">
|
||||||
<parameter name="exception" layout="${exception:format=ToString}" xsi:type="NLogViewerParameterInfo" />
|
<parameter name="exception" layout="${exception:format=ToString}" xsi:type="NLogViewerParameterInfo" />
|
||||||
|
|
|
@ -27,10 +27,10 @@ namespace NzbDrone.Core.Model
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
if (Episodes == null)
|
if (Episodes == null)
|
||||||
return string.Format("Series:{0} Air Date:{1}", CleanTitle, AirDate.Date);
|
return string.Format("{0} - {1}", CleanTitle, AirDate.Date);
|
||||||
|
|
||||||
return string.Format("Series:{0} Season:{1} Episode:{2}", CleanTitle, SeasonNumber,
|
return string.Format("{0} - S{1:00}E{2}", CleanTitle, SeasonNumber,
|
||||||
String.Join(",", Episodes));
|
String.Join("-", Episodes));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,7 +184,7 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||||
IsProper = parseResult.Proper,
|
IsProper = parseResult.Proper,
|
||||||
NzbTitle = feedItem.Title.Text,
|
NzbTitle = feedItem.Title.Text,
|
||||||
Quality = parseResult.Quality,
|
Quality = parseResult.Quality,
|
||||||
Indexer = GetIndexerType()
|
Indexer = Name
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,15 +247,6 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||||
/// <returns>Download link URL</returns>
|
/// <returns>Download link URL</returns>
|
||||||
protected abstract string NzbDownloadUrl(SyndicationItem item);
|
protected abstract string NzbDownloadUrl(SyndicationItem item);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets he IndexerType Enum for this indexer
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>IndexerType Enum</returns>
|
|
||||||
protected virtual IndexerType GetIndexerType()
|
|
||||||
{
|
|
||||||
return IndexerType.Unknown;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool InHistory(IList<Episode> episodes, EpisodeParseResult parseResult, SyndicationItem feedItem)
|
private bool InHistory(IList<Episode> episodes, EpisodeParseResult parseResult, SyndicationItem feedItem)
|
||||||
{
|
{
|
||||||
foreach (var episode in episodes)
|
foreach (var episode in episodes)
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.ServiceModel.Syndication;
|
using System.ServiceModel.Syndication;
|
||||||
using System.Web;
|
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.Providers.ExternalNotification;
|
using NzbDrone.Core.Providers.ExternalNotification;
|
||||||
using SubSonic.Repository;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Providers.Indexer
|
namespace NzbDrone.Core.Providers.Indexer
|
||||||
{
|
{
|
||||||
|
@ -50,7 +47,7 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||||
|
|
||||||
protected override string NzbDownloadUrl(SyndicationItem item)
|
protected override string NzbDownloadUrl(SyndicationItem item)
|
||||||
{
|
{
|
||||||
return item.Id;
|
return item.Id + "/nzb";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override EpisodeParseResult CustomParser(SyndicationItem item, EpisodeParseResult currentResult)
|
protected override EpisodeParseResult CustomParser(SyndicationItem item, EpisodeParseResult currentResult)
|
||||||
|
@ -64,9 +61,5 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||||
return currentResult;
|
return currentResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IndexerType GetIndexerType()
|
|
||||||
{
|
|
||||||
return IndexerType.Newzbin;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -50,9 +50,5 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||||
return item.Links[0].Uri.ToString();
|
return item.Links[0].Uri.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IndexerType GetIndexerType()
|
|
||||||
{
|
|
||||||
return IndexerType.NzbMatrix;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -46,9 +46,5 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||||
return item.Id;
|
return item.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IndexerType GetIndexerType()
|
|
||||||
{
|
|
||||||
return IndexerType.NzbsOrg;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -49,9 +49,5 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||||
return item.Links[0].Uri.ToString();
|
return item.Links[0].Uri.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IndexerType GetIndexerType()
|
|
||||||
{
|
|
||||||
return IndexerType.NzbsRus;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -130,7 +130,7 @@ namespace NzbDrone.Core.Providers.Jobs
|
||||||
{
|
{
|
||||||
if (_isRunning)
|
if (_isRunning)
|
||||||
{
|
{
|
||||||
Logger.Trace("Queue is already running. Ignoreing request.");
|
Logger.Trace("Queue is already running. Ignoring request.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ namespace NzbDrone.Core.Providers.Jobs
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Logger.FatalException("An error has occured while processing queued job.", e);
|
Logger.FatalException("An error has occurred while processing queued job.", e);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,6 +72,7 @@ namespace NzbDrone.Core.Providers
|
||||||
if (!_repository.Exists<EpisodeFile>(e => e.Path == Parser.NormalizePath(filePath)))
|
if (!_repository.Exists<EpisodeFile>(e => e.Path == Parser.NormalizePath(filePath)))
|
||||||
{
|
{
|
||||||
var parseResult = Parser.ParseEpisodeInfo(filePath);
|
var parseResult = Parser.ParseEpisodeInfo(filePath);
|
||||||
|
parseResult.CleanTitle = series.Title;//replaces the nasty path as title to help with logging
|
||||||
|
|
||||||
if (parseResult == null)
|
if (parseResult == null)
|
||||||
return null;
|
return null;
|
||||||
|
@ -90,7 +91,7 @@ namespace NzbDrone.Core.Providers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger.Warn("Unable to find '{0}' in the database. File:{1}", parseResult, filePath);
|
Logger.Warn("Unable to find [{0}] in the database.[{1}]", parseResult, filePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -106,7 +107,7 @@ namespace NzbDrone.Core.Providers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger.Warn("Unable to find '{0}' in the database. File:{1}", parseResult, filePath);
|
Logger.Warn("Unable to find [{0}] in the database.[{1}]", parseResult, filePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace NzbDrone.Core.Repository
|
||||||
public QualityTypes Quality { get; set; }
|
public QualityTypes Quality { get; set; }
|
||||||
public DateTime Date { get; set; }
|
public DateTime Date { get; set; }
|
||||||
public bool IsProper { get; set; }
|
public bool IsProper { get; set; }
|
||||||
public IndexerType? Indexer { get; set; }
|
public string Indexer { get; set; }
|
||||||
|
|
||||||
[SubSonicToOneRelation(ThisClassContainsJoinKey = true)]
|
[SubSonicToOneRelation(ThisClassContainsJoinKey = true)]
|
||||||
public virtual Episode Episode { get; protected set; }
|
public virtual Episode Episode { get; protected set; }
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
|
||||||
|
namespace NzbDrone.Web.Controllers
|
||||||
|
{
|
||||||
|
public class HealthController : Controller
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// GET: /Health/
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public JsonResult Index()
|
||||||
|
{
|
||||||
|
return Json("OK", JsonRequestBehavior.AllowGet);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -56,7 +56,7 @@ namespace NzbDrone.Web.Controllers
|
||||||
Quality = h.Quality.ToString(),
|
Quality = h.Quality.ToString(),
|
||||||
IsProper = h.IsProper,
|
IsProper = h.IsProper,
|
||||||
Date = h.Date,
|
Date = h.Date,
|
||||||
Indexer = String.IsNullOrEmpty(h.Indexer.ToString()) ? "Unknown" : h.Indexer.ToString()
|
Indexer = h.Indexer
|
||||||
});
|
});
|
||||||
|
|
||||||
return View(new GridModel(history));
|
return View(new GridModel(history));
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
using System;
|
using System.Web.Mvc;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
using System.Web.Mvc;
|
|
||||||
using NzbDrone.Core.Providers;
|
using NzbDrone.Core.Providers;
|
||||||
using NzbDrone.Core.Providers.Core;
|
using NzbDrone.Core.Providers.Core;
|
||||||
using NzbDrone.Core.Providers.Jobs;
|
using NzbDrone.Core.Providers.Jobs;
|
||||||
|
|
|
@ -214,6 +214,7 @@
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<DependentUpon>UploadLocalization.en-US.resx</DependentUpon>
|
<DependentUpon>UploadLocalization.en-US.resx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Controllers\HealthController.cs" />
|
||||||
<Compile Include="Controllers\HistoryController.cs" />
|
<Compile Include="Controllers\HistoryController.cs" />
|
||||||
<Compile Include="Controllers\LogController.cs" />
|
<Compile Include="Controllers\LogController.cs" />
|
||||||
<Compile Include="Controllers\AddSeriesController.cs" />
|
<Compile Include="Controllers\AddSeriesController.cs" />
|
||||||
|
@ -572,12 +573,21 @@
|
||||||
<Content Include="Content\Images\img02.jpg" />
|
<Content Include="Content\Images\img02.jpg" />
|
||||||
<Content Include="Content\Images\img03.jpg" />
|
<Content Include="Content\Images\img03.jpg" />
|
||||||
<Content Include="Content\Images\img07.jpg" />
|
<Content Include="Content\Images\img07.jpg" />
|
||||||
<Content Include="Content\Images\Indexers\Newzbin.png" />
|
<Content Include="Content\Images\Indexers\Newzbin.png">
|
||||||
<Content Include="Content\Images\Indexers\NzbMatrix.png" />
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<Content Include="Content\Images\Indexers\NzbsOrg.png" />
|
</Content>
|
||||||
<Content Include="Content\Images\Indexers\NzbsRus.png" />
|
<Content Include="Content\Images\Indexers\NzbMatrix.png">
|
||||||
<Content Include="Content\Images\Indexers\Unknown.png" />
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
<Content Include="Content\Images\Loading.gif" />
|
</Content>
|
||||||
|
<Content Include="Content\Images\Indexers\NzbsOrg.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="Content\Images\Indexers\NzbsRus.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="Content\Images\Indexers\Unknown.png">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="Content\Images\Plus.png" />
|
<Content Include="Content\Images\Plus.png" />
|
||||||
<Content Include="Content\Images\spin.gif" />
|
<Content Include="Content\Images\spin.gif" />
|
||||||
<Content Include="Content\Images\ui-bg_diagonals-small_0_aaaaaa_40x40.png" />
|
<Content Include="Content\Images\ui-bg_diagonals-small_0_aaaaaa_40x40.png" />
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/// <reference path="jquery-1.5.2-vsdoc.js" />
|
/// <reference path="jquery-1.5.2-vsdoc.js" />
|
||||||
$(function () {
|
$(document).ready(function ()
|
||||||
|
{
|
||||||
var speed = 0;
|
var speed = 0;
|
||||||
var isShown = false;
|
var isShown = false;
|
||||||
refreshNotifications();
|
refreshNotifications();
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
|
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
|
||||||
</DbProviderFactories>
|
</DbProviderFactories>
|
||||||
</system.data>
|
</system.data>
|
||||||
<glimpse on="true" saveRequestCount="5">
|
<glimpse on="false" saveRequestCount="5">
|
||||||
<ipAddresses>
|
<ipAddresses>
|
||||||
<add address="0.0.0.0" />
|
<add address="0.0.0.0" />
|
||||||
<!--IPv4-->
|
<!--IPv4-->
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Runtime.Remoting;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using System.Xml.XPath;
|
using System.Xml.XPath;
|
||||||
|
@ -70,8 +71,8 @@ namespace NzbDrone
|
||||||
IISProcess.BeginOutputReadLine();
|
IISProcess.BeginOutputReadLine();
|
||||||
|
|
||||||
//Start Ping
|
//Start Ping
|
||||||
_pingTimer = new Timer(10000) { AutoReset = true };
|
_pingTimer = new Timer(30000) { AutoReset = true };
|
||||||
_pingTimer.Elapsed += (Server);
|
_pingTimer.Elapsed += (PingServer);
|
||||||
_pingTimer.Start();
|
_pingTimer.Start();
|
||||||
|
|
||||||
return IISProcess;
|
return IISProcess;
|
||||||
|
@ -114,11 +115,16 @@ namespace NzbDrone
|
||||||
StartServer();
|
StartServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Server(object sender, ElapsedEventArgs e)
|
private static void PingServer(object sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
new WebClient().DownloadString(AppUrl);
|
var response = new WebClient().DownloadString(AppUrl + "/health");
|
||||||
|
|
||||||
|
if (!response.Contains("OK"))
|
||||||
|
{
|
||||||
|
throw new ServerException("Health services responded with an invalid response.");
|
||||||
|
}
|
||||||
if (_pingFailCounter > 0)
|
if (_pingFailCounter > 0)
|
||||||
{
|
{
|
||||||
Logger.Info("Application pool has been successfully recovered.");
|
Logger.Info("Application pool has been successfully recovered.");
|
||||||
|
|
Loading…
Reference in New Issue