Moved all UmbracoSettings tests into new unit tests configuration project
Added InternalVisibleTo for new Unit Tests project Umbraco.Configuration, so the internals can be tested Moved TestHelpers for specific case into separate helper file, as independent helper, as this is the only method used. Changed from TestHelperBase to TestHelper. Subsequently changed path for testing
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Runtime.InteropServices;
|
||||
|
||||
// Umbraco Cms
|
||||
[assembly: InternalsVisibleTo("Umbraco.Tests")]
|
||||
[assembly: InternalsVisibleTo("Umbraco.Tests.UnitTests")]
|
||||
[assembly: InternalsVisibleTo("Umbraco.Tests.Common")]
|
||||
[assembly: InternalsVisibleTo("Umbraco.Tests.Benchmarks")]
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Umbraco.Tests.Configurations.UmbracoSettings
|
||||
namespace Umbraco.Tests.UnitTests.Umbraco.Configuration.UmbracoSettings
|
||||
{
|
||||
[TestFixture]
|
||||
public class ContentElementDefaultTests : ContentElementTests
|
||||
+1
-3
@@ -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.UnitTests.Umbraco.Configuration.UmbracoSettings
|
||||
{
|
||||
[TestFixture]
|
||||
public class ContentElementTests : UmbracoSettingsTests
|
||||
+2
-3
@@ -1,7 +1,6 @@
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Umbraco.Tests.Configurations.UmbracoSettings
|
||||
namespace Umbraco.Tests.UnitTests.Umbraco.Configuration.UmbracoSettings
|
||||
{
|
||||
[TestFixture]
|
||||
public class LoggingElementDefaultTests : LoggingElementTests
|
||||
+2
-3
@@ -1,7 +1,6 @@
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Umbraco.Tests.Configurations.UmbracoSettings
|
||||
namespace Umbraco.Tests.UnitTests.Umbraco.Configuration.UmbracoSettings
|
||||
{
|
||||
[TestFixture]
|
||||
public class LoggingElementTests : UmbracoSettingsTests
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Umbraco.Tests.Configurations.UmbracoSettings
|
||||
namespace Umbraco.Tests.UnitTests.Umbraco.Configuration.UmbracoSettings
|
||||
{
|
||||
[TestFixture]
|
||||
public class RequestHandlerElementDefaultTests : RequestHandlerElementTests
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
|
||||
namespace Umbraco.Tests.Configurations.UmbracoSettings
|
||||
namespace Umbraco.Tests.UnitTests.Umbraco.Configuration.UmbracoSettings
|
||||
{
|
||||
[TestFixture]
|
||||
public class RequestHandlerElementTests : UmbracoSettingsTests
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Umbraco.Tests.Configurations.UmbracoSettings
|
||||
namespace Umbraco.Tests.UnitTests.Umbraco.Configuration.UmbracoSettings
|
||||
{
|
||||
[TestFixture]
|
||||
public class SecurityElementDefaultTests : SecurityElementTests
|
||||
+1
-2
@@ -1,7 +1,6 @@
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
|
||||
namespace Umbraco.Tests.Configurations.UmbracoSettings
|
||||
namespace Umbraco.Tests.UnitTests.Umbraco.Configuration.UmbracoSettings
|
||||
{
|
||||
[TestFixture]
|
||||
public class SecurityElementTests : UmbracoSettingsTests
|
||||
+3
-3
@@ -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.UnitTests.Umbraco.Tests.Common.Helpers;
|
||||
|
||||
namespace Umbraco.Tests.Configurations.UmbracoSettings
|
||||
namespace Umbraco.Tests.UnitTests.Umbraco.Configuration.UmbracoSettings
|
||||
{
|
||||
public abstract class UmbracoSettingsTests
|
||||
{
|
||||
@@ -15,7 +15,7 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings
|
||||
[SetUp]
|
||||
public void Init()
|
||||
{
|
||||
var config = new FileInfo(TestHelper.MapPathForTestFiles("~/Configurations/UmbracoSettings/web.config"));
|
||||
var config = new FileInfo(TestHelper.MapPathForTestFiles("~/Umbraco.Configuration/UmbracoSettings/web.config"));
|
||||
|
||||
var fileMap = new ExeConfigurationFileMap() { ExeConfigFilename = config.FullName };
|
||||
var configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Umbraco.Tests.Configurations.UmbracoSettings
|
||||
namespace Umbraco.Tests.UnitTests.Umbraco.Configuration.UmbracoSettings
|
||||
{
|
||||
[TestFixture]
|
||||
public class WebRoutingElementDefaultTests : WebRoutingElementTests
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Umbraco.Tests.Configurations.UmbracoSettings
|
||||
namespace Umbraco.Tests.UnitTests.Umbraco.Configuration.UmbracoSettings
|
||||
{
|
||||
[TestFixture]
|
||||
public class WebRoutingElementTests : UmbracoSettingsTests
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Umbraco.Tests.UnitTests.Umbraco.Tests.Common.Helpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Common helper properties and methods useful to testing
|
||||
/// </summary>
|
||||
public static class TestHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
/// <param name="relativePath"></param>
|
||||
/// <returns></returns>
|
||||
public static string MapPathForTestFiles(string relativePath)
|
||||
{
|
||||
if (!relativePath.StartsWith("~/"))
|
||||
throw new ArgumentException("relativePath must start with '~/'", nameof(relativePath));
|
||||
|
||||
var codeBase = typeof(TestHelper).Assembly.CodeBase;
|
||||
var uri = new Uri(codeBase);
|
||||
var path = uri.LocalPath;
|
||||
var bin = Path.GetDirectoryName(path);
|
||||
|
||||
return relativePath.Replace("~/", bin + "/");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,4 +28,19 @@
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Umbraco.Configuration\UmbracoSettings\umbracoSettings.config">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Update="Umbraco.Configuration\UmbracoSettings\umbracoSettings.minimal.config">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Update="Umbraco.Configuration\UmbracoSettings\web.config">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -307,17 +307,6 @@
|
||||
<Compile Include="Cache\AppCacheTests.cs" />
|
||||
<Compile Include="Cache\HttpRequestAppCacheTests.cs" />
|
||||
<Compile Include="Cache\RuntimeAppCacheTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\ContentElementDefaultTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\ContentElementTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\LoggingElementDefaultTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\LoggingElementTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\RequestHandlerElementDefaultTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\RequestHandlerElementTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\SecurityElementDefaultTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\SecurityElementTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\UmbracoSettingsTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\WebRoutingElementDefaultTests.cs" />
|
||||
<Compile Include="Configurations\UmbracoSettings\WebRoutingElementTests.cs" />
|
||||
<Compile Include="Web\Controllers\ContentControllerUnitTests.cs" />
|
||||
<Compile Include="Web\Controllers\FilterAllowedOutgoingContentAttributeTests.cs" />
|
||||
<Compile Include="Web\Controllers\MediaControllerUnitTests.cs" />
|
||||
@@ -518,14 +507,6 @@
|
||||
<None Include="App.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Configurations\UmbracoSettings\umbracoSettings.minimal.config">
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Configurations\UmbracoSettings\umbracoSettings.config">
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Logging\UmbracoTraceLog.UNITTEST.20181112.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
@@ -594,10 +575,6 @@
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Configurations\UmbracoSettings\web.config">
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<Content Include="Logging\logviewer.searches.config.js">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
||||
Reference in New Issue
Block a user