2014-12-02 20:08:37 +00:00
|
|
|
using System;
|
|
|
|
using FluentMigrator;
|
|
|
|
using NUnit.Framework;
|
|
|
|
using NzbDrone.Core.Datastore;
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Test.Framework
|
|
|
|
{
|
|
|
|
[Category("DbMigrationTest")]
|
|
|
|
[Category("DbTest")]
|
|
|
|
public abstract class MigrationTest<TMigration> : DbTest where TMigration : MigrationBase
|
|
|
|
{
|
|
|
|
protected override TestDatabase WithTestDb(Action<MigrationBase> beforeMigration)
|
|
|
|
{
|
2015-05-03 23:30:16 +00:00
|
|
|
return base.WithTestDb(m =>
|
2014-12-02 20:08:37 +00:00
|
|
|
{
|
|
|
|
if (m.GetType() == typeof(TMigration))
|
|
|
|
{
|
|
|
|
beforeMigration(m);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
[SetUp]
|
|
|
|
public override void SetupDb()
|
|
|
|
{
|
|
|
|
SetupContainer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|