diff --git a/src/NzbDrone.Common.Test/NzbDrone.Common.Test.csproj b/src/NzbDrone.Common.Test/NzbDrone.Common.Test.csproj
index 9fec6430b..9d776b218 100644
--- a/src/NzbDrone.Common.Test/NzbDrone.Common.Test.csproj
+++ b/src/NzbDrone.Common.Test/NzbDrone.Common.Test.csproj
@@ -111,6 +111,14 @@
{95C11A9E-56ED-456A-8447-2C89C1139266}
NzbDrone.Host
+
+ {15ad7579-a314-4626-b556-663f51d97cd1}
+ NzbDrone.Mono
+
+
+ {911284d3-f130-459e-836c-2430b6fbf21d}
+ NzbDrone.Windows
+
{D12F7F2F-8A3C-415F-88FA-6DD061A84869}
NzbDrone
diff --git a/src/NzbDrone.Common.Test/ServiceFactoryFixture.cs b/src/NzbDrone.Common.Test/ServiceFactoryFixture.cs
index aad41fca2..95b5027ff 100644
--- a/src/NzbDrone.Common.Test/ServiceFactoryFixture.cs
+++ b/src/NzbDrone.Common.Test/ServiceFactoryFixture.cs
@@ -2,6 +2,7 @@
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Common.EnvironmentInfo;
+using NzbDrone.Core.Datastore;
using NzbDrone.Core.Lifecycle;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Host;
@@ -16,11 +17,12 @@ namespace NzbDrone.Common.Test
public void event_handlers_should_be_unique()
{
var container = MainAppContainerBuilder.BuildContainer(new StartupContext());
+ container.Register(new MainDatabase(null));
container.Resolve().Register();
Mocker.SetConstant(container);
- var handlers = Subject.BuildAll>()
+ var handlers = Subject.BuildAll>()
.Select(c => c.GetType().FullName);
handlers.Should().OnlyHaveUniqueItems();
diff --git a/src/NzbDrone.Core.Test/Framework/DbTest.cs b/src/NzbDrone.Core.Test/Framework/DbTest.cs
index 3e81b68ad..3e6eb8f43 100644
--- a/src/NzbDrone.Core.Test/Framework/DbTest.cs
+++ b/src/NzbDrone.Core.Test/Framework/DbTest.cs
@@ -88,9 +88,31 @@ namespace NzbDrone.Core.Test.Framework
protected virtual TestDatabase WithTestDb(Action beforeMigration)
{
var factory = Mocker.Resolve();
- 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(mainDb);
+ break;
+ }
+ case MigrationType.Log:
+ {
+ var logDb = new LogDatabase(database);
+
+ Mocker.SetConstant(logDb);
+ break;
+ }
+ default:
+ {
+ throw new ArgumentException("Invalid MigrationType");
+ }
+ }
+
var testDb = new TestDatabase(database);
return testDb;
diff --git a/src/NzbDrone.Core.Test/Framework/MigrationTest.cs b/src/NzbDrone.Core.Test/Framework/MigrationTest.cs
index 137f41983..fd610c693 100644
--- a/src/NzbDrone.Core.Test/Framework/MigrationTest.cs
+++ b/src/NzbDrone.Core.Test/Framework/MigrationTest.cs
@@ -11,20 +11,13 @@ namespace NzbDrone.Core.Test.Framework
{
protected override TestDatabase WithTestDb(Action beforeMigration)
{
- var factory = Mocker.Resolve();
-
- var database = factory.Create(MigrationType, m =>
+ return base.WithTestDb(m =>
{
if (m.GetType() == typeof(TMigration))
{
beforeMigration(m);
}
});
-
- var testDb = new TestDatabase(database);
- Mocker.SetConstant(database);
-
- return testDb;
}
[SetUp]