Fixed some tests.

This commit is contained in:
Taloth Saldono
2015-05-04 01:30:16 +02:00
parent 2a83088045
commit c08d8252ff
4 changed files with 35 additions and 10 deletions
+23 -1
View File
@@ -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;