diff --git a/src/Umbraco.Tests/BusinessLogic/DictionaryTest.cs b/src/Umbraco.Tests/BusinessLogic/DictionaryTest.cs deleted file mode 100644 index 92f3d34c60..0000000000 --- a/src/Umbraco.Tests/BusinessLogic/DictionaryTest.cs +++ /dev/null @@ -1,541 +0,0 @@ -using NUnit.Framework; -using Umbraco.Core; -using Umbraco.Tests.TestHelpers; -using umbraco.cms.businesslogic; -using System; -using System.Xml; -using umbraco.cms.businesslogic.language; -using umbraco.BusinessLogic; -using System.Linq; - -namespace Umbraco.Tests.BusinessLogic -{ - //TODO: This was ported over from the previous unit tests, need to make them work now :) - - /// - ///This is a test class for Dictionary_DictionaryItemTest and is intended - ///to contain all Dictionary_DictionaryItemTest Unit Tests - /// - [TestFixture, NUnit.Framework.Ignore] - public class DictionaryTest : BaseWebTest - { - public override void Initialize() - { - base.Initialize(); - - CreateNew(); - } - - [Test()] - public void Dictionary_Get_Top_Level_Items() - { - var items = Dictionary.getTopMostItems; - - var d = CreateNew(); - - Assert.AreEqual(items.Count() + 1, Dictionary.getTopMostItems.Count()); - - DeleteItem(d); - } - - /// - /// Creates a new dictionary entry, adds values for all languages assigned, then deletes the - /// entry and ensure that all other data is gone too. - /// - [Test()] - public void Dictionary_Create_Add_Text_And_Delete() - { - var d = CreateNew(); - - //set the values for all languages - var langs = Language.GetAllAsList(); - foreach (var l in langs) - { - var val = "TEST" + Guid.NewGuid().ToString("N"); - d.setValue(l.id, val); - //make sure the values are there - Assert.AreEqual(val, d.Value(l.id)); - } - - DeleteItem(d); - - } - - /// - ///A test for IsTopMostItem - /// - [Test()] - public void Dictionary_IsTopMostItem() - { - var parent = CreateNew(); - - //create a child - var childId = Dictionary.DictionaryItem.addKey("Test" + Guid.NewGuid().ToString("N"), "", parent.key); - Assert.IsTrue(childId > 0); - var child = new Dictionary.DictionaryItem(childId); - Assert.IsTrue(TypeHelper.IsTypeAssignableFrom(child)); - - Assert.IsTrue(parent.IsTopMostItem()); - Assert.IsFalse(child.IsTopMostItem()); - - DeleteItem(child); - DeleteItem(parent); - } - - /// - /// Test the Parent and Children properties and ensures that the relationships work both ways - /// - [Test()] - public void Dictionary_Parent_Child_Relationship() - { - var parent = CreateNew(); - - //create a child - var childId = Dictionary.DictionaryItem.addKey("Test" + Guid.NewGuid().ToString("N"), "", parent.key); - Assert.IsTrue(childId > 0); - var child = new Dictionary.DictionaryItem(childId); - Assert.IsTrue(TypeHelper.IsTypeAssignableFrom(child)); - - //set the parent relationship - Assert.AreEqual(parent.id, child.Parent.id); - Assert.AreEqual(parent.key, child.Parent.key); - Assert.AreEqual(parent.UniqueId, child.Parent.UniqueId); - - //test the child relationship - Assert.IsTrue(parent.hasChildren); - Assert.AreEqual(1, parent.Children.Length); - Assert.AreEqual(child.id, parent.Children.First().id); - Assert.AreEqual(child.key, parent.Children.First().key); - Assert.AreEqual(child.UniqueId, parent.Children.First().UniqueId); - - DeleteItem(child); - DeleteItem(parent); - } - - /// - /// Deletes a parent with existing children and ensures they are all gone. - /// - [Test()] - public void Dictionary_Delete_Parent_With_Children() - { - var parent = CreateNew(); - - //create a child - var childId1 = Dictionary.DictionaryItem.addKey("Test" + Guid.NewGuid().ToString("N"), "", parent.key); - Assert.IsTrue(childId1 > 0); - var child1 = new Dictionary.DictionaryItem(childId1); - Assert.IsTrue(TypeHelper.IsTypeAssignableFrom(child1)); - - //create a child - var childId2 = Dictionary.DictionaryItem.addKey("Test" + Guid.NewGuid().ToString("N"), "", parent.key); - Assert.IsTrue(childId2 > 0); - var child2 = new Dictionary.DictionaryItem(childId2); - Assert.IsTrue(TypeHelper.IsTypeAssignableFrom(child2)); - - Assert.IsTrue(parent.hasChildren); - Assert.AreEqual(2, parent.Children.Length); - - - DeleteItem(parent); - - //make sure kids are gone - var notFound = false; - try - { - var check = new Dictionary.DictionaryItem(childId1); - } - catch (ArgumentException) - { - notFound = true; - } - Assert.IsTrue(notFound); - - notFound = false; - try - { - var check = new Dictionary.DictionaryItem(childId2); - } - catch (ArgumentException) - { - notFound = true; - } - Assert.IsTrue(notFound); - - } - - /// - /// Guid constructor test - /// - [Test()] - public void Dictionary_Contructor_Guid() - { - var d = CreateNew(); - - var same = new Dictionary.DictionaryItem(d.UniqueId); - - Assert.AreEqual(d.id, same.id); - Assert.AreEqual(d.key, same.key); - Assert.AreEqual(d.UniqueId, same.UniqueId); - - DeleteItem(d); - } - - /// - /// key constructor test - /// - [Test()] - public void Dictionary_Contructor_Key() - { - var d = CreateNew(); - - var same = new Dictionary.DictionaryItem(d.key); - - Assert.AreEqual(d.id, same.id); - Assert.AreEqual(d.key, same.key); - Assert.AreEqual(d.UniqueId, same.UniqueId); - - DeleteItem(d); - } - - /// - ///A test for ToXml - /// - [Test()] - public void Dictionary_ToXml() - { - var d = CreateNew(); - - //create a child - var childId = Dictionary.DictionaryItem.addKey("Test" + Guid.NewGuid().ToString("N"), "", d.key); - Assert.IsTrue(childId > 0); - var child = new Dictionary.DictionaryItem(childId); - Assert.IsTrue(TypeHelper.IsTypeAssignableFrom(child)); - - var xml = new XmlDocument(); - - var output = d.ToXml(xml); - - Assert.AreEqual("DictionaryItem", output.Name); - Assert.IsTrue(output.HasChildNodes); - Assert.IsNotNull(output.Attributes["Key"].Value); - Assert.AreEqual(1, output.ChildNodes.OfType().Where(x => x.Name == "DictionaryItem").Count()); - - DeleteItem(child); - DeleteItem(d); - } - - /// - ///A test to change the key of an element - /// - [Test()] - public void Dictionary_Change_Key() - { - //System.Diagnostics.Debugger.Break(); - - var d = CreateNew(); - - var oldKey = d.key; - var newKey = "NEWKEY" + Guid.NewGuid().ToString("N"); - - d.key = newKey; - d.Save(); - Assert.AreNotEqual(oldKey, d.key); - Assert.AreEqual(newKey, d.key); - - //check with sql that the key is definitely changed - var count = Application.SqlHelper.ExecuteScalar("SELECT COUNT(*) FROM cmsDictionary WHERE [key]=@key", - Application.SqlHelper.CreateParameter("@key", newKey)); - Assert.AreEqual(1, count); - - count = Application.SqlHelper.ExecuteScalar("SELECT COUNT(*) FROM cmsDictionary WHERE [key]=@key", - Application.SqlHelper.CreateParameter("@key", oldKey)); - Assert.AreEqual(0, count); - - DeleteItem(d); - } - - /// - /// Tries to create a duplicate key and ensures it's not possible. - /// - [Test()] - public void Dictionary_Attempt_Duplicate_Key() - { - var key = "Test" + Guid.NewGuid().ToString("N"); - var d1Id = Dictionary.DictionaryItem.addKey(key, ""); - Assert.IsTrue(d1Id > 0); - var d1 = new Dictionary.DictionaryItem(d1Id); - Assert.IsTrue(TypeHelper.IsTypeAssignableFrom(d1)); - - var alreadyExists = false; - try - { - var d2Id = Dictionary.DictionaryItem.addKey(key, ""); - Assert.IsTrue(d2Id > 0); - var d2 = new Dictionary.DictionaryItem(d2Id); - } - catch (ArgumentException) - { - alreadyExists = true; - } - Assert.IsTrue(alreadyExists); - - DeleteItem(d1); - } - - #region Private methods - - private Dictionary.DictionaryItem CreateNew() - { - var id = Dictionary.DictionaryItem.addKey("Test" + Guid.NewGuid().ToString("N"), ""); - Assert.IsTrue(id > 0); - - var d = new Dictionary.DictionaryItem(id); - Assert.IsTrue(TypeHelper.IsTypeAssignableFrom(d)); - - return d; - } - - private void DeleteItem(Dictionary.DictionaryItem d) - { - var id = d.id; - - d.delete(); - - var notFound = false; - try - { - var check = new Dictionary.DictionaryItem(id); - } - catch (ArgumentException) - { - notFound = true; - } - Assert.IsTrue(notFound, "The item with key " + d.key + " still exists!"); - - //check with sql that the language text is gone - var count = Application.SqlHelper.ExecuteScalar("SELECT COUNT(*) FROM cmsLanguageText WHERE uniqueId=@uniqueId", - Application.SqlHelper.CreateParameter("@uniqueId", d.UniqueId)); - Assert.AreEqual(0, count); - } - #endregion - - #region Tests to write - - - ///// - /////A test for Import - ///// - //[Test()] - //public void ImportTest() - //{ - // XmlNode xmlData = null; // TODO: Initialize to an appropriate value - // Dictionary.DictionaryItem parent = null; // TODO: Initialize to an appropriate value - // Dictionary.DictionaryItem expected = null; // TODO: Initialize to an appropriate value - // Dictionary.DictionaryItem actual; - // actual = Dictionary.DictionaryItem.Import(xmlData, parent); - // Assert.AreEqual(expected, actual); - // Assert.Inconclusive("Verify the correctness of this test method."); - //} - - ///// - /////A test for Import - ///// - //[Test()] - //public void ImportTest1() - //{ - // XmlNode xmlData = null; // TODO: Initialize to an appropriate value - // Dictionary.DictionaryItem expected = null; // TODO: Initialize to an appropriate value - // Dictionary.DictionaryItem actual; - // actual = Dictionary.DictionaryItem.Import(xmlData); - // Assert.AreEqual(expected, actual); - // Assert.Inconclusive("Verify the correctness of this test method."); - //} - - - - ///// - /////A test for Save - ///// - //[Test()] - //public void SaveTest() - //{ - // Guid id = new Guid(); // TODO: Initialize to an appropriate value - // Dictionary.DictionaryItem target = new Dictionary.DictionaryItem(id); // TODO: Initialize to an appropriate value - // target.Save(); - // Assert.Inconclusive("A method that does not return a value cannot be verified."); - //} - - - - ///// - /////A test for Value - ///// - //[Test()] - //public void ValueTest() - //{ - // Guid id = new Guid(); // TODO: Initialize to an appropriate value - // Dictionary.DictionaryItem target = new Dictionary.DictionaryItem(id); // TODO: Initialize to an appropriate value - // int languageId = 0; // TODO: Initialize to an appropriate value - // string expected = string.Empty; // TODO: Initialize to an appropriate value - // string actual; - // actual = target.Value(languageId); - // Assert.AreEqual(expected, actual); - // Assert.Inconclusive("Verify the correctness of this test method."); - //} - - ///// - /////A test for Value - ///// - //[Test()] - //public void ValueTest1() - //{ - // Guid id = new Guid(); // TODO: Initialize to an appropriate value - // Dictionary.DictionaryItem target = new Dictionary.DictionaryItem(id); // TODO: Initialize to an appropriate value - // string expected = string.Empty; // TODO: Initialize to an appropriate value - // string actual; - // actual = target.Value(); - // Assert.AreEqual(expected, actual); - // Assert.Inconclusive("Verify the correctness of this test method."); - //} - - ///// - /////A test for addKey - ///// - //[Test()] - //public void addKeyTest() - //{ - // string key = string.Empty; // TODO: Initialize to an appropriate value - // string defaultValue = string.Empty; // TODO: Initialize to an appropriate value - // int expected = 0; // TODO: Initialize to an appropriate value - // int actual; - // actual = Dictionary.DictionaryItem.addKey(key, defaultValue); - // Assert.AreEqual(expected, actual); - // Assert.Inconclusive("Verify the correctness of this test method."); - //} - - ///// - /////A test for addKey - ///// - //[Test()] - //public void addKeyTest1() - //{ - // string key = string.Empty; // TODO: Initialize to an appropriate value - // string defaultValue = string.Empty; // TODO: Initialize to an appropriate value - // string parentKey = string.Empty; // TODO: Initialize to an appropriate value - // int expected = 0; // TODO: Initialize to an appropriate value - // int actual; - // actual = Dictionary.DictionaryItem.addKey(key, defaultValue, parentKey); - // Assert.AreEqual(expected, actual); - // Assert.Inconclusive("Verify the correctness of this test method."); - //} - - ///// - /////A test for delete - ///// - //[Test()] - //public void deleteTest() - //{ - // Guid id = new Guid(); // TODO: Initialize to an appropriate value - // Dictionary.DictionaryItem target = new Dictionary.DictionaryItem(id); // TODO: Initialize to an appropriate value - // target.delete(); - // Assert.Inconclusive("A method that does not return a value cannot be verified."); - //} - - ///// - /////A test for hasKey - ///// - //[Test()] - //public void hasKeyTest() - //{ - // string key = string.Empty; // TODO: Initialize to an appropriate value - // bool expected = false; // TODO: Initialize to an appropriate value - // bool actual; - // actual = Dictionary.DictionaryItem.hasKey(key); - // Assert.AreEqual(expected, actual); - // Assert.Inconclusive("Verify the correctness of this test method."); - //} - - ///// - /////A test for setValue - ///// - //[Test()] - //public void setValueTest() - //{ - // Guid id = new Guid(); // TODO: Initialize to an appropriate value - // Dictionary.DictionaryItem target = new Dictionary.DictionaryItem(id); // TODO: Initialize to an appropriate value - // int languageId = 0; // TODO: Initialize to an appropriate value - // string value = string.Empty; // TODO: Initialize to an appropriate value - // target.setValue(languageId, value); - // Assert.Inconclusive("A method that does not return a value cannot be verified."); - //} - - ///// - /////A test for setValue - ///// - //[Test()] - //public void setValueTest1() - //{ - // Guid id = new Guid(); // TODO: Initialize to an appropriate value - // Dictionary.DictionaryItem target = new Dictionary.DictionaryItem(id); // TODO: Initialize to an appropriate value - // string value = string.Empty; // TODO: Initialize to an appropriate value - // target.setValue(value); - // Assert.Inconclusive("A method that does not return a value cannot be verified."); - //} - - ///// - /////A test for Children - ///// - //[Test()] - //public void ChildrenTest() - //{ - // Guid id = new Guid(); // TODO: Initialize to an appropriate value - // Dictionary.DictionaryItem target = new Dictionary.DictionaryItem(id); // TODO: Initialize to an appropriate value - // Dictionary.DictionaryItem[] actual; - // actual = target.Children; - // Assert.Inconclusive("Verify the correctness of this test method."); - //} - - ///// - /////A test for Parent - ///// - //[Test()] - //public void ParentTest() - //{ - // Guid id = new Guid(); // TODO: Initialize to an appropriate value - // Dictionary.DictionaryItem target = new Dictionary.DictionaryItem(id); // TODO: Initialize to an appropriate value - // Dictionary.DictionaryItem actual; - // actual = target.Parent; - // Assert.Inconclusive("Verify the correctness of this test method."); - //} - - ///// - /////A test for hasChildren - ///// - //[Test()] - //public void hasChildrenTest() - //{ - // Guid id = new Guid(); // TODO: Initialize to an appropriate value - // Dictionary.DictionaryItem target = new Dictionary.DictionaryItem(id); // TODO: Initialize to an appropriate value - // bool actual; - // actual = target.hasChildren; - // Assert.Inconclusive("Verify the correctness of this test method."); - //} - - ///// - /////A test for id - ///// - //[Test()] - //public void idTest() - //{ - // Guid id = new Guid(); // TODO: Initialize to an appropriate value - // Dictionary.DictionaryItem target = new Dictionary.DictionaryItem(id); // TODO: Initialize to an appropriate value - // int actual; - // actual = target.id; - // Assert.Inconclusive("Verify the correctness of this test method."); - //} - - - #endregion - - } -} diff --git a/src/Umbraco.Tests/CodeFirst/CodeFirstTests.cs b/src/Umbraco.Tests/CodeFirst/CodeFirstTests.cs index be500edf25..ee9080b094 100644 --- a/src/Umbraco.Tests/CodeFirst/CodeFirstTests.cs +++ b/src/Umbraco.Tests/CodeFirst/CodeFirstTests.cs @@ -15,6 +15,7 @@ using Umbraco.Tests.TestHelpers.Entities; namespace Umbraco.Tests.CodeFirst { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture] public class CodeFirstTests : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/CodeFirst/StronglyTypedMapperTest.cs b/src/Umbraco.Tests/CodeFirst/StronglyTypedMapperTest.cs index bd95871063..1e2302087b 100644 --- a/src/Umbraco.Tests/CodeFirst/StronglyTypedMapperTest.cs +++ b/src/Umbraco.Tests/CodeFirst/StronglyTypedMapperTest.cs @@ -13,6 +13,7 @@ using Umbraco.Web; namespace Umbraco.Tests.CodeFirst { + [DatabaseTestBehavior(DatabaseBehavior.NoDatabasePerFixture)] [TestFixture] public class StronglyTypedMapperTest : PublishedContentTestBase { @@ -95,11 +96,6 @@ namespace Umbraco.Tests.CodeFirst base.TearDown(); } - protected override DatabaseBehavior DatabaseTestBehavior - { - get { return DatabaseBehavior.NoDatabasePerFixture; } - } - protected override string GetXmlContent(int templateId) { return @" diff --git a/src/Umbraco.Tests/GlobalSettingsTests.cs b/src/Umbraco.Tests/GlobalSettingsTests.cs index b4f6d9dd2a..7f97466bae 100644 --- a/src/Umbraco.Tests/GlobalSettingsTests.cs +++ b/src/Umbraco.Tests/GlobalSettingsTests.cs @@ -11,10 +11,6 @@ namespace Umbraco.Tests [TestFixture] public class GlobalSettingsTests : BaseWebTest { - protected override DatabaseBehavior DatabaseTestBehavior - { - get { return DatabaseBehavior.NoDatabasePerFixture; } - } public override void Initialize() { diff --git a/src/Umbraco.Tests/LibraryTests.cs b/src/Umbraco.Tests/LibraryTests.cs index 55cc9d2a02..129b520b2f 100644 --- a/src/Umbraco.Tests/LibraryTests.cs +++ b/src/Umbraco.Tests/LibraryTests.cs @@ -57,10 +57,6 @@ namespace Umbraco.Tests UmbracoContext.Current = null; } - protected override DatabaseBehavior DatabaseTestBehavior - { - get { return DatabaseBehavior.NoDatabasePerFixture; } - } [Test] public void Json_To_Xml_Object() diff --git a/src/Umbraco.Tests/Membership/DynamicMemberContentTests.cs b/src/Umbraco.Tests/Membership/DynamicMemberContentTests.cs index a1b7e67a2a..94c70981d6 100644 --- a/src/Umbraco.Tests/Membership/DynamicMemberContentTests.cs +++ b/src/Umbraco.Tests/Membership/DynamicMemberContentTests.cs @@ -17,15 +17,11 @@ using Umbraco.Web.PublishedCache; namespace Umbraco.Tests.Membership { + [DatabaseTestBehavior(DatabaseBehavior.NoDatabasePerFixture)] [TestFixture] public class DynamicMemberContentTests : PublishedContentTestBase { - protected override DatabaseBehavior DatabaseTestBehavior - { - get { return DatabaseBehavior.NoDatabasePerFixture; } - } - public override void Initialize() { // required so we can access property.Value diff --git a/src/Umbraco.Tests/Models/ContentXmlTest.cs b/src/Umbraco.Tests/Models/ContentXmlTest.cs index 7910860ed4..11b925e9fd 100644 --- a/src/Umbraco.Tests/Models/ContentXmlTest.cs +++ b/src/Umbraco.Tests/Models/ContentXmlTest.cs @@ -9,6 +9,7 @@ using Umbraco.Tests.TestHelpers.Entities; namespace Umbraco.Tests.Models { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture] public class ContentXmlTest : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/Models/MediaXmlTest.cs b/src/Umbraco.Tests/Models/MediaXmlTest.cs index ecfbc3ce61..cc82f7ce88 100644 --- a/src/Umbraco.Tests/Models/MediaXmlTest.cs +++ b/src/Umbraco.Tests/Models/MediaXmlTest.cs @@ -12,6 +12,7 @@ using umbraco.interfaces; namespace Umbraco.Tests.Models { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture] public class MediaXmlTest : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/Persistence/Auditing/AuditTests.cs b/src/Umbraco.Tests/Persistence/Auditing/AuditTests.cs index f8ba631e43..da211e2dc6 100644 --- a/src/Umbraco.Tests/Persistence/Auditing/AuditTests.cs +++ b/src/Umbraco.Tests/Persistence/Auditing/AuditTests.cs @@ -6,6 +6,7 @@ using Umbraco.Tests.TestHelpers; namespace Umbraco.Tests.Persistence.Auditing { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture] public class AuditTests : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs b/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs index c942f4fa81..2200547009 100644 --- a/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs +++ b/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs @@ -10,6 +10,7 @@ using Umbraco.Tests.TestHelpers; namespace Umbraco.Tests.Persistence { + [TestFixture] public class DatabaseContextTests { @@ -75,6 +76,9 @@ namespace Umbraco.Tests.Persistence var engine = new SqlCeEngine(settings.ConnectionString.Replace("UmbracoPetaPocoTests", "DatabaseContextTests")); engine.CreateDatabase(); + //re-map the dbcontext to the new conn string + _dbContext = new DatabaseContext(new DefaultDatabaseFactory(engine.LocalConnectionString, "System.Data.SqlServerCe.4.0")); + SqlSyntaxContext.SqlSyntaxProvider = SqlCeSyntax.Provider; //Create the umbraco database diff --git a/src/Umbraco.Tests/Persistence/PetaPocoExtensionsTest.cs b/src/Umbraco.Tests/Persistence/PetaPocoExtensionsTest.cs index 90375ff23b..154b0c147f 100644 --- a/src/Umbraco.Tests/Persistence/PetaPocoExtensionsTest.cs +++ b/src/Umbraco.Tests/Persistence/PetaPocoExtensionsTest.cs @@ -9,6 +9,7 @@ using Umbraco.Tests.TestHelpers; namespace Umbraco.Tests.Persistence { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture] public class PetaPocoExtensionsTest : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/Persistence/Repositories/ContentRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/ContentRepositoryTest.cs index 7aef4855ed..e75eabff4f 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/ContentRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/ContentRepositoryTest.cs @@ -18,6 +18,7 @@ using umbraco.interfaces; namespace Umbraco.Tests.Persistence.Repositories { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture] public class ContentRepositoryTest : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs index 2bcb2e9c04..3f5a7ba401 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs @@ -15,6 +15,7 @@ using Umbraco.Tests.TestHelpers.Entities; namespace Umbraco.Tests.Persistence.Repositories { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture] public class ContentTypeRepositoryTest : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs index 4becdc9556..d2f1578d87 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/DataTypeDefinitionRepositoryTest.cs @@ -14,6 +14,7 @@ using Umbraco.Tests.TestHelpers; namespace Umbraco.Tests.Persistence.Repositories { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture] public class DataTypeDefinitionRepositoryTest : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/Persistence/Repositories/DictionaryRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/DictionaryRepositoryTest.cs index e8e25068db..6619478aaf 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/DictionaryRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/DictionaryRepositoryTest.cs @@ -11,6 +11,7 @@ using Umbraco.Tests.TestHelpers; namespace Umbraco.Tests.Persistence.Repositories { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture] public class DictionaryRepositoryTest : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/Persistence/Repositories/LanguageRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/LanguageRepositoryTest.cs index c1ac5fa6a9..037848a911 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/LanguageRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/LanguageRepositoryTest.cs @@ -10,6 +10,7 @@ using Umbraco.Tests.TestHelpers; namespace Umbraco.Tests.Persistence.Repositories { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture] public class LanguageRepositoryTest : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/Persistence/Repositories/MediaRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/MediaRepositoryTest.cs index 704c964785..8f31023bdf 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/MediaRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/MediaRepositoryTest.cs @@ -17,6 +17,7 @@ using umbraco.interfaces; namespace Umbraco.Tests.Persistence.Repositories { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture] public class MediaRepositoryTest : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/Persistence/Repositories/MediaTypeRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/MediaTypeRepositoryTest.cs index 0adfecc73b..cbf809fc12 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/MediaTypeRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/MediaTypeRepositoryTest.cs @@ -13,6 +13,7 @@ using Umbraco.Tests.TestHelpers.Entities; namespace Umbraco.Tests.Persistence.Repositories { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture] public class MediaTypeRepositoryTest : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/Persistence/Repositories/MemberRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/MemberRepositoryTest.cs index bb9cd553a9..9a3206d1b1 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/MemberRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/MemberRepositoryTest.cs @@ -14,6 +14,7 @@ using Umbraco.Tests.TestHelpers.Entities; namespace Umbraco.Tests.Persistence.Repositories { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture] public class MemberRepositoryTest : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/Persistence/Repositories/MemberTypeRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/MemberTypeRepositoryTest.cs index 91d54ea650..44c4264df2 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/MemberTypeRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/MemberTypeRepositoryTest.cs @@ -11,6 +11,7 @@ using Umbraco.Tests.TestHelpers.Entities; namespace Umbraco.Tests.Persistence.Repositories { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture] public class MemberTypeRepositoryTest : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/Persistence/Repositories/NotificationsRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/NotificationsRepositoryTest.cs index 36797c1cb3..c718c2c288 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/NotificationsRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/NotificationsRepositoryTest.cs @@ -13,6 +13,7 @@ using Umbraco.Tests.TestHelpers; namespace Umbraco.Tests.Persistence.Repositories { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture] public class NotificationsRepositoryTest : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/Persistence/Repositories/RelationRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/RelationRepositoryTest.cs index 6ec5d29cc8..3b6edea115 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/RelationRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/RelationRepositoryTest.cs @@ -16,6 +16,7 @@ using umbraco.interfaces; namespace Umbraco.Tests.Persistence.Repositories { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture] public class RelationRepositoryTest : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/Persistence/Repositories/RelationTypeRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/RelationTypeRepositoryTest.cs index ce0fada6f6..1c92f11802 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/RelationTypeRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/RelationTypeRepositoryTest.cs @@ -12,6 +12,7 @@ using Umbraco.Tests.TestHelpers; namespace Umbraco.Tests.Persistence.Repositories { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture] public class RelationTypeRepositoryTest : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/Persistence/Repositories/ServerRegistrationRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/ServerRegistrationRepositoryTest.cs index 19b4a7f7d9..6188c351a1 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/ServerRegistrationRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/ServerRegistrationRepositoryTest.cs @@ -11,6 +11,7 @@ using Umbraco.Tests.TestHelpers; namespace Umbraco.Tests.Persistence.Repositories { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture] public class ServerRegistrationRepositoryTest : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/Persistence/Repositories/StylesheetRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/StylesheetRepositoryTest.cs index d91bc0e309..09b140940a 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/StylesheetRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/StylesheetRepositoryTest.cs @@ -10,6 +10,7 @@ using Umbraco.Tests.TestHelpers; namespace Umbraco.Tests.Persistence.Repositories { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture] public class StylesheetRepositoryTest : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/Persistence/Repositories/TemplateRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/TemplateRepositoryTest.cs index 252f2fd7d7..e2584a936c 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/TemplateRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/TemplateRepositoryTest.cs @@ -13,6 +13,7 @@ using Umbraco.Tests.TestHelpers; namespace Umbraco.Tests.Persistence.Repositories { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture] public class TemplateRepositoryTest : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/Persistence/Repositories/UserRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/UserRepositoryTest.cs index 7eef71ad63..2eefc1d075 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/UserRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/UserRepositoryTest.cs @@ -14,6 +14,7 @@ using Umbraco.Tests.TestHelpers.Entities; namespace Umbraco.Tests.Persistence.Repositories { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture] public class UserRepositoryTest : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/Persistence/Repositories/UserTypeRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/UserTypeRepositoryTest.cs index 336f18290c..07212c0896 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/UserTypeRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/UserTypeRepositoryTest.cs @@ -11,6 +11,7 @@ using Umbraco.Tests.TestHelpers.Entities; namespace Umbraco.Tests.Persistence.Repositories { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture] public class UserTypeRepositoryTest : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/Persistence/SchemaValidationTest.cs b/src/Umbraco.Tests/Persistence/SchemaValidationTest.cs index f4aaa7c064..14581378f9 100644 --- a/src/Umbraco.Tests/Persistence/SchemaValidationTest.cs +++ b/src/Umbraco.Tests/Persistence/SchemaValidationTest.cs @@ -5,6 +5,7 @@ using Umbraco.Tests.TestHelpers; namespace Umbraco.Tests.Persistence { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture] public class SchemaValidationTest : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/PublishedCache/PublishedContentCacheTests.cs b/src/Umbraco.Tests/PublishedCache/PublishedContentCacheTests.cs index 864bf491eb..b94dc9892d 100644 --- a/src/Umbraco.Tests/PublishedCache/PublishedContentCacheTests.cs +++ b/src/Umbraco.Tests/PublishedCache/PublishedContentCacheTests.cs @@ -16,6 +16,7 @@ using umbraco.BusinessLogic; namespace Umbraco.Tests.PublishedCache { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture] public class PublishContentCacheTests : BaseWebTest { diff --git a/src/Umbraco.Tests/PublishedCache/PublishedMediaCacheTests.cs b/src/Umbraco.Tests/PublishedCache/PublishedMediaCacheTests.cs index e8c03850a8..53a8b5b658 100644 --- a/src/Umbraco.Tests/PublishedCache/PublishedMediaCacheTests.cs +++ b/src/Umbraco.Tests/PublishedCache/PublishedMediaCacheTests.cs @@ -16,6 +16,7 @@ using umbraco.BusinessLogic; namespace Umbraco.Tests.PublishedCache { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture] public class PublishMediaCacheTests : BaseWebTest { diff --git a/src/Umbraco.Tests/PublishedContent/DynamicDocumentTestsBase.cs b/src/Umbraco.Tests/PublishedContent/DynamicDocumentTestsBase.cs index 2bbd383041..07787d8e2c 100644 --- a/src/Umbraco.Tests/PublishedContent/DynamicDocumentTestsBase.cs +++ b/src/Umbraco.Tests/PublishedContent/DynamicDocumentTestsBase.cs @@ -17,11 +17,6 @@ namespace Umbraco.Tests.PublishedContent [TestFixture] public abstract class DynamicDocumentTestsBase : PublishedContentTestBase { - protected override DatabaseBehavior DatabaseTestBehavior - { - get { return DatabaseBehavior.NoDatabasePerFixture; } - } - private IUmbracoSettingsSection _umbracoSettings; public override void Initialize() diff --git a/src/Umbraco.Tests/PublishedContent/DynamicNodeTests.cs b/src/Umbraco.Tests/PublishedContent/DynamicNodeTests.cs index 903c4ba3d2..ec2fdcbee5 100644 --- a/src/Umbraco.Tests/PublishedContent/DynamicNodeTests.cs +++ b/src/Umbraco.Tests/PublishedContent/DynamicNodeTests.cs @@ -14,16 +14,10 @@ using System.Linq; namespace Umbraco.Tests.PublishedContent { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture] public class DynamicNodeTests : DynamicDocumentTestsBase { - /// - /// We only need a new schema per fixture... speeds up testing - /// - protected override DatabaseBehavior DatabaseTestBehavior - { - get { return DatabaseBehavior.NewSchemaPerFixture; } - } public override void Initialize() { diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentExtensionTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentExtensionTests.cs index 1144aba7ca..5a9067a095 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentExtensionTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentExtensionTests.cs @@ -9,18 +9,14 @@ using Umbraco.Web; namespace Umbraco.Tests.PublishedContent { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture] public class PublishedContentExtensionTests : PublishedContentTestBase { private UmbracoContext ctx; private string xmlContent = ""; private bool createContentTypes = true; - - protected override DatabaseBehavior DatabaseTestBehavior - { - get { return DatabaseBehavior.NewSchemaPerFixture; } - } - + protected override string GetXmlContent(int templateId) { return xmlContent; diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentRequestEngineTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentRequestEngineTests.cs index 5bfc94fd05..25fa7df5f7 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentRequestEngineTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentRequestEngineTests.cs @@ -13,12 +13,6 @@ namespace Umbraco.Tests.PublishedContent [TestFixture] public class PublishedContentRequestEngineTests : BaseRoutingTest { - - protected override DatabaseBehavior DatabaseTestBehavior - { - get { return DatabaseBehavior.NoDatabasePerFixture; } - } - [Test] public void Ctor_Throws_On_Null_PCR() { diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs index 653ab516be..bed40b9b20 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs @@ -18,11 +18,6 @@ namespace Umbraco.Tests.PublishedContent [TestFixture] public class PublishedContentTests : PublishedContentTestBase { - protected override DatabaseBehavior DatabaseTestBehavior - { - get { return DatabaseBehavior.NoDatabasePerFixture; } - } - private PluginManager _pluginManager; public override void Initialize() diff --git a/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs index bf69dedb76..6d2b85ff3a 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedMediaTests.cs @@ -32,6 +32,7 @@ namespace Umbraco.Tests.PublishedContent /// /// Tests the typed extension methods on IPublishedContent using the DefaultPublishedMediaStore /// + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture, RequiresSTA] public class PublishedMediaTests : PublishedContentTestBase { diff --git a/src/Umbraco.Tests/Publishing/PublishingStrategyTests.cs b/src/Umbraco.Tests/Publishing/PublishingStrategyTests.cs index 7aaba12df1..a2ebdf450d 100644 --- a/src/Umbraco.Tests/Publishing/PublishingStrategyTests.cs +++ b/src/Umbraco.Tests/Publishing/PublishingStrategyTests.cs @@ -18,6 +18,7 @@ using System.Linq; namespace Umbraco.Tests.Publishing { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture] public class PublishingStrategyTests : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/Routing/ContentFinderByAliasTests.cs b/src/Umbraco.Tests/Routing/ContentFinderByAliasTests.cs index fb54207578..60fee894d3 100644 --- a/src/Umbraco.Tests/Routing/ContentFinderByAliasTests.cs +++ b/src/Umbraco.Tests/Routing/ContentFinderByAliasTests.cs @@ -8,11 +8,6 @@ namespace Umbraco.Tests.Routing [TestFixture] public class ContentFinderByAliasTests : BaseRoutingTest { - protected override DatabaseBehavior DatabaseTestBehavior - { - get { return DatabaseBehavior.NoDatabasePerFixture; } - } - [TestCase("/this/is/my/alias", 1001)] [TestCase("/anotheralias", 1001)] [TestCase("/page2/alias", 10011)] diff --git a/src/Umbraco.Tests/Routing/ContentFinderByAliasWithDomainsTests.cs b/src/Umbraco.Tests/Routing/ContentFinderByAliasWithDomainsTests.cs index a45ac7a12b..b83f0bfd2b 100644 --- a/src/Umbraco.Tests/Routing/ContentFinderByAliasWithDomainsTests.cs +++ b/src/Umbraco.Tests/Routing/ContentFinderByAliasWithDomainsTests.cs @@ -7,6 +7,7 @@ using umbraco.cms.businesslogic.web; namespace Umbraco.Tests.Routing { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture] public class ContentFinderByAliasWithDomainsTests : ContentFinderByAliasTests { @@ -20,11 +21,6 @@ namespace Umbraco.Tests.Routing InitializeLanguagesAndDomains(); } - protected override DatabaseBehavior DatabaseTestBehavior - { - get { return DatabaseBehavior.NewSchemaPerFixture; } - } - void InitializeLanguagesAndDomains() { var domains = Domain.GetDomains(); diff --git a/src/Umbraco.Tests/Routing/ContentFinderByIdTests.cs b/src/Umbraco.Tests/Routing/ContentFinderByIdTests.cs index dcbf1dcb9b..6623ac23b9 100644 --- a/src/Umbraco.Tests/Routing/ContentFinderByIdTests.cs +++ b/src/Umbraco.Tests/Routing/ContentFinderByIdTests.cs @@ -9,13 +9,6 @@ namespace Umbraco.Tests.Routing [TestFixture] public class ContentFinderByIdTests : BaseRoutingTest { - /// - /// We don't need a db for this test, will run faster without one - /// - protected override DatabaseBehavior DatabaseTestBehavior - { - get { return DatabaseBehavior.NoDatabasePerFixture; } - } [TestCase("/1046", 1046)] [TestCase("/1046.aspx", 1046)] diff --git a/src/Umbraco.Tests/Routing/ContentFinderByNiceUrlAndTemplateTests.cs b/src/Umbraco.Tests/Routing/ContentFinderByNiceUrlAndTemplateTests.cs index 7c4618f0b4..8308241607 100644 --- a/src/Umbraco.Tests/Routing/ContentFinderByNiceUrlAndTemplateTests.cs +++ b/src/Umbraco.Tests/Routing/ContentFinderByNiceUrlAndTemplateTests.cs @@ -6,6 +6,7 @@ using Umbraco.Core.Models; namespace Umbraco.Tests.Routing { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture] public class ContentFinderByNiceUrlAndTemplateTests : BaseRoutingTest { diff --git a/src/Umbraco.Tests/Routing/ContentFinderByNiceUrlTests.cs b/src/Umbraco.Tests/Routing/ContentFinderByNiceUrlTests.cs index 6be14fce80..8002acd0ac 100644 --- a/src/Umbraco.Tests/Routing/ContentFinderByNiceUrlTests.cs +++ b/src/Umbraco.Tests/Routing/ContentFinderByNiceUrlTests.cs @@ -12,13 +12,7 @@ namespace Umbraco.Tests.Routing [TestFixture] public class ContentFinderByNiceUrlTests : BaseRoutingTest { - /// - /// We don't need a db for this test, will run faster without one - /// - protected override DatabaseBehavior DatabaseTestBehavior - { - get { return DatabaseBehavior.NoDatabasePerFixture; } - } + [TestCase("/", 1046)] [TestCase("/default.aspx", 1046)] //this one is actually rather important since this is the path that comes through when we are running in pre-IIS 7 for the root document '/' ! diff --git a/src/Umbraco.Tests/Routing/ContentFinderByNiceUrlWithDomainsTests.cs b/src/Umbraco.Tests/Routing/ContentFinderByNiceUrlWithDomainsTests.cs index 2764787bcd..15912a8c5d 100644 --- a/src/Umbraco.Tests/Routing/ContentFinderByNiceUrlWithDomainsTests.cs +++ b/src/Umbraco.Tests/Routing/ContentFinderByNiceUrlWithDomainsTests.cs @@ -11,6 +11,7 @@ using System.Configuration; namespace Umbraco.Tests.Routing { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture] public class ContentFinderByNiceUrlWithDomainsTests : BaseRoutingTest { diff --git a/src/Umbraco.Tests/Routing/ContentFinderByPageIdQueryTests.cs b/src/Umbraco.Tests/Routing/ContentFinderByPageIdQueryTests.cs index 4fd7339d49..912e88bb15 100644 --- a/src/Umbraco.Tests/Routing/ContentFinderByPageIdQueryTests.cs +++ b/src/Umbraco.Tests/Routing/ContentFinderByPageIdQueryTests.cs @@ -8,14 +8,6 @@ namespace Umbraco.Tests.Routing [TestFixture] public class ContentFinderByPageIdQueryTests : BaseRoutingTest { - /// - /// We don't need a db for this test, will run faster without one - /// - protected override DatabaseBehavior DatabaseTestBehavior - { - get { return DatabaseBehavior.NoDatabasePerFixture; } - } - [TestCase("/?umbPageId=1046", 1046)] [TestCase("/?UMBPAGEID=1046", 1046)] [TestCase("/default.aspx?umbPageId=1046", 1046)] //TODO: Should this match?? diff --git a/src/Umbraco.Tests/Routing/DomainsAndCulturesTests.cs b/src/Umbraco.Tests/Routing/DomainsAndCulturesTests.cs index 23a9141e9c..27b00cf676 100644 --- a/src/Umbraco.Tests/Routing/DomainsAndCulturesTests.cs +++ b/src/Umbraco.Tests/Routing/DomainsAndCulturesTests.cs @@ -10,6 +10,7 @@ using umbraco.cms.businesslogic.language; namespace Umbraco.Tests.Routing { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture] class DomainsAndCulturesTests : BaseRoutingTest { diff --git a/src/Umbraco.Tests/Routing/NiceUrlProviderTests.cs b/src/Umbraco.Tests/Routing/NiceUrlProviderTests.cs index a2ac098cad..b0c2474549 100644 --- a/src/Umbraco.Tests/Routing/NiceUrlProviderTests.cs +++ b/src/Umbraco.Tests/Routing/NiceUrlProviderTests.cs @@ -9,6 +9,7 @@ using Umbraco.Web.Routing; namespace Umbraco.Tests.Routing { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture] public class NiceUrlProviderTests : BaseRoutingTest { diff --git a/src/Umbraco.Tests/Routing/NiceUrlsProviderWithDomainsTests.cs b/src/Umbraco.Tests/Routing/NiceUrlsProviderWithDomainsTests.cs index a64f397c2c..670de640ff 100644 --- a/src/Umbraco.Tests/Routing/NiceUrlsProviderWithDomainsTests.cs +++ b/src/Umbraco.Tests/Routing/NiceUrlsProviderWithDomainsTests.cs @@ -12,6 +12,7 @@ using umbraco.cms.businesslogic.language; namespace Umbraco.Tests.Routing { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture] public class NiceUrlsProviderWithDomainsTests : BaseRoutingTest { @@ -29,11 +30,6 @@ namespace Umbraco.Tests.Routing private IUmbracoSettingsSection _umbracoSettings; - protected override DatabaseBehavior DatabaseTestBehavior - { - get { return DatabaseBehavior.NewSchemaPerFixture; } - } - protected override void FreezeResolution() { SiteDomainHelperResolver.Current = new SiteDomainHelperResolver(new SiteDomainHelper()); diff --git a/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs b/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs index 794c9b0401..a1f63aa452 100644 --- a/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs +++ b/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs @@ -15,13 +15,10 @@ using Umbraco.Core.Strings; namespace Umbraco.Tests.Routing { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture] public class RenderRouteHandlerTests : BaseRoutingTest { - protected override DatabaseBehavior DatabaseTestBehavior - { - get { return DatabaseBehavior.NewSchemaPerFixture; } - } public override void Initialize() { diff --git a/src/Umbraco.Tests/Routing/UrlsWithNestedDomains.cs b/src/Umbraco.Tests/Routing/UrlsWithNestedDomains.cs index 9e45371de2..f1a80de06d 100644 --- a/src/Umbraco.Tests/Routing/UrlsWithNestedDomains.cs +++ b/src/Umbraco.Tests/Routing/UrlsWithNestedDomains.cs @@ -11,6 +11,7 @@ using Umbraco.Web.Routing; namespace Umbraco.Tests.Routing { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture] public class UrlsWithNestedDomains : BaseRoutingTest { diff --git a/src/Umbraco.Tests/Routing/uQueryGetNodeIdByUrlTests.cs b/src/Umbraco.Tests/Routing/uQueryGetNodeIdByUrlTests.cs index 3d6d402642..e387642ef2 100644 --- a/src/Umbraco.Tests/Routing/uQueryGetNodeIdByUrlTests.cs +++ b/src/Umbraco.Tests/Routing/uQueryGetNodeIdByUrlTests.cs @@ -9,6 +9,7 @@ using umbraco.cms.businesslogic.template; namespace Umbraco.Tests.Routing { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture] public class uQueryGetNodeIdByUrlTests : BaseRoutingTest { diff --git a/src/Umbraco.Tests/Services/ContentServiceTests.cs b/src/Umbraco.Tests/Services/ContentServiceTests.cs index ee6d719177..42a986c6dd 100644 --- a/src/Umbraco.Tests/Services/ContentServiceTests.cs +++ b/src/Umbraco.Tests/Services/ContentServiceTests.cs @@ -10,6 +10,7 @@ using Umbraco.Core.Persistence; using Umbraco.Core.Persistence.Repositories; using Umbraco.Core.Persistence.UnitOfWork; using Umbraco.Core.Services; +using Umbraco.Tests.TestHelpers; using Umbraco.Tests.TestHelpers.Entities; namespace Umbraco.Tests.Services @@ -19,6 +20,7 @@ namespace Umbraco.Tests.Services /// This is more of an integration test as it involves multiple layers /// as well as configuration. /// + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture, RequiresSTA] public class ContentServiceTests : BaseServiceTest { diff --git a/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs b/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs index ddd827c78f..4932431587 100644 --- a/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs +++ b/src/Umbraco.Tests/Services/ContentTypeServiceTests.cs @@ -5,10 +5,12 @@ using NUnit.Framework; using Umbraco.Core; using Umbraco.Core.Models; using Umbraco.Core.Models.Rdbms; +using Umbraco.Tests.TestHelpers; using Umbraco.Tests.TestHelpers.Entities; namespace Umbraco.Tests.Services { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture, RequiresSTA] public class ContentTypeServiceTests : BaseServiceTest { diff --git a/src/Umbraco.Tests/Services/DataTypeServiceTests.cs b/src/Umbraco.Tests/Services/DataTypeServiceTests.cs index 978c81d169..c93949c3ac 100644 --- a/src/Umbraco.Tests/Services/DataTypeServiceTests.cs +++ b/src/Umbraco.Tests/Services/DataTypeServiceTests.cs @@ -4,12 +4,14 @@ using System.Linq; using NUnit.Framework; using Umbraco.Core.Models; using Umbraco.Core.Models.Rdbms; +using Umbraco.Tests.TestHelpers; namespace Umbraco.Tests.Services { /// /// Tests covering the DataTypeService /// + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture, RequiresSTA] public class DataTypeServiceTests : BaseServiceTest { diff --git a/src/Umbraco.Tests/Services/EntityServiceTests.cs b/src/Umbraco.Tests/Services/EntityServiceTests.cs index cc2316c349..82cc2c7560 100644 --- a/src/Umbraco.Tests/Services/EntityServiceTests.cs +++ b/src/Umbraco.Tests/Services/EntityServiceTests.cs @@ -11,6 +11,7 @@ namespace Umbraco.Tests.Services /// /// Tests covering the EntityService /// + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture, RequiresSTA] public class EntityServiceTests : BaseServiceTest { @@ -25,12 +26,7 @@ namespace Umbraco.Tests.Services { base.TearDown(); } - - protected override DatabaseBehavior DatabaseTestBehavior - { - get { return DatabaseBehavior.NewSchemaPerFixture; } - } - + [Test] public void EntityService_Can_Find_All_Content_By_UmbracoObjectTypes() { diff --git a/src/Umbraco.Tests/Services/Importing/PackageImportTests.cs b/src/Umbraco.Tests/Services/Importing/PackageImportTests.cs index 17b092c16b..a730b184c4 100644 --- a/src/Umbraco.Tests/Services/Importing/PackageImportTests.cs +++ b/src/Umbraco.Tests/Services/Importing/PackageImportTests.cs @@ -5,9 +5,11 @@ using NUnit.Framework; using Umbraco.Core.Models; using Umbraco.Core; using Umbraco.Core.Models.Rdbms; +using Umbraco.Tests.TestHelpers; namespace Umbraco.Tests.Services.Importing { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture, RequiresSTA] public class PackageImportTests : BaseServiceTest { diff --git a/src/Umbraco.Tests/Services/LocalizationServiceTests.cs b/src/Umbraco.Tests/Services/LocalizationServiceTests.cs index 8b4a0ce0fa..641c724059 100644 --- a/src/Umbraco.Tests/Services/LocalizationServiceTests.cs +++ b/src/Umbraco.Tests/Services/LocalizationServiceTests.cs @@ -1,4 +1,5 @@ using NUnit.Framework; +using Umbraco.Tests.TestHelpers; namespace Umbraco.Tests.Services { @@ -7,6 +8,7 @@ namespace Umbraco.Tests.Services /// This is more of an integration test as it involves multiple layers /// as well as configuration. /// + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture, RequiresSTA] public class LocalizationServiceTests : BaseServiceTest { diff --git a/src/Umbraco.Tests/Services/MediaServiceTests.cs b/src/Umbraco.Tests/Services/MediaServiceTests.cs index fa9e530f3a..d6a3fe82c9 100644 --- a/src/Umbraco.Tests/Services/MediaServiceTests.cs +++ b/src/Umbraco.Tests/Services/MediaServiceTests.cs @@ -4,10 +4,12 @@ using System.Linq; using System.Text; using NUnit.Framework; using Umbraco.Core.Models; +using Umbraco.Tests.TestHelpers; using Umbraco.Tests.TestHelpers.Entities; namespace Umbraco.Tests.Services { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture, RequiresSTA] public class MediaServiceTests : BaseServiceTest { diff --git a/src/Umbraco.Tests/Services/MemberServiceTests.cs b/src/Umbraco.Tests/Services/MemberServiceTests.cs index 75e520db61..76ec157313 100644 --- a/src/Umbraco.Tests/Services/MemberServiceTests.cs +++ b/src/Umbraco.Tests/Services/MemberServiceTests.cs @@ -8,10 +8,12 @@ using Umbraco.Core.Models.Rdbms; using Umbraco.Core.Persistence; using Umbraco.Core.Persistence.Querying; using Umbraco.Core.Services; +using Umbraco.Tests.TestHelpers; using Umbraco.Tests.TestHelpers.Entities; namespace Umbraco.Tests.Services { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture, RequiresSTA] public class MemberServiceTests : BaseServiceTest { diff --git a/src/Umbraco.Tests/Services/MemberTypeServiceTests.cs b/src/Umbraco.Tests/Services/MemberTypeServiceTests.cs index bf93abe8e7..e4b891ac2e 100644 --- a/src/Umbraco.Tests/Services/MemberTypeServiceTests.cs +++ b/src/Umbraco.Tests/Services/MemberTypeServiceTests.cs @@ -6,10 +6,12 @@ using umbraco.cms.presentation.create.controls; using Umbraco.Core; using Umbraco.Core.Models; using Umbraco.Core.Models.Rdbms; +using Umbraco.Tests.TestHelpers; using Umbraco.Tests.TestHelpers.Entities; namespace Umbraco.Tests.Services { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture, RequiresSTA] public class MemberTypeServiceTests : BaseServiceTest { diff --git a/src/Umbraco.Tests/Services/PackagingServiceTests.cs b/src/Umbraco.Tests/Services/PackagingServiceTests.cs index f1da377d4d..db260b650c 100644 --- a/src/Umbraco.Tests/Services/PackagingServiceTests.cs +++ b/src/Umbraco.Tests/Services/PackagingServiceTests.cs @@ -5,9 +5,11 @@ using System.Xml.Linq; using NUnit.Framework; using Umbraco.Core.Models; using Umbraco.Tests.Services.Importing; +using Umbraco.Tests.TestHelpers; namespace Umbraco.Tests.Services { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture] public class PackagingServiceTests : BaseServiceTest { diff --git a/src/Umbraco.Tests/Services/PerformanceTests.cs b/src/Umbraco.Tests/Services/PerformanceTests.cs index ed8fd65b76..7e754b6635 100644 --- a/src/Umbraco.Tests/Services/PerformanceTests.cs +++ b/src/Umbraco.Tests/Services/PerformanceTests.cs @@ -26,6 +26,7 @@ namespace Umbraco.Tests.Services /// This is more of an integration test as it involves multiple layers /// as well as configuration. /// + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerTest)] [TestFixture, RequiresSTA] [NUnit.Framework.Ignore("These should not be run by the server, only directly as they are only benchmark tests")] public class PerformanceTests : BaseDatabaseFactoryTest @@ -46,13 +47,6 @@ namespace Umbraco.Tests.Services return "System.Data.SqlClient"; } - /// - /// new schema per test - /// - protected override DatabaseBehavior DatabaseTestBehavior - { - get { return DatabaseBehavior.NewSchemaPerTest; } - } /// /// don't create anything, we're testing against our own server diff --git a/src/Umbraco.Tests/Services/RelationServiceTests.cs b/src/Umbraco.Tests/Services/RelationServiceTests.cs index e2b9f57287..d98ff2b128 100644 --- a/src/Umbraco.Tests/Services/RelationServiceTests.cs +++ b/src/Umbraco.Tests/Services/RelationServiceTests.cs @@ -2,9 +2,11 @@ using System; using NUnit.Framework; using Umbraco.Core; using Umbraco.Core.Models; +using Umbraco.Tests.TestHelpers; namespace Umbraco.Tests.Services { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture, RequiresSTA] public class RelationServiceTests : BaseServiceTest { diff --git a/src/Umbraco.Tests/Services/ThreadSafetyServiceTest.cs b/src/Umbraco.Tests/Services/ThreadSafetyServiceTest.cs index f7f043bd7a..c225c23993 100644 --- a/src/Umbraco.Tests/Services/ThreadSafetyServiceTest.cs +++ b/src/Umbraco.Tests/Services/ThreadSafetyServiceTest.cs @@ -19,6 +19,7 @@ using umbraco.interfaces; namespace Umbraco.Tests.Services { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture, RequiresSTA] public class ThreadSafetyServiceTest : BaseDatabaseFactoryTest { diff --git a/src/Umbraco.Tests/Services/UserServiceTests.cs b/src/Umbraco.Tests/Services/UserServiceTests.cs index 932b12cce0..e327c2fbaf 100644 --- a/src/Umbraco.Tests/Services/UserServiceTests.cs +++ b/src/Umbraco.Tests/Services/UserServiceTests.cs @@ -18,6 +18,7 @@ namespace Umbraco.Tests.Services /// /// Tests covering the UserService /// + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture, RequiresSTA] public class UserServiceTests : BaseServiceTest { diff --git a/src/Umbraco.Tests/Surface/PluginControllerAreaTests.cs b/src/Umbraco.Tests/Surface/PluginControllerAreaTests.cs index 20cac092a0..2ed7bf9876 100644 --- a/src/Umbraco.Tests/Surface/PluginControllerAreaTests.cs +++ b/src/Umbraco.Tests/Surface/PluginControllerAreaTests.cs @@ -12,11 +12,7 @@ namespace Umbraco.Tests.Surface [TestFixture] public class PluginControllerAreaTests : BaseWebTest { - protected override DatabaseBehavior DatabaseTestBehavior - { - get { return DatabaseBehavior.NoDatabasePerFixture; } - } - + [Test] public void Ensure_Same_Area1() { diff --git a/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs b/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs index bf67b5610c..e234c140fa 100644 --- a/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs +++ b/src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs @@ -78,7 +78,7 @@ namespace Umbraco.Tests.TestHelpers base.Initialize(); - using (DisposableTimer.TraceDuration("init")) + using (DisposableTimer.TraceDuration("base db init")) { //TODO: Somehow make this faster - takes 5s + @@ -99,9 +99,13 @@ namespace Umbraco.Tests.TestHelpers /// /// The database behavior to use for the test/fixture /// - protected virtual DatabaseBehavior DatabaseTestBehavior + protected DatabaseBehavior DatabaseTestBehavior { - get { return DatabaseBehavior.NewSchemaPerTest; } + get + { + var att = this.GetType().GetCustomAttribute(false); + return att != null ? att.Behavior : DatabaseBehavior.NoDatabasePerFixture; + } } protected virtual string GetDbProviderName() @@ -146,29 +150,27 @@ namespace Umbraco.Tests.TestHelpers || DatabaseTestBehavior == DatabaseBehavior.NewDbFileAndSchemaPerTest || (_isFirstTestInFixture && DatabaseTestBehavior == DatabaseBehavior.NewDbFileAndSchemaPerFixture)) { - - RemoveDatabaseFile(ex => + + using (DisposableTimer.TraceDuration("Remove database file")) + { + RemoveDatabaseFile(ex => { //if this doesn't work we have to make sure everything is reset! otherwise // well run into issues because we've already set some things up TearDown(); throw ex; }); + } //Create the Sql CE database - var engine = new SqlCeEngine(settings.ConnectionString); - engine.CreateDatabase(); + using (DisposableTimer.TraceDuration("Create database file")) + { + var engine = new SqlCeEngine(settings.ConnectionString); + engine.CreateDatabase(); + } + } - //clear the database if - // - NewSchemaPerTest - // - _isFirstTestInFixture + DbInitBehavior.NewSchemaPerFixture - - else if (DatabaseTestBehavior == DatabaseBehavior.NewSchemaPerTest - || (_isFirstTestInFixture && DatabaseTestBehavior == DatabaseBehavior.NewSchemaPerFixture)) - { - DatabaseContext.Database.UninstallDatabaseSchema(); - } } /// @@ -210,15 +212,11 @@ namespace Umbraco.Tests.TestHelpers //create the schema and load default data if: // - is the first test in the session - // - NewSchemaPerTest // - NewDbFileAndSchemaPerTest - // - _isFirstTestInFixture + DbInitBehavior.NewSchemaPerFixture // - _isFirstTestInFixture + DbInitBehavior.NewDbFileAndSchemaPerFixture if (_isFirstRunInTestSession - || DatabaseTestBehavior == DatabaseBehavior.NewSchemaPerTest || DatabaseTestBehavior == DatabaseBehavior.NewDbFileAndSchemaPerTest - || (_isFirstTestInFixture && DatabaseTestBehavior == DatabaseBehavior.NewSchemaPerFixture) || (_isFirstTestInFixture && DatabaseTestBehavior == DatabaseBehavior.NewDbFileAndSchemaPerFixture)) { //Create the umbraco database and its base data @@ -229,10 +227,7 @@ namespace Umbraco.Tests.TestHelpers [TestFixtureTearDown] public void FixtureTearDown() { - if (DatabaseTestBehavior == DatabaseBehavior.NewDbFileAndSchemaPerFixture) - { - RemoveDatabaseFile(); - } + RemoveDatabaseFile(); } [TearDown] @@ -243,11 +238,7 @@ namespace Umbraco.Tests.TestHelpers if (DatabaseTestBehavior == DatabaseBehavior.NewDbFileAndSchemaPerTest) { RemoveDatabaseFile(); - } - else if (DatabaseTestBehavior == DatabaseBehavior.NewSchemaPerTest) - { - DatabaseContext.Database.UninstallDatabaseSchema(); - } + } AppDomain.CurrentDomain.SetData("DataDirectory", null); diff --git a/src/Umbraco.Tests/TestHelpers/DatabaseBehavior.cs b/src/Umbraco.Tests/TestHelpers/DatabaseBehavior.cs index 40c5190047..643d324370 100644 --- a/src/Umbraco.Tests/TestHelpers/DatabaseBehavior.cs +++ b/src/Umbraco.Tests/TestHelpers/DatabaseBehavior.cs @@ -14,20 +14,11 @@ /// For each test a new database file and schema will be created /// NewDbFileAndSchemaPerTest, - - /// - /// For each test a new schema will be created on the existing database file - /// - NewSchemaPerTest, - + /// /// Creates a new database file and schema for the whole fixture, each test will use the pre-existing one /// - NewDbFileAndSchemaPerFixture, - - /// - /// Creates a new schema based on the existing database file for the whole fixture, each test will use the pre-existing one - /// - NewSchemaPerFixture, + NewDbFileAndSchemaPerFixture + } } \ No newline at end of file diff --git a/src/Umbraco.Tests/TestHelpers/DatabaseTestBehaviorAttribute.cs b/src/Umbraco.Tests/TestHelpers/DatabaseTestBehaviorAttribute.cs new file mode 100644 index 0000000000..a6bee4515c --- /dev/null +++ b/src/Umbraco.Tests/TestHelpers/DatabaseTestBehaviorAttribute.cs @@ -0,0 +1,15 @@ +using System; + +namespace Umbraco.Tests.TestHelpers +{ + [AttributeUsage(AttributeTargets.Class)] + public sealed class DatabaseTestBehaviorAttribute : Attribute + { + public DatabaseBehavior Behavior { get; private set; } + + public DatabaseTestBehaviorAttribute(DatabaseBehavior behavior) + { + Behavior = behavior; + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index b8736f8695..a6aaf12fb7 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -182,7 +182,6 @@ - @@ -399,6 +398,7 @@ + diff --git a/src/Umbraco.Tests/UmbracoExamine/ContentServiceTest.cs b/src/Umbraco.Tests/UmbracoExamine/ContentServiceTest.cs index fd408bcc88..b41ad94573 100644 --- a/src/Umbraco.Tests/UmbracoExamine/ContentServiceTest.cs +++ b/src/Umbraco.Tests/UmbracoExamine/ContentServiceTest.cs @@ -7,6 +7,7 @@ using UmbracoExamine.DataServices; namespace Umbraco.Tests.UmbracoExamine { + [DatabaseTestBehavior(DatabaseBehavior.NewDbFileAndSchemaPerFixture)] [TestFixture] public class ContentServiceTest : BaseDatabaseFactoryTest {