diff --git a/src/Umbraco.Tests.Common/TestHelperBase.cs b/src/Umbraco.Tests.Common/TestHelperBase.cs index 21b1f66395..5f4faf8547 100644 --- a/src/Umbraco.Tests.Common/TestHelperBase.cs +++ b/src/Umbraco.Tests.Common/TestHelperBase.cs @@ -116,7 +116,7 @@ namespace Umbraco.Tests.Common /// /// /// - public string MapPathForTestFiles(string relativePath) + public virtual string MapPathForTestFiles(string relativePath) { if (!relativePath.StartsWith("~/")) throw new ArgumentException("relativePath must start with '~/'", nameof(relativePath)); diff --git a/src/Umbraco.Tests.Integration/Extensions/ApplicationBuilderExtensions.cs b/src/Umbraco.Tests.Integration/Extensions/ApplicationBuilderExtensions.cs index 5593a4aa69..52780e6d4f 100644 --- a/src/Umbraco.Tests.Integration/Extensions/ApplicationBuilderExtensions.cs +++ b/src/Umbraco.Tests.Integration/Extensions/ApplicationBuilderExtensions.cs @@ -5,9 +5,7 @@ using System.IO; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; using NUnit.Framework; -using Umbraco.Configuration.Models; using Umbraco.Core; using Umbraco.Core.Configuration; using Umbraco.Core.Logging; @@ -63,7 +61,7 @@ namespace Umbraco.Tests.Integration.Extensions var dbFactory = app.ApplicationServices.GetRequiredService(); if (!dbFactory.Configured) { - dbFactory.Configure(db.ConnectionString, Umbraco.Core.Constants.DatabaseProviders.SqlServer); + dbFactory.Configure(db.ConnectionString, Constants.DatabaseProviders.SqlServer); } // In the case that we've initialized the schema, it means that we are installed so we'll want to ensure that diff --git a/src/Umbraco.Tests.Integration/Extensions/ServiceCollectionExtensions.cs b/src/Umbraco.Tests.Integration/Extensions/ServiceCollectionExtensions.cs index fabb3e9da0..dc58d3e9e6 100644 --- a/src/Umbraco.Tests.Integration/Extensions/ServiceCollectionExtensions.cs +++ b/src/Umbraco.Tests.Integration/Extensions/ServiceCollectionExtensions.cs @@ -2,7 +2,6 @@ using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using Umbraco.Core.Composing; using Umbraco.Tests.Integration.Implementations; namespace Umbraco.Tests.Integration.Extensions diff --git a/src/Umbraco.Tests.Integration/Implementations/TestHelper.cs b/src/Umbraco.Tests.Integration/Implementations/TestHelper.cs index eb96ca01a8..8a660b490b 100644 --- a/src/Umbraco.Tests.Integration/Implementations/TestHelper.cs +++ b/src/Umbraco.Tests.Integration/Implementations/TestHelper.cs @@ -17,8 +17,6 @@ using Umbraco.Net; using Umbraco.Core.Persistence; using Umbraco.Core.Runtime; using Umbraco.Tests.Common; -using Umbraco.Web.BackOffice; -using Umbraco.Web.BackOffice.AspNetCore; using Umbraco.Web.Common.AspNetCore; using IHostingEnvironment = Umbraco.Core.Hosting.IHostingEnvironment; @@ -43,7 +41,8 @@ namespace Umbraco.Tests.Integration.Implementations var hostEnvironment = new Mock(); hostEnvironment.Setup(x => x.ApplicationName).Returns("UmbracoIntegrationTests"); - hostEnvironment.Setup(x => x.ContentRootPath).Returns(() => Assembly.GetExecutingAssembly().GetRootDirectorySafe()); + hostEnvironment.Setup(x => x.ContentRootPath) + .Returns(() => Assembly.GetExecutingAssembly().GetRootDirectorySafe()); hostEnvironment.Setup(x => x.WebRootPath).Returns(() => WorkingDirectory); _hostEnvironment = hostEnvironment.Object; @@ -79,9 +78,11 @@ namespace Umbraco.Tests.Integration.Implementations } } - public IUmbracoBootPermissionChecker UmbracoBootPermissionChecker { get; } = new TestUmbracoBootPermissionChecker(); + public IUmbracoBootPermissionChecker UmbracoBootPermissionChecker { get; } = + new TestUmbracoBootPermissionChecker(); - public AppCaches AppCaches { get; } = new AppCaches(NoAppCache.Instance, NoAppCache.Instance, new IsolatedCaches(type => NoAppCache.Instance)); + public AppCaches AppCaches { get; } = new AppCaches(NoAppCache.Instance, NoAppCache.Instance, + new IsolatedCaches(type => NoAppCache.Instance)); public IProfilingLogger Logger { get; private set; } @@ -91,7 +92,8 @@ namespace Umbraco.Tests.Integration.Implementations public IWebHostEnvironment GetWebHostEnvironment() => _hostEnvironment; - public override IDbProviderFactoryCreator DbProviderFactoryCreator => new SqlServerDbProviderFactoryCreator(Constants.DbProviderNames.SqlServer, DbProviderFactories.GetFactory); + public override IDbProviderFactoryCreator DbProviderFactoryCreator => + new SqlServerDbProviderFactoryCreator(Constants.DbProviderNames.SqlServer, DbProviderFactories.GetFactory); public override IBulkSqlInsertProvider BulkSqlInsertProvider => new SqlServerBulkSqlInsertProvider(); @@ -100,7 +102,8 @@ namespace Umbraco.Tests.Integration.Implementations public override IBackOfficeInfo GetBackOfficeInfo() { if (_backOfficeInfo == null) - _backOfficeInfo = new AspNetCoreBackOfficeInfo(SettingsForTests.GetDefaultGlobalSettings(GetUmbracoVersion())); + _backOfficeInfo = + new AspNetCoreBackOfficeInfo(SettingsForTests.GetDefaultGlobalSettings(GetUmbracoVersion())); return _backOfficeInfo; } @@ -113,5 +116,22 @@ namespace Umbraco.Tests.Integration.Implementations public override IIpResolver GetIpResolver() => _ipResolver; + /// + /// Some test files are copied to the /bin (/bin/debug) on build, this is a utility to return their physical path based on a virtual path name + /// + /// + /// + public override string MapPathForTestFiles(string relativePath) + { + if (!relativePath.StartsWith("~/")) + throw new ArgumentException("relativePath must start with '~/'", nameof(relativePath)); + + var codeBase = typeof(TestHelperBase).Assembly.CodeBase; + var uri = new Uri(codeBase); + var path = uri.LocalPath; + var bin = Path.GetDirectoryName(path); + + return relativePath.Replace("~/", bin + "/"); + } } } diff --git a/src/Umbraco.Tests.Integration/Implementations/TestHostingEnvironment.cs b/src/Umbraco.Tests.Integration/Implementations/TestHostingEnvironment.cs index 9f29b14858..076cecef4a 100644 --- a/src/Umbraco.Tests.Integration/Implementations/TestHostingEnvironment.cs +++ b/src/Umbraco.Tests.Integration/Implementations/TestHostingEnvironment.cs @@ -1,13 +1,13 @@ using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Http; using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using Umbraco.Web.Common.AspNetCore; +using IHostingEnvironment = Umbraco.Core.Hosting.IHostingEnvironment; namespace Umbraco.Tests.Integration.Implementations { - public class TestHostingEnvironment : AspNetCoreHostingEnvironment, Umbraco.Core.Hosting.IHostingEnvironment + public class TestHostingEnvironment : AspNetCoreHostingEnvironment, IHostingEnvironment { public TestHostingEnvironment(IHostingSettings hostingSettings, IWebHostEnvironment webHostEnvironment) : base(hostingSettings, webHostEnvironment) @@ -20,6 +20,6 @@ namespace Umbraco.Tests.Integration.Implementations /// /// This is specifically used by IOHelper and we want this to return false so that the root path is manually calcualted which is what we want for tests. /// - bool Umbraco.Core.Hosting.IHostingEnvironment.IsHosted { get; } = false; + bool IHostingEnvironment.IsHosted { get; } = false; } } diff --git a/src/Umbraco.Tests.Integration/Testing/LocalDbTestDatabase.cs b/src/Umbraco.Tests.Integration/Testing/LocalDbTestDatabase.cs index de7f9b14bb..f8695afddb 100644 --- a/src/Umbraco.Tests.Integration/Testing/LocalDbTestDatabase.cs +++ b/src/Umbraco.Tests.Integration/Testing/LocalDbTestDatabase.cs @@ -12,7 +12,6 @@ using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using Umbraco.Core.Migrations.Install; using Umbraco.Core.Persistence; -using Umbraco.Web.Common.RuntimeMinification; namespace Umbraco.Tests.Integration.Testing { @@ -122,7 +121,7 @@ namespace Umbraco.Tests.Integration.Testing } else { - _dbFactory.Configure(conn.ConnectionString, Umbraco.Core.Constants.DatabaseProviders.SqlServer); + _dbFactory.Configure(conn.ConnectionString, Constants.DatabaseProviders.SqlServer); using var database = (UmbracoDatabase)_dbFactory.CreateDatabase(); // track each db command ran as part of creating the database so we can replay these diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.config b/src/Umbraco.Tests.Integration/Umbraco.Configuration/Configurations/umbracoSettings.config similarity index 100% rename from src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.config rename to src/Umbraco.Tests.Integration/Umbraco.Configuration/Configurations/umbracoSettings.config diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.minimal.config b/src/Umbraco.Tests.Integration/Umbraco.Configuration/Configurations/umbracoSettings.minimal.config similarity index 100% rename from src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.minimal.config rename to src/Umbraco.Tests.Integration/Umbraco.Configuration/Configurations/umbracoSettings.minimal.config diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/web.config b/src/Umbraco.Tests.Integration/Umbraco.Configuration/Configurations/web.config similarity index 100% rename from src/Umbraco.Tests/Configurations/UmbracoSettings/web.config rename to src/Umbraco.Tests.Integration/Umbraco.Configuration/Configurations/web.config diff --git a/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/ContentElementDefaultTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/ContentElementDefaultTests.cs new file mode 100644 index 0000000000..436fb45377 --- /dev/null +++ b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/ContentElementDefaultTests.cs @@ -0,0 +1,70 @@ +using System; +using System.Linq; +using NUnit.Framework; +using Umbraco.Core; +using Umbraco.Core.Configuration.UmbracoSettings; + +namespace Umbraco.Tests.Integration.Umbraco.Configuration.UmbracoSettings +{ + [TestFixture] + public class ContentElementDefaultTests : ContentElementTests + { + protected override bool TestingDefaults => true; + + [Test] + public override void DisableHtmlEmail() + { + Assert.IsTrue(ContentSettings.DisableHtmlEmail == false); + } + + [Test] + public override void Can_Set_Multiple() + { + Assert.IsTrue(ContentSettings.Error404Collection.Count() == 1); + Assert.IsTrue(ContentSettings.Error404Collection.ElementAt(0).Culture == null); + Assert.IsTrue(ContentSettings.Error404Collection.ElementAt(0).ContentId == 1); + } + + [Test] + public override void ImageAutoFillProperties() + { + Assert.IsTrue(ContentSettings.ImageAutoFillProperties.Count() == 1); + Assert.IsTrue(ContentSettings.ImageAutoFillProperties.ElementAt(0).Alias == "umbracoFile"); + Assert.IsTrue(ContentSettings.ImageAutoFillProperties.ElementAt(0).WidthFieldAlias == "umbracoWidth"); + Assert.IsTrue(ContentSettings.ImageAutoFillProperties.ElementAt(0).HeightFieldAlias == "umbracoHeight"); + Assert.IsTrue(ContentSettings.ImageAutoFillProperties.ElementAt(0).LengthFieldAlias == "umbracoBytes"); + Assert.IsTrue(ContentSettings.ImageAutoFillProperties.ElementAt(0).ExtensionFieldAlias == "umbracoExtension"); + } + + /// + /// Whitelist is empty in default settings file and is not populated by default, but disallowed is empty and is populated by default + /// + /// + /// + [Test] + [TestCase("png", true)] + [TestCase("jpg", true)] + [TestCase("gif", true)] + [TestCase("bmp", true)] + [TestCase("php", true)] + [TestCase("ashx", false)] + [TestCase("config", false)] + [TestCase("test", true)] + public override void IsFileAllowedForUpload_WithWhitelist(string extension, bool expected) + { + Console.WriteLine("Extension being tested: {0}", extension); + Console.WriteLine("Expected IsAllowed?: {0}", expected); + Console.WriteLine("AllowedUploadFiles: {0}", ContentSettings.AllowedUploadFiles); + Console.WriteLine("DisallowedUploadFiles: {0}", ContentSettings.DisallowedUploadFiles); + + bool allowedContainsExtension = ContentSettings.AllowedUploadFiles.Any(x => x.InvariantEquals(extension)); + bool disallowedContainsExtension = ContentSettings.DisallowedUploadFiles.Any(x => x.InvariantEquals(extension)); + + Console.WriteLine("AllowedContainsExtension: {0}", allowedContainsExtension); + Console.WriteLine("DisallowedContainsExtension: {0}", disallowedContainsExtension); + + Assert.AreEqual(expected, ContentSettings.IsFileAllowedForUpload(extension)); + } + + } +} diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/ContentElementTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/ContentElementTests.cs similarity index 84% rename from src/Umbraco.Tests/Configurations/UmbracoSettings/ContentElementTests.cs rename to src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/ContentElementTests.cs index 668d0b0297..21fd59de3a 100644 --- a/src/Umbraco.Tests/Configurations/UmbracoSettings/ContentElementTests.cs +++ b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/ContentElementTests.cs @@ -1,14 +1,12 @@ using System; -using System.Collections.Generic; using System.Diagnostics; using System.Linq; using NUnit.Framework; using Umbraco.Core; -using Umbraco.Core.Configuration; using Umbraco.Core.Configuration.UmbracoSettings; using Umbraco.Core.Macros; -namespace Umbraco.Tests.Configurations.UmbracoSettings +namespace Umbraco.Tests.Integration.Umbraco.Configuration.UmbracoSettings { [TestFixture] public class ContentElementTests : UmbracoSettingsTests @@ -96,25 +94,23 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings [TestCase("png", true)] [TestCase("jpg", true)] [TestCase("gif", true)] - // TODO: Why does it flip to TestingDefaults=true for these two tests on AppVeyor. WHY? - //[TestCase("bmp", false)] - //[TestCase("php", false)] + [TestCase("bmp", false)] + [TestCase("php", false)] [TestCase("ashx", false)] [TestCase("config", false)] - public void IsFileAllowedForUpload_WithWhitelist(string extension, bool expected) + [TestCase("test", false)] + public virtual void IsFileAllowedForUpload_WithWhitelist(string extension, bool expected) { - // Make really sure that defaults are NOT used - TestingDefaults = false; + Console.WriteLine("Extension being tested: {0}", extension); + Console.WriteLine("Expected IsAllowed?: {0}", expected); + Console.WriteLine("AllowedUploadFiles: {0}", ContentSettings.AllowedUploadFiles); + Console.WriteLine("DisallowedUploadFiles: {0}", ContentSettings.DisallowedUploadFiles); - Debug.WriteLine("Extension being tested", extension); - Debug.WriteLine("AllowedUploadFiles: {0}", ContentSettings.AllowedUploadFiles); - Debug.WriteLine("DisallowedUploadFiles: {0}", ContentSettings.DisallowedUploadFiles); + bool allowedContainsExtension = ContentSettings.AllowedUploadFiles.Any(x => x.InvariantEquals(extension)); + bool disallowedContainsExtension = ContentSettings.DisallowedUploadFiles.Any(x => x.InvariantEquals(extension)); - var allowedContainsExtension = ContentSettings.AllowedUploadFiles.Any(x => x.InvariantEquals(extension)); - var disallowedContainsExtension = ContentSettings.DisallowedUploadFiles.Any(x => x.InvariantEquals(extension)); - - Debug.WriteLine("AllowedContainsExtension: {0}", allowedContainsExtension); - Debug.WriteLine("DisallowedContainsExtension: {0}", disallowedContainsExtension); + Console.WriteLine("AllowedContainsExtension: {0}", allowedContainsExtension); + Console.WriteLine("DisallowedContainsExtension: {0}", disallowedContainsExtension); Assert.AreEqual(expected, ContentSettings.IsFileAllowedForUpload(extension)); } diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/LoggingElementDefaultTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/LoggingElementDefaultTests.cs similarity index 54% rename from src/Umbraco.Tests/Configurations/UmbracoSettings/LoggingElementDefaultTests.cs rename to src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/LoggingElementDefaultTests.cs index cdd5855730..084c649f11 100644 --- a/src/Umbraco.Tests/Configurations/UmbracoSettings/LoggingElementDefaultTests.cs +++ b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/LoggingElementDefaultTests.cs @@ -1,15 +1,11 @@ -using System.Linq; -using NUnit.Framework; +using NUnit.Framework; -namespace Umbraco.Tests.Configurations.UmbracoSettings +namespace Umbraco.Tests.Integration.Umbraco.Configuration.UmbracoSettings { [TestFixture] public class LoggingElementDefaultTests : LoggingElementTests { - protected override bool TestingDefaults - { - get { return true; } - } + protected override bool TestingDefaults => true; [Test] public override void MaxLogAge() diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/LoggingElementTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/LoggingElementTests.cs similarity index 70% rename from src/Umbraco.Tests/Configurations/UmbracoSettings/LoggingElementTests.cs rename to src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/LoggingElementTests.cs index be495ad9d0..3fd8041540 100644 --- a/src/Umbraco.Tests/Configurations/UmbracoSettings/LoggingElementTests.cs +++ b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/LoggingElementTests.cs @@ -1,7 +1,6 @@ -using System.Linq; -using NUnit.Framework; +using NUnit.Framework; -namespace Umbraco.Tests.Configurations.UmbracoSettings +namespace Umbraco.Tests.Integration.Umbraco.Configuration.UmbracoSettings { [TestFixture] public class LoggingElementTests : UmbracoSettingsTests diff --git a/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/RequestHandlerElementDefaultTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/RequestHandlerElementDefaultTests.cs new file mode 100644 index 0000000000..c2e21c5e2c --- /dev/null +++ b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/RequestHandlerElementDefaultTests.cs @@ -0,0 +1,10 @@ +using NUnit.Framework; + +namespace Umbraco.Tests.Integration.Umbraco.Configuration.UmbracoSettings +{ + [TestFixture] + public class RequestHandlerElementDefaultTests : RequestHandlerElementTests + { + protected override bool TestingDefaults => true; + } +} diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/RequestHandlerElementTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/RequestHandlerElementTests.cs similarity index 94% rename from src/Umbraco.Tests/Configurations/UmbracoSettings/RequestHandlerElementTests.cs rename to src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/RequestHandlerElementTests.cs index bb4d1efd1e..01a2b48e16 100644 --- a/src/Umbraco.Tests/Configurations/UmbracoSettings/RequestHandlerElementTests.cs +++ b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/RequestHandlerElementTests.cs @@ -2,7 +2,7 @@ using NUnit.Framework; using Umbraco.Core; -namespace Umbraco.Tests.Configurations.UmbracoSettings +namespace Umbraco.Tests.Integration.Umbraco.Configuration.UmbracoSettings { [TestFixture] public class RequestHandlerElementTests : UmbracoSettingsTests diff --git a/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/SecurityElementDefaultTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/SecurityElementDefaultTests.cs new file mode 100644 index 0000000000..f5566df5ed --- /dev/null +++ b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/SecurityElementDefaultTests.cs @@ -0,0 +1,10 @@ +using NUnit.Framework; + +namespace Umbraco.Tests.Integration.Umbraco.Configuration.UmbracoSettings +{ + [TestFixture] + public class SecurityElementDefaultTests : SecurityElementTests + { + protected override bool TestingDefaults => true; + } +} diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/SecurityElementTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/SecurityElementTests.cs similarity index 97% rename from src/Umbraco.Tests/Configurations/UmbracoSettings/SecurityElementTests.cs rename to src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/SecurityElementTests.cs index 2eccd50295..6255bfa790 100644 --- a/src/Umbraco.Tests/Configurations/UmbracoSettings/SecurityElementTests.cs +++ b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/SecurityElementTests.cs @@ -1,7 +1,6 @@ using NUnit.Framework; -using Umbraco.Core; -namespace Umbraco.Tests.Configurations.UmbracoSettings +namespace Umbraco.Tests.Integration.Umbraco.Configuration.UmbracoSettings { [TestFixture] public class SecurityElementTests : UmbracoSettingsTests diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/UmbracoSettingsTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/UmbracoSettingsTests.cs similarity index 85% rename from src/Umbraco.Tests/Configurations/UmbracoSettings/UmbracoSettingsTests.cs rename to src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/UmbracoSettingsTests.cs index 0829de6668..e869a972f5 100644 --- a/src/Umbraco.Tests/Configurations/UmbracoSettings/UmbracoSettingsTests.cs +++ b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/UmbracoSettingsTests.cs @@ -4,9 +4,9 @@ using System.IO; using NUnit.Framework; using Umbraco.Core.Configuration; using Umbraco.Core.Configuration.UmbracoSettings; -using Umbraco.Tests.TestHelpers; +using Umbraco.Tests.Integration.Implementations; -namespace Umbraco.Tests.Configurations.UmbracoSettings +namespace Umbraco.Tests.Integration.Umbraco.Configuration.UmbracoSettings { public abstract class UmbracoSettingsTests { @@ -15,7 +15,8 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings [SetUp] public void Init() { - var config = new FileInfo(TestHelper.MapPathForTestFiles("~/Configurations/UmbracoSettings/web.config")); + var testHelper = new TestHelper(); + var config = new FileInfo(testHelper.MapPathForTestFiles("~/Umbraco.Configuration/Configurations/web.config")); var fileMap = new ExeConfigurationFileMap() { ExeConfigFilename = config.FullName }; var configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None); diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/WebRoutingElementDefaultTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/WebRoutingElementDefaultTests.cs similarity index 86% rename from src/Umbraco.Tests/Configurations/UmbracoSettings/WebRoutingElementDefaultTests.cs rename to src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/WebRoutingElementDefaultTests.cs index 73483ee8d2..e85911d559 100644 --- a/src/Umbraco.Tests/Configurations/UmbracoSettings/WebRoutingElementDefaultTests.cs +++ b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/WebRoutingElementDefaultTests.cs @@ -1,15 +1,11 @@ using NUnit.Framework; -namespace Umbraco.Tests.Configurations.UmbracoSettings +namespace Umbraco.Tests.Integration.Umbraco.Configuration.UmbracoSettings { [TestFixture] public class WebRoutingElementDefaultTests : WebRoutingElementTests { - - protected override bool TestingDefaults - { - get { return true; } - } + protected override bool TestingDefaults => true; [Test] public override void UrlProviderMode() diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/WebRoutingElementTests.cs b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/WebRoutingElementTests.cs similarity index 89% rename from src/Umbraco.Tests/Configurations/UmbracoSettings/WebRoutingElementTests.cs rename to src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/WebRoutingElementTests.cs index 8068c1605f..532b27494f 100644 --- a/src/Umbraco.Tests/Configurations/UmbracoSettings/WebRoutingElementTests.cs +++ b/src/Umbraco.Tests.Integration/Umbraco.Configuration/UmbracoSettings/WebRoutingElementTests.cs @@ -1,6 +1,6 @@ using NUnit.Framework; -namespace Umbraco.Tests.Configurations.UmbracoSettings +namespace Umbraco.Tests.Integration.Umbraco.Configuration.UmbracoSettings { [TestFixture] public class WebRoutingElementTests : UmbracoSettingsTests diff --git a/src/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj b/src/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj index 1ad1b73b42..e203d378ef 100644 --- a/src/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj +++ b/src/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj @@ -32,4 +32,16 @@ + + + Always + + + Always + + + Always + + + diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/ContentElementDefaultTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/ContentElementDefaultTests.cs deleted file mode 100644 index b14319b1b7..0000000000 --- a/src/Umbraco.Tests/Configurations/UmbracoSettings/ContentElementDefaultTests.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Linq; -using NUnit.Framework; - -namespace Umbraco.Tests.Configurations.UmbracoSettings -{ - [TestFixture] - public class ContentElementDefaultTests : ContentElementTests - { - protected override bool TestingDefaults - { - get { return true; } - } - - [Test] - public override void DisableHtmlEmail() - { - Assert.IsTrue(ContentSettings.DisableHtmlEmail == false); - } - - [Test] - public override void Can_Set_Multiple() - { - Assert.IsTrue(ContentSettings.Error404Collection.Count() == 1); - Assert.IsTrue(ContentSettings.Error404Collection.ElementAt(0).Culture == null); - Assert.IsTrue(ContentSettings.Error404Collection.ElementAt(0).ContentId == 1); - } - - [Test] - public override void ImageAutoFillProperties() - { - Assert.IsTrue(ContentSettings.ImageAutoFillProperties.Count() == 1); - Assert.IsTrue(ContentSettings.ImageAutoFillProperties.ElementAt(0).Alias == "umbracoFile"); - Assert.IsTrue(ContentSettings.ImageAutoFillProperties.ElementAt(0).WidthFieldAlias == "umbracoWidth"); - Assert.IsTrue(ContentSettings.ImageAutoFillProperties.ElementAt(0).HeightFieldAlias == "umbracoHeight"); - Assert.IsTrue(ContentSettings.ImageAutoFillProperties.ElementAt(0).LengthFieldAlias == "umbracoBytes"); - Assert.IsTrue(ContentSettings.ImageAutoFillProperties.ElementAt(0).ExtensionFieldAlias == "umbracoExtension"); - } - - } -} diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/RequestHandlerElementDefaultTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/RequestHandlerElementDefaultTests.cs deleted file mode 100644 index f0133baa60..0000000000 --- a/src/Umbraco.Tests/Configurations/UmbracoSettings/RequestHandlerElementDefaultTests.cs +++ /dev/null @@ -1,13 +0,0 @@ -using NUnit.Framework; - -namespace Umbraco.Tests.Configurations.UmbracoSettings -{ - [TestFixture] - public class RequestHandlerElementDefaultTests : RequestHandlerElementTests - { - protected override bool TestingDefaults - { - get { return true; } - } - } -} diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/SecurityElementDefaultTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/SecurityElementDefaultTests.cs deleted file mode 100644 index 8d998ead69..0000000000 --- a/src/Umbraco.Tests/Configurations/UmbracoSettings/SecurityElementDefaultTests.cs +++ /dev/null @@ -1,13 +0,0 @@ -using NUnit.Framework; - -namespace Umbraco.Tests.Configurations.UmbracoSettings -{ - [TestFixture] - public class SecurityElementDefaultTests : SecurityElementTests - { - protected override bool TestingDefaults - { - get { return true; } - } - } -} diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index 26c5316e07..2bd257468d 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -304,17 +304,6 @@ - - - - - - - - - - - @@ -514,14 +503,6 @@ Designer - - Designer - Always - - - Designer - Always - Always @@ -590,10 +571,6 @@ - - Designer - Always - Always