mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-20 21:54:25 -04:00
Fixed some tests.
This commit is contained in:
@@ -88,9 +88,31 @@ namespace NzbDrone.Core.Test.Framework
|
||||
protected virtual TestDatabase WithTestDb(Action<MigrationBase> beforeMigration)
|
||||
{
|
||||
var factory = Mocker.Resolve<DbFactory>();
|
||||
var database = factory.Create(MigrationType);
|
||||
var database = factory.Create(MigrationType, beforeMigration);
|
||||
Mocker.SetConstant(database);
|
||||
|
||||
switch (MigrationType)
|
||||
{
|
||||
case MigrationType.Main:
|
||||
{
|
||||
var mainDb = new MainDatabase(database);
|
||||
|
||||
Mocker.SetConstant<IMainDatabase>(mainDb);
|
||||
break;
|
||||
}
|
||||
case MigrationType.Log:
|
||||
{
|
||||
var logDb = new LogDatabase(database);
|
||||
|
||||
Mocker.SetConstant<ILogDatabase>(logDb);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
throw new ArgumentException("Invalid MigrationType");
|
||||
}
|
||||
}
|
||||
|
||||
var testDb = new TestDatabase(database);
|
||||
|
||||
return testDb;
|
||||
|
||||
Reference in New Issue
Block a user