Fixes up inheritance structure of BaseTableByTableTests
This commit is contained in:
@@ -1,6 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Models.Rdbms;
|
||||
using Umbraco.Core.ObjectResolution;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
using Umbraco.Core.Persistence.UnitOfWork;
|
||||
using Umbraco.Core.Publishing;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
|
||||
namespace Umbraco.Tests.Persistence
|
||||
{
|
||||
@@ -8,10 +17,37 @@ namespace Umbraco.Tests.Persistence
|
||||
public abstract class BaseTableByTableTest
|
||||
{
|
||||
[SetUp]
|
||||
public abstract void Initialize();
|
||||
public virtual void Initialize()
|
||||
{
|
||||
TestHelper.SetupLog4NetForTests();
|
||||
TestHelper.InitializeContentDirectories();
|
||||
|
||||
string path = TestHelper.CurrentAssemblyDirectory;
|
||||
AppDomain.CurrentDomain.SetData("DataDirectory", path);
|
||||
|
||||
RepositoryResolver.Current = new RepositoryResolver(
|
||||
new RepositoryFactory());
|
||||
|
||||
ApplicationContext.Current = new ApplicationContext(
|
||||
//assign the db context
|
||||
new DatabaseContext(new DefaultDatabaseFactory()),
|
||||
//assign the service context
|
||||
new ServiceContext(new PetaPocoUnitOfWorkProvider(), new FileUnitOfWorkProvider(), new PublishingStrategy())) { IsReady = true };
|
||||
|
||||
Resolution.Freeze();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
public abstract void TearDown();
|
||||
public virtual void TearDown()
|
||||
{
|
||||
SqlSyntaxContext.SqlSyntaxProvider = null;
|
||||
AppDomain.CurrentDomain.SetData("DataDirectory", null);
|
||||
|
||||
//reset the app context
|
||||
ApplicationContext.Current = null;
|
||||
|
||||
RepositoryResolver.Reset();
|
||||
}
|
||||
|
||||
public abstract Database Database { get; }
|
||||
|
||||
|
||||
@@ -22,21 +22,7 @@ namespace Umbraco.Tests.Persistence
|
||||
[SetUp]
|
||||
public override void Initialize()
|
||||
{
|
||||
TestHelper.SetupLog4NetForTests();
|
||||
TestHelper.InitializeContentDirectories();
|
||||
|
||||
string path = TestHelper.CurrentAssemblyDirectory;
|
||||
AppDomain.CurrentDomain.SetData("DataDirectory", path);
|
||||
|
||||
RepositoryResolver.Current = new RepositoryResolver(
|
||||
new RepositoryFactory());
|
||||
|
||||
Resolution.Freeze();
|
||||
ApplicationContext.Current = new ApplicationContext(
|
||||
//assign the db context
|
||||
new DatabaseContext(new DefaultDatabaseFactory()),
|
||||
//assign the service context
|
||||
new ServiceContext(new PetaPocoUnitOfWorkProvider(), new FileUnitOfWorkProvider(), new PublishingStrategy())) { IsReady = true };
|
||||
base.Initialize();
|
||||
|
||||
SqlSyntaxContext.SqlSyntaxProvider = MySqlSyntax.Provider;
|
||||
|
||||
@@ -47,12 +33,7 @@ namespace Umbraco.Tests.Persistence
|
||||
[TearDown]
|
||||
public override void TearDown()
|
||||
{
|
||||
AppDomain.CurrentDomain.SetData("DataDirectory", null);
|
||||
|
||||
//reset the app context
|
||||
ApplicationContext.Current = null;
|
||||
|
||||
RepositoryResolver.Reset();
|
||||
base.TearDown();
|
||||
}
|
||||
|
||||
public override Database Database
|
||||
|
||||
@@ -24,12 +24,9 @@ namespace Umbraco.Tests.Persistence
|
||||
[SetUp]
|
||||
public override void Initialize()
|
||||
{
|
||||
TestHelper.SetupLog4NetForTests();
|
||||
TestHelper.InitializeContentDirectories();
|
||||
base.Initialize();
|
||||
|
||||
string path = TestHelper.CurrentAssemblyDirectory;
|
||||
AppDomain.CurrentDomain.SetData("DataDirectory", path);
|
||||
|
||||
//Delete database file before continueing
|
||||
string filePath = string.Concat(path, "\\test.sdf");
|
||||
if (File.Exists(filePath))
|
||||
@@ -40,17 +37,7 @@ namespace Umbraco.Tests.Persistence
|
||||
//Create the Sql CE database
|
||||
var engine = new SqlCeEngine("Datasource=|DataDirectory|test.sdf");
|
||||
engine.CreateDatabase();
|
||||
|
||||
RepositoryResolver.Current = new RepositoryResolver(
|
||||
new RepositoryFactory());
|
||||
|
||||
Resolution.Freeze();
|
||||
ApplicationContext.Current = new ApplicationContext(
|
||||
//assign the db context
|
||||
new DatabaseContext(new DefaultDatabaseFactory()),
|
||||
//assign the service context
|
||||
new ServiceContext(new PetaPocoUnitOfWorkProvider(), new FileUnitOfWorkProvider(), new PublishingStrategy())) { IsReady = true };
|
||||
|
||||
|
||||
SqlSyntaxContext.SqlSyntaxProvider = SqlCeSyntax.Provider;
|
||||
|
||||
_database = new Database("Datasource=|DataDirectory|test.sdf",
|
||||
@@ -60,14 +47,7 @@ namespace Umbraco.Tests.Persistence
|
||||
[TearDown]
|
||||
public override void TearDown()
|
||||
{
|
||||
AppDomain.CurrentDomain.SetData("DataDirectory", null);
|
||||
|
||||
SqlSyntaxContext.SqlSyntaxProvider = null;
|
||||
|
||||
//reset the app context
|
||||
ApplicationContext.Current = null;
|
||||
|
||||
RepositoryResolver.Reset();
|
||||
base.TearDown();
|
||||
}
|
||||
|
||||
public override Database Database
|
||||
|
||||
@@ -22,21 +22,7 @@ namespace Umbraco.Tests.Persistence
|
||||
[SetUp]
|
||||
public override void Initialize()
|
||||
{
|
||||
TestHelper.SetupLog4NetForTests();
|
||||
TestHelper.InitializeContentDirectories();
|
||||
|
||||
string path = TestHelper.CurrentAssemblyDirectory;
|
||||
AppDomain.CurrentDomain.SetData("DataDirectory", path);
|
||||
|
||||
RepositoryResolver.Current = new RepositoryResolver(
|
||||
new RepositoryFactory());
|
||||
|
||||
Resolution.Freeze();
|
||||
ApplicationContext.Current = new ApplicationContext(
|
||||
//assign the db context
|
||||
new DatabaseContext(new DefaultDatabaseFactory()),
|
||||
//assign the service context
|
||||
new ServiceContext(new PetaPocoUnitOfWorkProvider(), new FileUnitOfWorkProvider(), new PublishingStrategy())) { IsReady = true };
|
||||
base.Initialize();
|
||||
|
||||
SqlSyntaxContext.SqlSyntaxProvider = SqlServerSyntax.Provider;
|
||||
|
||||
@@ -47,14 +33,7 @@ namespace Umbraco.Tests.Persistence
|
||||
[TearDown]
|
||||
public override void TearDown()
|
||||
{
|
||||
AppDomain.CurrentDomain.SetData("DataDirectory", null);
|
||||
|
||||
SqlSyntaxContext.SqlSyntaxProvider = null;
|
||||
|
||||
//reset the app context
|
||||
ApplicationContext.Current = null;
|
||||
|
||||
RepositoryResolver.Reset();
|
||||
base.TearDown();
|
||||
}
|
||||
|
||||
public override Database Database
|
||||
|
||||
Reference in New Issue
Block a user