don't log migrations during regular DB tests

This commit is contained in:
Keivan Beigi 2017-01-20 20:33:10 -08:00
parent d5e720c404
commit f25bfe9d28
No known key found for this signature in database
GPG Key ID: C536675AC49003C0
3 changed files with 3 additions and 7 deletions

View File

@ -99,7 +99,6 @@ namespace NzbDrone.Core.Test.Framework
{ {
WithTempAsAppPath(); WithTempAsAppPath();
Mocker.SetConstant<IAnnouncer>(Mocker.Resolve<MigrationLogger>());
Mocker.SetConstant<IConnectionStringFactory>(Mocker.Resolve<ConnectionStringFactory>()); Mocker.SetConstant<IConnectionStringFactory>(Mocker.Resolve<ConnectionStringFactory>());
Mocker.SetConstant<IMigrationController>(Mocker.Resolve<MigrationController>()); Mocker.SetConstant<IMigrationController>(Mocker.Resolve<MigrationController>());

View File

@ -1,8 +1,8 @@
using System; using System;
using FluentMigrator; using FluentMigrator;
using FluentMigrator.Runner;
using NUnit.Framework; using NUnit.Framework;
using NzbDrone.Core.Datastore.Migration.Framework; using NzbDrone.Core.Datastore.Migration.Framework;
using NzbDrone.Test.Common.AutoMoq;
namespace NzbDrone.Core.Test.Framework namespace NzbDrone.Core.Test.Framework
{ {
@ -26,7 +26,7 @@ namespace NzbDrone.Core.Test.Framework
BeforeMigration = m => BeforeMigration = m =>
{ {
var migration = m as TMigration; var migration = m as TMigration;
if (beforeMigration != null && migration is TMigration) if (beforeMigration != null && migration != null)
{ {
beforeMigration(migration); beforeMigration(migration);
} }
@ -39,10 +39,8 @@ namespace NzbDrone.Core.Test.Framework
[SetUp] [SetUp]
public override void SetupDb() public override void SetupDb()
{ {
Mocker.SetConstant<IAnnouncer>(Mocker.Resolve<MigrationLogger>());
SetupContainer(); SetupContainer();
} }
[Obsolete("Don't use Mocker/Repositories in MigrationTests, query the DB.", true)]
public new AutoMoqer Mocker => base.Mocker;
} }
} }

View File

@ -46,7 +46,6 @@ namespace NzbDrone.Core.Datastore.Migration.Framework
public override void Up() public override void Up()
{ {
if (Context.BeforeMigration != null) if (Context.BeforeMigration != null)
{ {
Context.BeforeMigration(this); Context.BeforeMigration(this);