mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
cleaned up CoreTest base class.
This commit is contained in:
parent
77bb790672
commit
64a3e1caf0
12 changed files with 154 additions and 170 deletions
|
@ -16,44 +16,6 @@ namespace NzbDrone.Core.Test.Framework
|
|||
{
|
||||
internal static class TestDbHelper
|
||||
{
|
||||
private static readonly string dbTemplateName;
|
||||
|
||||
static TestDbHelper()
|
||||
{
|
||||
dbTemplateName = Path.Combine(Path.GetTempPath(), Path.GetTempFileName()) + ".sdf";
|
||||
}
|
||||
|
||||
internal static string ConnectionString { get; private set; }
|
||||
|
||||
internal static IDatabase GetEmptyDatabase(string fileName = "")
|
||||
{
|
||||
Console.WriteLine("====================DataBase====================");
|
||||
Console.WriteLine("Cloning database from template.");
|
||||
|
||||
if (String.IsNullOrWhiteSpace(fileName))
|
||||
{
|
||||
fileName = Guid.NewGuid() + ".sdf";
|
||||
}
|
||||
|
||||
File.Copy(dbTemplateName, fileName);
|
||||
|
||||
ConnectionString = ConnectionFactory.GetConnectionString(fileName);
|
||||
|
||||
var database = ConnectionFactory.GetPetaPocoDb(ConnectionString);
|
||||
|
||||
Console.WriteLine("====================DataBase====================");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine();
|
||||
|
||||
return database;
|
||||
}
|
||||
|
||||
internal static void CreateDataBaseTemplate()
|
||||
{
|
||||
Console.WriteLine("Creating an empty PetaPoco database");
|
||||
var connectionString = ConnectionFactory.GetConnectionString(dbTemplateName);
|
||||
var database = ConnectionFactory.GetPetaPocoDb(connectionString);
|
||||
database.Dispose();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue