mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
cleaned up test db path for tests.
This commit is contained in:
parent
02c175950b
commit
dde91569ac
15 changed files with 123 additions and 133 deletions
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using Moq;
|
||||
using NLog;
|
||||
using NLog.Config;
|
||||
|
@ -9,7 +7,6 @@ using NUnit.Framework;
|
|||
using NzbDrone.Api;
|
||||
using NzbDrone.Api.Commands;
|
||||
using NzbDrone.Api.RootFolders;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Composition;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Core.Configuration;
|
||||
|
@ -56,36 +53,14 @@ namespace NzbDrone.Integration.Test
|
|||
LogManager.ReconfigExistingLoggers();
|
||||
}
|
||||
|
||||
private void InitDatabase()
|
||||
{
|
||||
Logger.Info("Registering Database...");
|
||||
|
||||
//TODO: move this to factory
|
||||
var IAppDirectoryInfo = new AppDirectoryInfo();
|
||||
var appDataPath = IAppDirectoryInfo.GetAppDataPath();
|
||||
|
||||
if (!Directory.Exists(appDataPath))
|
||||
{
|
||||
Directory.CreateDirectory(appDataPath);
|
||||
}
|
||||
|
||||
var dbPath = Path.Combine(IAppDirectoryInfo.WorkingDirectory, DateTime.Now.Ticks + ".db");
|
||||
|
||||
|
||||
Logger.Info("Working Folder: {0}", IAppDirectoryInfo.WorkingDirectory);
|
||||
Logger.Info("Data Folder: {0}", IAppDirectoryInfo.GetAppDataPath());
|
||||
Logger.Info("DB Na: {0}", dbPath);
|
||||
|
||||
|
||||
Container.Register(c => c.Resolve<IDbFactory>().Create(dbPath));
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public void SmokeTestSetup()
|
||||
{
|
||||
Container = MainAppContainerBuilder.BuildContainer();
|
||||
Container.Register(typeof(IAppDirectoryInfo), new IntegrationTestDirectoryInfo());
|
||||
|
||||
InitDatabase();
|
||||
DbFactory.RegisterDatabase(Container);
|
||||
|
||||
var taskManagerMock = new Mock<ITaskManager>();
|
||||
taskManagerMock.Setup(c => c.GetPending()).Returns(new List<ScheduledTask>());
|
||||
|
|
26
NzbDrone.Integration.Test/IntegrationTestDirectoryInfo.cs
Normal file
26
NzbDrone.Integration.Test/IntegrationTestDirectoryInfo.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
|
||||
namespace NzbDrone.Integration.Test
|
||||
{
|
||||
public class IntegrationTestDirectoryInfo : IAppDirectoryInfo
|
||||
{
|
||||
public IntegrationTestDirectoryInfo()
|
||||
{
|
||||
SystemTemp = Path.GetTempPath();
|
||||
WorkingDirectory = Path.Combine(Directory.GetCurrentDirectory(), "integ_test", DateTime.Now.Ticks.ToString());
|
||||
|
||||
if (!Directory.Exists(WorkingDirectory))
|
||||
{
|
||||
Directory.CreateDirectory(WorkingDirectory);
|
||||
}
|
||||
|
||||
StartUpPath = Directory.GetCurrentDirectory();
|
||||
}
|
||||
|
||||
public string WorkingDirectory { get; private set; }
|
||||
public string SystemTemp { get; private set; }
|
||||
public string StartUpPath { get; private set; }
|
||||
}
|
||||
}
|
|
@ -90,6 +90,7 @@
|
|||
<Compile Include="Client\SeriesClient.cs" />
|
||||
<Compile Include="CommandIntegerationTests.cs" />
|
||||
<Compile Include="IndexerIntegrationFixture.cs" />
|
||||
<Compile Include="IntegrationTestDirectoryInfo.cs" />
|
||||
<Compile Include="QualityProfileIntegrationTest.cs" />
|
||||
<Compile Include="ReleaseIntegrationTest.cs" />
|
||||
<Compile Include="IntegrationTest.cs" />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue