1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-10-30 23:42:33 +01:00
Sonarr/NzbDrone.Integration.Test/IntegrationTest.cs

76 lines
2.4 KiB
C#
Raw Normal View History

2013-09-13 00:42:01 +02:00
using NLog;
2013-08-14 07:02:25 +02:00
using NLog.Config;
using NLog.Targets;
using NUnit.Framework;
using NzbDrone.Api.Commands;
using NzbDrone.Api.Config;
2013-09-10 07:39:18 +02:00
using NzbDrone.Api.History;
using NzbDrone.Api.RootFolders;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Integration.Test.Client;
2013-05-22 07:32:25 +02:00
using NzbDrone.Test.Common.Categories;
using RestSharp;
namespace NzbDrone.Integration.Test
{
[TestFixture]
2013-05-22 07:32:25 +02:00
[IntegrationTest]
public abstract class IntegrationTest
{
protected RestClient RestClient { get; private set; }
protected SeriesClient Series;
protected ClientBase<RootFolderResource> RootFolders;
protected ClientBase<CommandResource> Commands;
protected ReleaseClient Releases;
2013-09-10 07:39:18 +02:00
protected ClientBase<HistoryResource> History;
2013-05-03 07:24:52 +02:00
protected IndexerClient Indexers;
protected EpisodeClient Episodes;
protected ClientBase<NamingConfigResource> NamingConfig;
2013-08-14 05:22:28 +02:00
private NzbDroneRunner _runner;
2013-08-14 07:02:25 +02:00
public IntegrationTest()
{
new StartupArguments();
LogManager.Configuration = new LoggingConfiguration();
var consoleTarget = new ConsoleTarget { Layout = "${level}: ${message} ${exception}" };
LogManager.Configuration.AddTarget(consoleTarget.GetType().Name, consoleTarget);
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, consoleTarget));
}
2013-09-01 02:30:35 +02:00
//[TestFixtureSetUp]
[SetUp]
public void SmokeTestSetup()
{
2013-08-14 05:22:28 +02:00
_runner = new NzbDroneRunner();
_runner.KillAll();
InitRestClients();
2013-08-14 05:22:28 +02:00
_runner.Start();
}
private void InitRestClients()
{
RestClient = new RestClient("http://localhost:8989/api");
Series = new SeriesClient(RestClient);
Releases = new ReleaseClient(RestClient);
RootFolders = new ClientBase<RootFolderResource>(RestClient);
Commands = new ClientBase<CommandResource>(RestClient);
2013-09-10 07:39:18 +02:00
History = new ClientBase<HistoryResource>(RestClient);
2013-05-03 07:24:52 +02:00
Indexers = new IndexerClient(RestClient);
Episodes = new EpisodeClient(RestClient);
NamingConfig = new ClientBase<NamingConfigResource>(RestClient, "config/naming");
}
2013-09-01 02:30:35 +02:00
//[TestFixtureTearDown]
[TearDown]
public void SmokeTestTearDown()
{
2013-08-14 05:22:28 +02:00
_runner.KillAll();
}
}
}