Merge branch 'netcore/dev' into netcore/feature/booting-netcore
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Runtime.InteropServices;
|
||||
|
||||
// Umbraco Cms
|
||||
[assembly: InternalsVisibleTo("Umbraco.Tests")]
|
||||
[assembly: InternalsVisibleTo("Umbraco.Tests.Common")]
|
||||
[assembly: InternalsVisibleTo("Umbraco.Tests.Benchmarks")]
|
||||
|
||||
// Allow this to be mocked in our unit tests
|
||||
|
||||
178
src/Umbraco.Tests.Common/SettingsForTests.cs
Normal file
178
src/Umbraco.Tests.Common/SettingsForTests.cs
Normal file
@@ -0,0 +1,178 @@
|
||||
using Moq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
|
||||
namespace Umbraco.Tests.Common
|
||||
{
|
||||
public class SettingsForTests
|
||||
{
|
||||
public SettingsForTests()
|
||||
{
|
||||
}
|
||||
|
||||
public IGlobalSettings GenerateMockGlobalSettings(IUmbracoVersion umbVersion, IIOHelper ioHelper)
|
||||
{
|
||||
var config = Mock.Of<IGlobalSettings>(
|
||||
settings =>
|
||||
settings.ConfigurationStatus == umbVersion.SemanticVersion.ToSemanticString() &&
|
||||
settings.UseHttps == false &&
|
||||
settings.HideTopLevelNodeFromPath == false &&
|
||||
settings.Path == ioHelper.ResolveUrl("~/umbraco") &&
|
||||
settings.TimeOutInMinutes == 20 &&
|
||||
settings.DefaultUILanguage == "en" &&
|
||||
settings.ReservedPaths == (GlobalSettings.StaticReservedPaths + "~/umbraco") &&
|
||||
settings.ReservedUrls == GlobalSettings.StaticReservedUrls &&
|
||||
settings.UmbracoPath == "~/umbraco" &&
|
||||
settings.UmbracoMediaPath == "~/media" &&
|
||||
settings.UmbracoCssPath == "~/css" &&
|
||||
settings.UmbracoScriptsPath == "~/scripts"
|
||||
);
|
||||
|
||||
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns generated settings which can be stubbed to return whatever values necessary
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IContentSettings GenerateMockContentSettings()
|
||||
{
|
||||
|
||||
var content = new Mock<IContentSettings>();
|
||||
|
||||
//Now configure some defaults - the defaults in the config section classes do NOT pertain to the mocked data!!
|
||||
content.Setup(x => x.ImageAutoFillProperties).Returns(ContentImagingElement.GetDefaultImageAutoFillProperties());
|
||||
content.Setup(x => x.ImageFileTypes).Returns(ContentImagingElement.GetDefaultImageFileTypes());
|
||||
return content.Object;
|
||||
}
|
||||
|
||||
//// from appSettings
|
||||
|
||||
//private readonly IDictionary<string, string> SavedAppSettings = new Dictionary<string, string>();
|
||||
|
||||
//static void SaveSetting(string key)
|
||||
//{
|
||||
// SavedAppSettings[key] = ConfigurationManager.AppSettings[key];
|
||||
//}
|
||||
|
||||
//static void SaveSettings()
|
||||
//{
|
||||
// SaveSetting("umbracoHideTopLevelNodeFromPath");
|
||||
// SaveSetting("umbracoUseDirectoryUrls");
|
||||
// SaveSetting("umbracoPath");
|
||||
// SaveSetting("umbracoReservedPaths");
|
||||
// SaveSetting("umbracoReservedUrls");
|
||||
// SaveSetting("umbracoConfigurationStatus");
|
||||
//}
|
||||
|
||||
|
||||
|
||||
// reset & defaults
|
||||
|
||||
//static SettingsForTests()
|
||||
//{
|
||||
// //SaveSettings();
|
||||
//}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
ResetSettings();
|
||||
GlobalSettings.Reset();
|
||||
|
||||
//foreach (var kvp in SavedAppSettings)
|
||||
// ConfigurationManager.AppSettings.Set(kvp.Key, kvp.Value);
|
||||
|
||||
//// set some defaults that are wrong in the config file?!
|
||||
//// this is annoying, really
|
||||
//HideTopLevelNodeFromPath = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This sets all settings back to default settings
|
||||
/// </summary>
|
||||
private void ResetSettings()
|
||||
{
|
||||
_defaultGlobalSettings = null;
|
||||
}
|
||||
|
||||
private IGlobalSettings _defaultGlobalSettings;
|
||||
private IHostingSettings _defaultHostingSettings;
|
||||
|
||||
public IGlobalSettings GetDefaultGlobalSettings(IUmbracoVersion umbVersion, IIOHelper ioHelper)
|
||||
{
|
||||
if (_defaultGlobalSettings == null)
|
||||
{
|
||||
_defaultGlobalSettings = GenerateMockGlobalSettings(umbVersion, ioHelper);
|
||||
}
|
||||
return _defaultGlobalSettings;
|
||||
}
|
||||
|
||||
public IHostingSettings GetDefaultHostingSettings()
|
||||
{
|
||||
if (_defaultHostingSettings == null)
|
||||
{
|
||||
_defaultHostingSettings = GenerateMockHostingSettings();
|
||||
}
|
||||
return _defaultHostingSettings;
|
||||
}
|
||||
|
||||
private IHostingSettings GenerateMockHostingSettings()
|
||||
{
|
||||
var config = Mock.Of<IHostingSettings>(
|
||||
settings =>
|
||||
settings.LocalTempStorageLocation == LocalTempStorage.EnvironmentTemp &&
|
||||
settings.DebugMode == false
|
||||
);
|
||||
return config;
|
||||
}
|
||||
|
||||
public IWebRoutingSettings GenerateMockWebRoutingSettings()
|
||||
{
|
||||
var mock = new Mock<IWebRoutingSettings>();
|
||||
|
||||
mock.Setup(x => x.DisableRedirectUrlTracking).Returns(false);
|
||||
mock.Setup(x => x.InternalRedirectPreservesTemplate).Returns(false);
|
||||
mock.Setup(x => x.UrlProviderMode).Returns(UrlMode.Auto.ToString());
|
||||
|
||||
return mock.Object;
|
||||
}
|
||||
|
||||
public IRequestHandlerSettings GenerateMockRequestHandlerSettings()
|
||||
{
|
||||
var mock = new Mock<IRequestHandlerSettings>();
|
||||
|
||||
mock.Setup(x => x.AddTrailingSlash).Returns(true);
|
||||
mock.Setup(x => x.ConvertUrlsToAscii).Returns(false);
|
||||
mock.Setup(x => x.TryConvertUrlsToAscii).Returns(false);
|
||||
mock.Setup(x => x.CharCollection).Returns(RequestHandlerElement.GetDefaultCharReplacements);
|
||||
|
||||
return mock.Object;
|
||||
}
|
||||
|
||||
public ISecuritySettings GenerateMockSecuritySettings()
|
||||
{
|
||||
var security = new Mock<ISecuritySettings>();
|
||||
|
||||
return security.Object;
|
||||
}
|
||||
|
||||
public IUserPasswordConfiguration GenerateMockUserPasswordConfiguration()
|
||||
{
|
||||
var mock = new Mock<IUserPasswordConfiguration>();
|
||||
|
||||
return mock.Object;
|
||||
}
|
||||
|
||||
public IMemberPasswordConfiguration GenerateMockMemberPasswordConfiguration()
|
||||
{
|
||||
var mock = new Mock<IMemberPasswordConfiguration>();
|
||||
|
||||
return mock.Object;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using Umbraco.Web.PublishedCache;
|
||||
|
||||
namespace Umbraco.Tests.Testing.Objects.Accessors
|
||||
namespace Umbraco.Tests.Common
|
||||
{
|
||||
public class TestDefaultCultureAccessor : IDefaultCultureAccessor
|
||||
{
|
||||
144
src/Umbraco.Tests.Common/TestHelperBase.cs
Normal file
144
src/Umbraco.Tests.Common/TestHelperBase.cs
Normal file
@@ -0,0 +1,144 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Moq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Diagnostics;
|
||||
using Umbraco.Core.Hosting;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Runtime;
|
||||
using Umbraco.Core.Serialization;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Core.Sync;
|
||||
using Umbraco.Net;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Routing;
|
||||
|
||||
namespace Umbraco.Tests.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Common helper properties and methods useful to testing
|
||||
/// </summary>
|
||||
public abstract class TestHelperBase
|
||||
{
|
||||
public TestHelperBase()
|
||||
{
|
||||
SettingsForTests = new SettingsForTests();
|
||||
IOHelper = new IOHelper(GetHostingEnvironment());
|
||||
MainDom = new MainDom(Mock.Of<ILogger>(), GetHostingEnvironment(), new MainDomSemaphoreLock(Mock.Of<ILogger>(), GetHostingEnvironment()));
|
||||
UriUtility = new UriUtility(GetHostingEnvironment());
|
||||
}
|
||||
|
||||
public ITypeFinder GetTypeFinder()
|
||||
{
|
||||
|
||||
var typeFinder = new TypeFinder(Mock.Of<ILogger>(),
|
||||
new DefaultUmbracoAssemblyProvider(typeof(TestHelperBase).Assembly));
|
||||
return typeFinder;
|
||||
}
|
||||
|
||||
public TypeLoader GetMockedTypeLoader()
|
||||
{
|
||||
return new TypeLoader(IOHelper, Mock.Of<ITypeFinder>(), Mock.Of<IAppPolicyCache>(), new DirectoryInfo(IOHelper.MapPath("~/App_Data/TEMP")), Mock.Of<IProfilingLogger>());
|
||||
}
|
||||
|
||||
public Configs GetConfigs()
|
||||
{
|
||||
return GetConfigsFactory().Create(IOHelper, Mock.Of<ILogger>());
|
||||
}
|
||||
public IRuntimeState GetRuntimeState()
|
||||
{
|
||||
return new RuntimeState(
|
||||
Mock.Of<ILogger>(),
|
||||
Mock.Of<IGlobalSettings>(),
|
||||
new Lazy<IMainDom>(),
|
||||
new Lazy<IServerRegistrar>(),
|
||||
GetUmbracoVersion(),
|
||||
GetHostingEnvironment(),
|
||||
GetBackOfficeInfo()
|
||||
);
|
||||
}
|
||||
|
||||
public abstract IBackOfficeInfo GetBackOfficeInfo();
|
||||
|
||||
public IConfigsFactory GetConfigsFactory()
|
||||
{
|
||||
return new ConfigsFactory();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current assembly directory.
|
||||
/// </summary>
|
||||
/// <value>The assembly directory.</value>
|
||||
public string CurrentAssemblyDirectory
|
||||
{
|
||||
get
|
||||
{
|
||||
var codeBase = typeof(TestHelperBase).Assembly.CodeBase;
|
||||
var uri = new Uri(codeBase);
|
||||
var path = uri.LocalPath;
|
||||
return Path.GetDirectoryName(path);
|
||||
}
|
||||
}
|
||||
|
||||
public IShortStringHelper ShortStringHelper { get; } = new DefaultShortStringHelper(new DefaultShortStringHelperConfig());
|
||||
public IJsonSerializer JsonSerializer { get; } = new JsonNetSerializer();
|
||||
public IVariationContextAccessor VariationContextAccessor { get; } = new TestVariationContextAccessor();
|
||||
public abstract IDbProviderFactoryCreator DbProviderFactoryCreator { get; }
|
||||
public abstract IBulkSqlInsertProvider BulkSqlInsertProvider { get; }
|
||||
public abstract IMarchal Marchal { get; }
|
||||
public ICoreDebug CoreDebug { get; } = new CoreDebug();
|
||||
|
||||
|
||||
public IIOHelper IOHelper { get; }
|
||||
public IMainDom MainDom { get; }
|
||||
public UriUtility UriUtility { get; }
|
||||
public SettingsForTests SettingsForTests { get; }
|
||||
public IWebRoutingSettings WebRoutingSettings => SettingsForTests.GenerateMockWebRoutingSettings();
|
||||
|
||||
/// <summary>
|
||||
/// Maps the given <paramref name="relativePath"/> making it rooted on <see cref="CurrentAssemblyDirectory"/>. <paramref name="relativePath"/> must start with <code>~/</code>
|
||||
/// </summary>
|
||||
/// <param name="relativePath">The relative path.</param>
|
||||
/// <returns></returns>
|
||||
public string MapPathForTest(string relativePath)
|
||||
{
|
||||
if (!relativePath.StartsWith("~/"))
|
||||
throw new ArgumentException("relativePath must start with '~/'", "relativePath");
|
||||
|
||||
return relativePath.Replace("~/", CurrentAssemblyDirectory + "/");
|
||||
}
|
||||
|
||||
public IUmbracoVersion GetUmbracoVersion()
|
||||
{
|
||||
return new UmbracoVersion(GetConfigs().Global());
|
||||
}
|
||||
|
||||
public IRegister GetRegister()
|
||||
{
|
||||
return RegisterFactory.Create(GetConfigs().Global());
|
||||
}
|
||||
|
||||
public abstract IHostingEnvironment GetHostingEnvironment();
|
||||
|
||||
public abstract IIpResolver GetIpResolver();
|
||||
|
||||
public IRequestCache GetRequestCache()
|
||||
{
|
||||
return new DictionaryAppCache();
|
||||
}
|
||||
|
||||
public IPublishedUrlProvider GetPublishedUrlProvider()
|
||||
{
|
||||
var mock = new Mock<IPublishedUrlProvider>();
|
||||
|
||||
return mock.Object;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using Umbraco.Web.PublishedCache;
|
||||
|
||||
namespace Umbraco.Tests.Testing.Objects.Accessors
|
||||
namespace Umbraco.Tests.Common
|
||||
{
|
||||
public class TestPublishedSnapshotAccessor : IPublishedSnapshotAccessor
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using Umbraco.Web;
|
||||
|
||||
namespace Umbraco.Tests.Testing.Objects.Accessors
|
||||
namespace Umbraco.Tests.Common
|
||||
{
|
||||
public class TestUmbracoContextAccessor : IUmbracoContextAccessor
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
|
||||
namespace Umbraco.Tests.Testing.Objects.Accessors
|
||||
namespace Umbraco.Tests.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides an implementation of <see cref="IVariationContextAccessor"/> for tests.
|
||||
18
src/Umbraco.Tests.Common/Umbraco.Tests.Common.csproj
Normal file
18
src/Umbraco.Tests.Common/Umbraco.Tests.Common.csproj
Normal file
@@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Moq" Version="4.13.1" />
|
||||
<PackageReference Include="nunit" Version="3.12.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Umbraco.Configuration\Umbraco.Configuration.csproj" />
|
||||
<ProjectReference Include="..\Umbraco.Core\Umbraco.Core.csproj" />
|
||||
<ProjectReference Include="..\Umbraco.Infrastructure\Umbraco.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -10,9 +10,9 @@ using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
using Umbraco.Core.Serialization;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.Common;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.Testing;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Cache;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
|
||||
@@ -7,6 +7,7 @@ using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.Common;
|
||||
using Umbraco.Tests.LegacyXmlPublishedCache;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.Testing;
|
||||
|
||||
@@ -20,10 +20,10 @@ using Umbraco.Core.Scoping;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Services.Changes;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Tests.Common;
|
||||
using Umbraco.Tests.Strings;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.Testing.Objects;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Cache;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
@@ -63,7 +63,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
Mock.Get(factory).Setup(x => x.GetInstance(typeof(Configs))).Returns(configs);
|
||||
var globalSettings = new GlobalSettings(TestHelper.IOHelper);
|
||||
var hostingEnvironment = Mock.Of<IHostingEnvironment>();
|
||||
configs.Add(SettingsForTests.GenerateMockContentSettings);
|
||||
configs.Add(TestHelpers.SettingsForTests.GenerateMockContentSettings);
|
||||
configs.Add<IGlobalSettings>(() => globalSettings);
|
||||
|
||||
Mock.Get(factory).Setup(x => x.GetInstance(typeof(IPublishedModelFactory))).Returns(PublishedModelFactory);
|
||||
|
||||
@@ -18,10 +18,10 @@ using Umbraco.Core.Scoping;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Services.Changes;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Tests.Common;
|
||||
using Umbraco.Tests.Strings;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.Testing.Objects;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Cache;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
@@ -55,7 +55,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
var configs = TestHelper.GetConfigs();
|
||||
Mock.Get(factory).Setup(x => x.GetInstance(typeof(Configs))).Returns(configs);
|
||||
var globalSettings = new GlobalSettings(TestHelper.IOHelper);
|
||||
configs.Add(SettingsForTests.GenerateMockContentSettings);
|
||||
configs.Add(TestHelpers.SettingsForTests.GenerateMockContentSettings);
|
||||
configs.Add<IGlobalSettings>(() => globalSettings);
|
||||
|
||||
var publishedModelFactory = new NoopPublishedModelFactory();
|
||||
|
||||
@@ -21,6 +21,7 @@ using Umbraco.Core.Strings;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
using Umbraco.Tests.Common;
|
||||
|
||||
namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ using Umbraco.Core.Models.Membership;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.LegacyXmlPublishedCache;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Tests.Common;
|
||||
|
||||
namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
|
||||
@@ -11,9 +11,9 @@ using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.TestHelpers.Entities;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Routing;
|
||||
using Umbraco.Tests.Common;
|
||||
|
||||
namespace Umbraco.Tests.Routing
|
||||
{
|
||||
|
||||
@@ -12,10 +12,10 @@ using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.PropertyEditors.ValueConverters;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.Common;
|
||||
using Umbraco.Tests.PublishedContent;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.Testing;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.PropertyEditors;
|
||||
using Umbraco.Web.Routing;
|
||||
|
||||
@@ -23,10 +23,10 @@ using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.PublishedContent;
|
||||
using Umbraco.Tests.Testing;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Web.Runtime;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
using ILogger = Umbraco.Core.Logging.ILogger;
|
||||
using Umbraco.Tests.Common;
|
||||
|
||||
namespace Umbraco.Tests.Routing
|
||||
{
|
||||
@@ -69,7 +69,7 @@ namespace Umbraco.Tests.Routing
|
||||
var umbracoApiControllerTypes = new UmbracoApiControllerTypeCollection(Composition.TypeLoader.GetUmbracoApiControllers());
|
||||
Composition.RegisterUnique(umbracoApiControllerTypes);
|
||||
|
||||
Composition.RegisterUnique<IShortStringHelper>(_ => new DefaultShortStringHelper(SettingsForTests.GenerateMockRequestHandlerSettings()));
|
||||
Composition.RegisterUnique<IShortStringHelper>(_ => new DefaultShortStringHelper(TestHelpers.SettingsForTests.GenerateMockRequestHandlerSettings()));
|
||||
}
|
||||
|
||||
public override void TearDown()
|
||||
|
||||
@@ -13,10 +13,10 @@ using Umbraco.Tests.LegacyXmlPublishedCache;
|
||||
using Umbraco.Tests.PublishedContent;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.Testing;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Web.Routing;
|
||||
using Umbraco.Tests.Common;
|
||||
|
||||
namespace Umbraco.Tests.Routing
|
||||
{
|
||||
@@ -34,8 +34,8 @@ namespace Umbraco.Tests.Routing
|
||||
|
||||
protected override void ComposeSettings()
|
||||
{
|
||||
Composition.Configs.Add(SettingsForTests.GenerateMockContentSettings);
|
||||
Composition.Configs.Add(SettingsForTests.GenerateMockGlobalSettings);
|
||||
Composition.Configs.Add(TestHelpers.SettingsForTests.GenerateMockContentSettings);
|
||||
Composition.Configs.Add(TestHelpers.SettingsForTests.GenerateMockGlobalSettings);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -48,7 +48,7 @@ namespace Umbraco.Tests.Routing
|
||||
var globalSettings = Mock.Get(Factory.GetInstance<IGlobalSettings>()); //this will modify the IGlobalSettings instance stored in the container
|
||||
globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(false);
|
||||
|
||||
var requestHandlerSettings = SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
var requestHandlerSettings = TestHelpers.SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
|
||||
var umbracoContext = GetUmbracoContext("/test", 1111, globalSettings: globalSettings.Object);
|
||||
var umbracoContextAccessor = new TestUmbracoContextAccessor(umbracoContext);
|
||||
@@ -123,7 +123,7 @@ namespace Umbraco.Tests.Routing
|
||||
var globalSettings = Mock.Get(Factory.GetInstance<IGlobalSettings>()); //this will modify the IGlobalSettings instance stored in the container
|
||||
globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(false);
|
||||
|
||||
var requestHandlerSettings = SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
var requestHandlerSettings = TestHelpers.SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
|
||||
|
||||
var umbracoContext = GetUmbracoContext("/test", 1111, globalSettings: globalSettings.Object);
|
||||
@@ -152,7 +152,7 @@ namespace Umbraco.Tests.Routing
|
||||
var globalSettings = Mock.Get(Factory.GetInstance<IGlobalSettings>()); //this will modify the IGlobalSettings instance stored in the container
|
||||
globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(true);
|
||||
|
||||
var requestHandlerSettings = SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
var requestHandlerSettings = TestHelpers.SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
var umbracoContext = GetUmbracoContext("/test", 1111, globalSettings: globalSettings.Object);
|
||||
var umbracoContextAccessor = new TestUmbracoContextAccessor(umbracoContext);
|
||||
var urlProvider = new DefaultUrlProvider(requestHandlerSettings, Logger, globalSettings.Object,
|
||||
@@ -171,7 +171,7 @@ namespace Umbraco.Tests.Routing
|
||||
var globalSettings = Mock.Get(Factory.GetInstance<IGlobalSettings>()); //this will modify the IGlobalSettings instance stored in the container
|
||||
globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(false);
|
||||
|
||||
var requestHandlerSettings = SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
var requestHandlerSettings = TestHelpers.SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
|
||||
|
||||
var contentType = new PublishedContentType(666, "alias", PublishedItemType.Content, Enumerable.Empty<string>(), Enumerable.Empty<PublishedPropertyType>(), ContentVariation.Culture);
|
||||
@@ -219,7 +219,7 @@ namespace Umbraco.Tests.Routing
|
||||
var globalSettings = Mock.Get(Factory.GetInstance<IGlobalSettings>()); //this will modify the IGlobalSettings instance stored in the container
|
||||
globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(false);
|
||||
|
||||
var requestHandlerSettings = SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
var requestHandlerSettings = TestHelpers.SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
|
||||
var contentType = new PublishedContentType(666, "alias", PublishedItemType.Content, Enumerable.Empty<string>(), Enumerable.Empty<PublishedPropertyType>(), ContentVariation.Culture);
|
||||
var publishedContent = new SolidPublishedContent(contentType) { Id = 1234 };
|
||||
@@ -275,7 +275,7 @@ namespace Umbraco.Tests.Routing
|
||||
var globalSettings = Mock.Get(Factory.GetInstance<IGlobalSettings>()); //this will modify the IGlobalSettings instance stored in the container
|
||||
globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(false);
|
||||
|
||||
var requestHandlerSettings = SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
var requestHandlerSettings = TestHelpers.SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
|
||||
var contentType = new PublishedContentType(666, "alias", PublishedItemType.Content, Enumerable.Empty<string>(), Enumerable.Empty<PublishedPropertyType>(), ContentVariation.Culture);
|
||||
var publishedContent = new SolidPublishedContent(contentType) { Id = 1234 };
|
||||
@@ -326,7 +326,7 @@ namespace Umbraco.Tests.Routing
|
||||
var globalSettings = Mock.Get(Factory.GetInstance<IGlobalSettings>()); //this will modify the IGlobalSettings instance stored in the container
|
||||
globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(false);
|
||||
|
||||
var requestHandlerSettings = SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
var requestHandlerSettings = TestHelpers.SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
|
||||
|
||||
var umbracoContext = GetUmbracoContext("http://example.com/test", 1111, globalSettings: globalSettings.Object);
|
||||
@@ -347,7 +347,7 @@ namespace Umbraco.Tests.Routing
|
||||
var globalSettings = Mock.Get(Factory.GetInstance<IGlobalSettings>()); //this will modify the IGlobalSettings instance stored in the container
|
||||
globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(false);
|
||||
|
||||
var requestHandlerSettings = SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
var requestHandlerSettings = TestHelpers.SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
|
||||
var urlProvider = new DefaultUrlProvider(requestHandlerSettings, Logger, globalSettings.Object,
|
||||
new SiteDomainHelper(), UmbracoContextAccessor, UriUtility);
|
||||
|
||||
@@ -8,9 +8,9 @@ using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.Common;
|
||||
using Umbraco.Tests.LegacyXmlPublishedCache;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Routing;
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace Umbraco.Tests.Routing
|
||||
[TestCase(10011, "https://domain1.com", false, "/1001-1/")]
|
||||
public void Get_Url_SimpleDomain(int nodeId, string currentUrl, bool absolute, string expected)
|
||||
{
|
||||
var settings = SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
var settings = TestHelpers.SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
|
||||
var globalSettings = Mock.Get(Factory.GetInstance<IGlobalSettings>()); //this will modify the IGlobalSettings instance stored in the container
|
||||
globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(false); // ignored w/domains
|
||||
@@ -212,7 +212,7 @@ namespace Umbraco.Tests.Routing
|
||||
[TestCase(10011, "https://domain1.com", false, "http://domain1.com/foo/1001-1/")]
|
||||
public void Get_Url_SimpleWithSchemeAndPath(int nodeId, string currentUrl, bool absolute, string expected)
|
||||
{
|
||||
var settings = SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
var settings = TestHelpers.SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
|
||||
var globalSettings = Mock.Get(Factory.GetInstance<IGlobalSettings>()); //this will modify the IGlobalSettings instance stored in the container
|
||||
globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(false); // ignored w/domains
|
||||
@@ -238,7 +238,7 @@ namespace Umbraco.Tests.Routing
|
||||
[TestCase(1002, "http://domain1.com", false, "/1002/")]
|
||||
public void Get_Url_DeepDomain(int nodeId, string currentUrl, bool absolute, string expected)
|
||||
{
|
||||
var settings = SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
var settings = TestHelpers.SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
|
||||
var globalSettings = Mock.Get(Factory.GetInstance<IGlobalSettings>()); //this will modify the IGlobalSettings instance stored in the container
|
||||
globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(false); // ignored w/domains
|
||||
@@ -270,7 +270,7 @@ namespace Umbraco.Tests.Routing
|
||||
[TestCase(100321, "http://domain3.com", false, "/fr/1003-2-1/")]
|
||||
public void Get_Url_NestedDomains(int nodeId, string currentUrl, bool absolute, string expected)
|
||||
{
|
||||
var settings = SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
var settings = TestHelpers.SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
|
||||
var globalSettings = Mock.Get(Factory.GetInstance<IGlobalSettings>()); //this will modify the IGlobalSettings instance stored in the container
|
||||
globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(false); // ignored w/domains
|
||||
@@ -292,7 +292,7 @@ namespace Umbraco.Tests.Routing
|
||||
[Test]
|
||||
public void Get_Url_DomainsAndCache()
|
||||
{
|
||||
var settings = SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
var settings = TestHelpers.SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
|
||||
var globalSettings = Mock.Get(Factory.GetInstance<IGlobalSettings>()); //this will modify the IGlobalSettings instance stored in the container
|
||||
globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(false); // ignored w/domains
|
||||
@@ -356,7 +356,7 @@ namespace Umbraco.Tests.Routing
|
||||
[Test]
|
||||
public void Get_Url_Relative_Or_Absolute()
|
||||
{
|
||||
var settings = SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
var settings = TestHelpers.SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
|
||||
var globalSettings = Mock.Get(Factory.GetInstance<IGlobalSettings>()); //this will modify the IGlobalSettings instance stored in the container
|
||||
globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(false); // ignored w/domains
|
||||
@@ -381,7 +381,7 @@ namespace Umbraco.Tests.Routing
|
||||
[Test]
|
||||
public void Get_Url_Alternate()
|
||||
{
|
||||
var settings = SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
var settings = TestHelpers.SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
|
||||
var globalSettings = Mock.Get(Factory.GetInstance<IGlobalSettings>()); //this will modify the IGlobalSettings instance stored in the container
|
||||
globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(false); // ignored w/domains
|
||||
|
||||
@@ -10,8 +10,8 @@ using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Web.Routing;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.LegacyXmlPublishedCache;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Tests.Common;
|
||||
|
||||
namespace Umbraco.Tests.Routing
|
||||
{
|
||||
@@ -36,7 +36,7 @@ namespace Umbraco.Tests.Routing
|
||||
var globalSettings = Mock.Get(Factory.GetInstance<IGlobalSettings>()); //this will modify the IGlobalSettings instance stored in the container
|
||||
globalSettings.Setup(x => x.HideTopLevelNodeFromPath).Returns(false);
|
||||
|
||||
var settings = SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
var settings = TestHelpers.SettingsForTests.GenerateMockRequestHandlerSettings();
|
||||
|
||||
SetDomains1();
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Sync;
|
||||
using Umbraco.Tests.Composing;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Cache;
|
||||
using Umbraco.Web.Macros;
|
||||
@@ -36,6 +35,7 @@ using Umbraco.Web.Routing;
|
||||
using Umbraco.Web.Runtime;
|
||||
using File = System.IO.File;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
using Umbraco.Tests.Common;
|
||||
|
||||
namespace Umbraco.Tests.Runtimes
|
||||
{
|
||||
@@ -120,8 +120,8 @@ namespace Umbraco.Tests.Runtimes
|
||||
.Append<DistributedCacheBinderComponent>();
|
||||
|
||||
// configure
|
||||
composition.Configs.Add(SettingsForTests.GetDefaultGlobalSettings);
|
||||
composition.Configs.Add(SettingsForTests.GenerateMockContentSettings);
|
||||
composition.Configs.Add(TestHelpers.SettingsForTests.GetDefaultGlobalSettings);
|
||||
composition.Configs.Add(TestHelpers.SettingsForTests.GenerateMockContentSettings);
|
||||
|
||||
// create and register the factory
|
||||
Current.Factory = factory = composition.CreateFactory();
|
||||
@@ -159,7 +159,7 @@ namespace Umbraco.Tests.Runtimes
|
||||
var scopeProvider = factory.GetInstance<IScopeProvider>();
|
||||
using (var scope = scopeProvider.CreateScope())
|
||||
{
|
||||
var creator = new DatabaseSchemaCreator(scope.Database, logger, umbracoVersion, SettingsForTests.GetDefaultGlobalSettings());
|
||||
var creator = new DatabaseSchemaCreator(scope.Database, logger, umbracoVersion, TestHelpers.SettingsForTests.GetDefaultGlobalSettings());
|
||||
creator.InitializeDatabaseSchema();
|
||||
scope.Complete();
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Services.Implement;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Core.Sync;
|
||||
using Umbraco.Tests.Common;
|
||||
using Umbraco.Tests.Strings;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.Testing;
|
||||
|
||||
@@ -15,7 +15,7 @@ using Umbraco.Web;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Web.Routing;
|
||||
using Umbraco.Web.Security;
|
||||
|
||||
using Umbraco.Tests.Common;
|
||||
|
||||
namespace Umbraco.Tests.Security
|
||||
{
|
||||
|
||||
@@ -20,10 +20,10 @@ using Umbraco.Tests.LegacyXmlPublishedCache;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.TestHelpers.Entities;
|
||||
using Umbraco.Tests.Testing;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.PublishedCache.NuCache;
|
||||
using Umbraco.Web.Security.Providers;
|
||||
using Umbraco.Tests.Common;
|
||||
|
||||
namespace Umbraco.Tests.Services
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Umbraco.Core.Logging;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Web.Templates;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
@@ -14,6 +13,7 @@ using Umbraco.Core.Models;
|
||||
using Umbraco.Core;
|
||||
using System.Diagnostics;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.Common;
|
||||
|
||||
namespace Umbraco.Tests.Templates
|
||||
{
|
||||
|
||||
@@ -6,9 +6,9 @@ using System.Web;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Tests.Common;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.Testing.Objects;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Routing;
|
||||
using Umbraco.Web.Templates;
|
||||
|
||||
@@ -14,6 +14,7 @@ using Umbraco.Core.Request;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Services.Implement;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Tests.Common;
|
||||
using Umbraco.Tests.PublishedContent;
|
||||
using Umbraco.Tests.TestHelpers.Stubs;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
|
||||
@@ -25,6 +25,7 @@ using Umbraco.Core.Logging;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Web.Security.Providers;
|
||||
using Umbraco.Tests.Strings;
|
||||
using Umbraco.Tests.Common;
|
||||
|
||||
namespace Umbraco.Tests.TestHelpers.ControllerTesting
|
||||
{
|
||||
|
||||
@@ -1,55 +1,19 @@
|
||||
using System.IO;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using Moq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
|
||||
namespace Umbraco.Tests.TestHelpers
|
||||
{
|
||||
public class SettingsForTests
|
||||
{
|
||||
public static IGlobalSettings GenerateMockGlobalSettings()
|
||||
{
|
||||
var config = Mock.Of<IGlobalSettings>(
|
||||
settings =>
|
||||
settings.ConfigurationStatus == TestHelper.GetUmbracoVersion().SemanticVersion.ToSemanticString() &&
|
||||
settings.UseHttps == false &&
|
||||
settings.HideTopLevelNodeFromPath == false &&
|
||||
settings.Path == TestHelper.IOHelper.ResolveUrl("~/umbraco") &&
|
||||
settings.TimeOutInMinutes == 20 &&
|
||||
settings.DefaultUILanguage == "en" &&
|
||||
settings.ReservedPaths == (GlobalSettings.StaticReservedPaths + "~/umbraco") &&
|
||||
settings.ReservedUrls == GlobalSettings.StaticReservedUrls &&
|
||||
settings.UmbracoPath == "~/umbraco" &&
|
||||
settings.UmbracoMediaPath == "~/media" &&
|
||||
settings.UmbracoCssPath == "~/css" &&
|
||||
settings.UmbracoScriptsPath == "~/scripts"
|
||||
);
|
||||
private static Common.SettingsForTests _settingsForTests = new Common.SettingsForTests();
|
||||
|
||||
|
||||
|
||||
return config;
|
||||
}
|
||||
public static IGlobalSettings GenerateMockGlobalSettings() => _settingsForTests.GenerateMockGlobalSettings(TestHelper.GetUmbracoVersion(), TestHelper.IOHelper);
|
||||
|
||||
/// <summary>
|
||||
/// Returns generated settings which can be stubbed to return whatever values necessary
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static IContentSettings GenerateMockContentSettings()
|
||||
{
|
||||
|
||||
var content = new Mock<IContentSettings>();
|
||||
|
||||
//Now configure some defaults - the defaults in the config section classes do NOT pertain to the mocked data!!
|
||||
content.Setup(x => x.ImageAutoFillProperties).Returns(ContentImagingElement.GetDefaultImageAutoFillProperties());
|
||||
content.Setup(x => x.ImageFileTypes).Returns(ContentImagingElement.GetDefaultImageFileTypes());
|
||||
return content.Object;
|
||||
}
|
||||
public static IContentSettings GenerateMockContentSettings() => _settingsForTests.GenerateMockContentSettings();
|
||||
|
||||
//// from appSettings
|
||||
|
||||
@@ -79,100 +43,20 @@ namespace Umbraco.Tests.TestHelpers
|
||||
// //SaveSettings();
|
||||
//}
|
||||
|
||||
public static void Reset()
|
||||
{
|
||||
ResetSettings();
|
||||
GlobalSettings.Reset();
|
||||
public static void Reset() => _settingsForTests.Reset();
|
||||
|
||||
//foreach (var kvp in SavedAppSettings)
|
||||
// ConfigurationManager.AppSettings.Set(kvp.Key, kvp.Value);
|
||||
internal static IGlobalSettings GetDefaultGlobalSettings() => _settingsForTests.GetDefaultGlobalSettings(TestHelper.GetUmbracoVersion(), TestHelper.IOHelper);
|
||||
|
||||
//// set some defaults that are wrong in the config file?!
|
||||
//// this is annoying, really
|
||||
//HideTopLevelNodeFromPath = false;
|
||||
}
|
||||
internal static IHostingSettings GetDefaultHostingSettings() => _settingsForTests.GetDefaultHostingSettings();
|
||||
|
||||
/// <summary>
|
||||
/// This sets all settings back to default settings
|
||||
/// </summary>
|
||||
private static void ResetSettings()
|
||||
{
|
||||
_defaultGlobalSettings = null;
|
||||
}
|
||||
public static IWebRoutingSettings GenerateMockWebRoutingSettings() => _settingsForTests.GenerateMockWebRoutingSettings();
|
||||
|
||||
private static IGlobalSettings _defaultGlobalSettings;
|
||||
private static IHostingSettings _defaultHostingSettings;
|
||||
public static IRequestHandlerSettings GenerateMockRequestHandlerSettings() => _settingsForTests.GenerateMockRequestHandlerSettings();
|
||||
|
||||
internal static IGlobalSettings GetDefaultGlobalSettings()
|
||||
{
|
||||
if (_defaultGlobalSettings == null)
|
||||
{
|
||||
_defaultGlobalSettings = GenerateMockGlobalSettings();
|
||||
}
|
||||
return _defaultGlobalSettings;
|
||||
}
|
||||
public static ISecuritySettings GenerateMockSecuritySettings() => _settingsForTests.GenerateMockSecuritySettings();
|
||||
|
||||
internal static IHostingSettings GetDefaultHostingSettings()
|
||||
{
|
||||
if (_defaultHostingSettings == null)
|
||||
{
|
||||
_defaultHostingSettings = GenerateMockHostingSettings();
|
||||
}
|
||||
return _defaultHostingSettings;
|
||||
}
|
||||
public static IUserPasswordConfiguration GenerateMockUserPasswordConfiguration() => _settingsForTests.GenerateMockUserPasswordConfiguration();
|
||||
|
||||
private static IHostingSettings GenerateMockHostingSettings()
|
||||
{
|
||||
var config = Mock.Of<IHostingSettings>(
|
||||
settings =>
|
||||
settings.LocalTempStorageLocation == LocalTempStorage.EnvironmentTemp &&
|
||||
settings.DebugMode == false
|
||||
);
|
||||
return config;
|
||||
}
|
||||
|
||||
public static IWebRoutingSettings GenerateMockWebRoutingSettings()
|
||||
{
|
||||
var mock = new Mock<IWebRoutingSettings>();
|
||||
|
||||
mock.Setup(x => x.DisableRedirectUrlTracking).Returns(false);
|
||||
mock.Setup(x => x.InternalRedirectPreservesTemplate).Returns(false);
|
||||
mock.Setup(x => x.UrlProviderMode).Returns(UrlMode.Auto.ToString());
|
||||
|
||||
return mock.Object;
|
||||
}
|
||||
|
||||
public static IRequestHandlerSettings GenerateMockRequestHandlerSettings()
|
||||
{
|
||||
var mock = new Mock<IRequestHandlerSettings>();
|
||||
|
||||
mock.Setup(x => x.AddTrailingSlash).Returns(true);
|
||||
mock.Setup(x => x.ConvertUrlsToAscii).Returns(false);
|
||||
mock.Setup(x => x.TryConvertUrlsToAscii).Returns(false);
|
||||
mock.Setup(x => x.CharCollection).Returns(RequestHandlerElement.GetDefaultCharReplacements);
|
||||
|
||||
return mock.Object;
|
||||
}
|
||||
|
||||
public static ISecuritySettings GenerateMockSecuritySettings()
|
||||
{
|
||||
var security = new Mock<ISecuritySettings>();
|
||||
|
||||
return security.Object;
|
||||
}
|
||||
|
||||
public static IUserPasswordConfiguration GenerateMockUserPasswordConfiguration()
|
||||
{
|
||||
var mock = new Mock<IUserPasswordConfiguration>();
|
||||
|
||||
return mock.Object;
|
||||
}
|
||||
|
||||
public static IMemberPasswordConfiguration GenerateMockMemberPasswordConfiguration()
|
||||
{
|
||||
var mock = new Mock<IMemberPasswordConfiguration>();
|
||||
|
||||
return mock.Object;
|
||||
}
|
||||
public static IMemberPasswordConfiguration GenerateMockMemberPasswordConfiguration() => _settingsForTests.GenerateMockMemberPasswordConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,13 +23,11 @@ using Umbraco.Core.Models.Entities;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.Runtime;
|
||||
using Umbraco.Core.Serialization;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Core.Sync;
|
||||
using Umbraco.Net;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Tests.Common;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Hosting;
|
||||
using Umbraco.Web.Routing;
|
||||
@@ -42,89 +40,66 @@ namespace Umbraco.Tests.TestHelpers
|
||||
/// </summary>
|
||||
public static class TestHelper
|
||||
{
|
||||
|
||||
public static ITypeFinder GetTypeFinder()
|
||||
private static TestHelperInternal _testHelperInternal = new TestHelperInternal();
|
||||
private class TestHelperInternal : TestHelperBase
|
||||
{
|
||||
|
||||
var typeFinder = new TypeFinder(Mock.Of<ILogger>(),
|
||||
new DefaultUmbracoAssemblyProvider(typeof(TestHelper).Assembly));
|
||||
return typeFinder;
|
||||
public override IDbProviderFactoryCreator DbProviderFactoryCreator { get; } = new UmbracoDbProviderFactoryCreator(Constants.DbProviderNames.SqlCe);
|
||||
|
||||
public override IBulkSqlInsertProvider BulkSqlInsertProvider { get; } = new SqlCeBulkSqlInsertProvider();
|
||||
|
||||
public override IMarchal Marchal { get; } = new FrameworkMarchal();
|
||||
|
||||
public override IBackOfficeInfo GetBackOfficeInfo()
|
||||
=> new AspNetBackOfficeInfo(
|
||||
SettingsForTests.GenerateMockGlobalSettings(GetUmbracoVersion(), IOHelper),
|
||||
TestHelper.IOHelper, Mock.Of<ILogger>(), SettingsForTests.GenerateMockWebRoutingSettings());
|
||||
|
||||
public override IHostingEnvironment GetHostingEnvironment()
|
||||
=> new AspNetHostingEnvironment(SettingsForTests.GetDefaultHostingSettings());
|
||||
|
||||
public override IIpResolver GetIpResolver()
|
||||
=> new AspNetIpResolver();
|
||||
}
|
||||
|
||||
public static TypeLoader GetMockedTypeLoader()
|
||||
{
|
||||
return new TypeLoader(IOHelper, Mock.Of<ITypeFinder>(), Mock.Of<IAppPolicyCache>(), new DirectoryInfo(IOHelper.MapPath("~/App_Data/TEMP")), Mock.Of<IProfilingLogger>());
|
||||
}
|
||||
public static ITypeFinder GetTypeFinder() => _testHelperInternal.GetTypeFinder();
|
||||
|
||||
public static Configs GetConfigs()
|
||||
{
|
||||
return GetConfigsFactory().Create(IOHelper, Mock.Of<ILogger>());
|
||||
}
|
||||
public static IRuntimeState GetRuntimeState()
|
||||
{
|
||||
return new RuntimeState(
|
||||
Mock.Of<ILogger>(),
|
||||
Mock.Of<IGlobalSettings>(),
|
||||
new Lazy<IMainDom>(),
|
||||
new Lazy<IServerRegistrar>(),
|
||||
TestHelper.GetUmbracoVersion(),
|
||||
TestHelper.GetHostingEnvironment(),
|
||||
TestHelper.GetBackOfficeInfo()
|
||||
);
|
||||
}
|
||||
public static TypeLoader GetMockedTypeLoader() => _testHelperInternal.GetMockedTypeLoader();
|
||||
|
||||
public static IBackOfficeInfo GetBackOfficeInfo()
|
||||
{
|
||||
return new AspNetBackOfficeInfo(SettingsForTests.GenerateMockGlobalSettings(), TestHelper.IOHelper, Mock.Of<ILogger>(), SettingsForTests.GenerateMockWebRoutingSettings());
|
||||
}
|
||||
public static Configs GetConfigs() => _testHelperInternal.GetConfigs();
|
||||
|
||||
public static IConfigsFactory GetConfigsFactory()
|
||||
{
|
||||
return new ConfigsFactory();
|
||||
}
|
||||
public static IRuntimeState GetRuntimeState() => _testHelperInternal.GetRuntimeState();
|
||||
|
||||
public static IBackOfficeInfo GetBackOfficeInfo() => _testHelperInternal.GetBackOfficeInfo();
|
||||
|
||||
public static IConfigsFactory GetConfigsFactory() => _testHelperInternal.GetConfigsFactory();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current assembly directory.
|
||||
/// </summary>
|
||||
/// <value>The assembly directory.</value>
|
||||
public static string CurrentAssemblyDirectory
|
||||
{
|
||||
get
|
||||
{
|
||||
var codeBase = typeof(TestHelper).Assembly.CodeBase;
|
||||
var uri = new Uri(codeBase);
|
||||
var path = uri.LocalPath;
|
||||
return Path.GetDirectoryName(path);
|
||||
}
|
||||
}
|
||||
public static string CurrentAssemblyDirectory => _testHelperInternal.CurrentAssemblyDirectory;
|
||||
|
||||
public static IShortStringHelper ShortStringHelper { get; } = new DefaultShortStringHelper(new DefaultShortStringHelperConfig());
|
||||
public static IJsonSerializer JsonSerializer { get; } = new JsonNetSerializer();
|
||||
public static IVariationContextAccessor VariationContextAccessor { get; } = new TestVariationContextAccessor();
|
||||
public static IDbProviderFactoryCreator DbProviderFactoryCreator { get; } = new UmbracoDbProviderFactoryCreator(Constants.DbProviderNames.SqlCe);
|
||||
public static IBulkSqlInsertProvider BulkSqlInsertProvider { get; } = new SqlCeBulkSqlInsertProvider();
|
||||
public static IMarchal Marchal { get; } = new FrameworkMarchal();
|
||||
public static ICoreDebug CoreDebug { get; } = new CoreDebug();
|
||||
public static IShortStringHelper ShortStringHelper => _testHelperInternal.ShortStringHelper;
|
||||
public static IJsonSerializer JsonSerializer => _testHelperInternal.JsonSerializer;
|
||||
public static IVariationContextAccessor VariationContextAccessor => _testHelperInternal.VariationContextAccessor;
|
||||
public static IDbProviderFactoryCreator DbProviderFactoryCreator => _testHelperInternal.DbProviderFactoryCreator;
|
||||
public static IBulkSqlInsertProvider BulkSqlInsertProvider => _testHelperInternal.BulkSqlInsertProvider;
|
||||
public static IMarchal Marchal => _testHelperInternal.Marchal;
|
||||
public static ICoreDebug CoreDebug => _testHelperInternal.CoreDebug;
|
||||
|
||||
|
||||
public static IIOHelper IOHelper { get; } = new IOHelper(GetHostingEnvironment());
|
||||
public static IMainDom MainDom { get; } = new MainDom(Mock.Of<ILogger>(), GetHostingEnvironment(), new MainDomSemaphoreLock(Mock.Of<ILogger>(), GetHostingEnvironment()));
|
||||
public static UriUtility UriUtility { get; } = new UriUtility(GetHostingEnvironment());
|
||||
public static IIOHelper IOHelper => _testHelperInternal.IOHelper;
|
||||
public static IMainDom MainDom => _testHelperInternal.MainDom;
|
||||
public static UriUtility UriUtility => _testHelperInternal.UriUtility;
|
||||
|
||||
public static IWebRoutingSettings WebRoutingSettings => SettingsForTests.GenerateMockWebRoutingSettings();
|
||||
public static IWebRoutingSettings WebRoutingSettings => _testHelperInternal.WebRoutingSettings;
|
||||
|
||||
/// <summary>
|
||||
/// Maps the given <paramref name="relativePath"/> making it rooted on <see cref="CurrentAssemblyDirectory"/>. <paramref name="relativePath"/> must start with <code>~/</code>
|
||||
/// </summary>
|
||||
/// <param name="relativePath">The relative path.</param>
|
||||
/// <returns></returns>
|
||||
public static string MapPathForTest(string relativePath)
|
||||
{
|
||||
if (!relativePath.StartsWith("~/"))
|
||||
throw new ArgumentException("relativePath must start with '~/'", "relativePath");
|
||||
|
||||
return relativePath.Replace("~/", CurrentAssemblyDirectory + "/");
|
||||
}
|
||||
public static string MapPathForTest(string relativePath) => _testHelperInternal.MapPathForTest(relativePath);
|
||||
|
||||
public static void InitializeContentDirectories()
|
||||
{
|
||||
@@ -171,6 +146,7 @@ namespace Umbraco.Tests.TestHelpers
|
||||
File.Delete(umbracoSettingsFile);
|
||||
}
|
||||
|
||||
// TODO: Move to Assertions or AssertHelper
|
||||
// FIXME: obsolete the dateTimeFormat thing and replace with dateDelta
|
||||
public static void AssertPropertyValuesAreEqual(object actual, object expected, string dateTimeFormat = null, Func<IEnumerable, IEnumerable> sorter = null, string[] ignoreProperties = null)
|
||||
{
|
||||
@@ -314,6 +290,7 @@ namespace Umbraco.Tests.TestHelpers
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Move to MockedValueEditors.cs
|
||||
public static DataValueEditor CreateDataValueEditor(string name)
|
||||
{
|
||||
var valueType = (ValueTypes.IsValue(name)) ? name : ValueTypes.String;
|
||||
@@ -332,30 +309,15 @@ namespace Umbraco.Tests.TestHelpers
|
||||
}
|
||||
|
||||
|
||||
public static IUmbracoVersion GetUmbracoVersion()
|
||||
{
|
||||
return new UmbracoVersion(GetConfigs().Global());
|
||||
}
|
||||
public static IUmbracoVersion GetUmbracoVersion() => _testHelperInternal.GetUmbracoVersion();
|
||||
|
||||
public static IRegister GetRegister()
|
||||
{
|
||||
return RegisterFactory.Create(GetConfigs().Global());
|
||||
}
|
||||
public static IRegister GetRegister() => _testHelperInternal.GetRegister();
|
||||
|
||||
public static IHostingEnvironment GetHostingEnvironment()
|
||||
{
|
||||
return new AspNetHostingEnvironment(SettingsForTests.GetDefaultHostingSettings());
|
||||
}
|
||||
public static IHostingEnvironment GetHostingEnvironment() => _testHelperInternal.GetHostingEnvironment();
|
||||
|
||||
public static IIpResolver GetIpResolver()
|
||||
{
|
||||
return new AspNetIpResolver();
|
||||
}
|
||||
public static IIpResolver GetIpResolver() => _testHelperInternal.GetIpResolver();
|
||||
|
||||
public static IRequestCache GetRequestCache()
|
||||
{
|
||||
return new DictionaryAppCache();
|
||||
}
|
||||
public static IRequestCache GetRequestCache() => _testHelperInternal.GetRequestCache();
|
||||
|
||||
public static IHttpContextAccessor GetHttpContextAccessor(HttpContextBase httpContextBase = null)
|
||||
{
|
||||
@@ -376,11 +338,6 @@ namespace Umbraco.Tests.TestHelpers
|
||||
return mock.Object;
|
||||
}
|
||||
|
||||
public static IPublishedUrlProvider GetPublishedUrlProvider()
|
||||
{
|
||||
var mock = new Mock<IPublishedUrlProvider>();
|
||||
|
||||
return mock.Object;
|
||||
}
|
||||
public static IPublishedUrlProvider GetPublishedUrlProvider() => _testHelperInternal.GetPublishedUrlProvider();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Tests.Common;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Web.Routing;
|
||||
|
||||
@@ -30,8 +30,8 @@ using Umbraco.Core.Migrations.Install;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.Persistence.Repositories;
|
||||
using Umbraco.Tests.LegacyXmlPublishedCache;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Web.WebApi;
|
||||
using Umbraco.Tests.Common;
|
||||
|
||||
namespace Umbraco.Tests.TestHelpers
|
||||
{
|
||||
|
||||
@@ -3,8 +3,8 @@ using NUnit.Framework.Internal;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.Common;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Web.Routing;
|
||||
@@ -21,7 +21,7 @@ namespace Umbraco.Tests.Testing.Objects
|
||||
IHttpContextAccessor httpContextAccessor = null,
|
||||
IPublishedUrlProvider publishedUrlProvider = null)
|
||||
{
|
||||
if (globalSettings == null) globalSettings = SettingsForTests.GenerateMockGlobalSettings();
|
||||
if (globalSettings == null) globalSettings = TestHelpers.SettingsForTests.GenerateMockGlobalSettings();
|
||||
if (umbracoContextAccessor == null) umbracoContextAccessor = new TestUmbracoContextAccessor();
|
||||
if (httpContextAccessor == null) httpContextAccessor = TestHelper.GetHttpContextAccessor();
|
||||
if (publishedUrlProvider == null) publishedUrlProvider = TestHelper.GetPublishedUrlProvider();
|
||||
|
||||
@@ -16,9 +16,9 @@ using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.Common;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.TestHelpers.Stubs;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
using Umbraco.Web.Routing;
|
||||
|
||||
@@ -35,7 +35,6 @@ using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.TestHelpers.Stubs;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Services;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Web.Actions;
|
||||
using Umbraco.Web.ContentApps;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
@@ -63,6 +62,8 @@ using Umbraco.Web.Security;
|
||||
using Umbraco.Web.Security.Providers;
|
||||
using Umbraco.Web.Trees;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
using Umbraco.Tests.Common;
|
||||
|
||||
namespace Umbraco.Tests.Testing
|
||||
{
|
||||
/// <summary>
|
||||
@@ -138,7 +139,7 @@ namespace Umbraco.Tests.Testing
|
||||
|
||||
protected virtual IProfilingLogger ProfilingLogger => Factory.GetInstance<IProfilingLogger>();
|
||||
|
||||
protected IHostingEnvironment HostingEnvironment { get; } = new AspNetHostingEnvironment(SettingsForTests.GetDefaultHostingSettings());
|
||||
protected IHostingEnvironment HostingEnvironment { get; } = new AspNetHostingEnvironment(TestHelpers.SettingsForTests.GetDefaultHostingSettings());
|
||||
protected IIpResolver IpResolver => Factory.GetInstance<IIpResolver>();
|
||||
protected IBackOfficeInfo BackOfficeInfo => Factory.GetInstance<IBackOfficeInfo>();
|
||||
protected AppCaches AppCaches => Factory.GetInstance<AppCaches>();
|
||||
@@ -173,8 +174,8 @@ namespace Umbraco.Tests.Testing
|
||||
|
||||
TypeFinder = new TypeFinder(logger, new DefaultUmbracoAssemblyProvider(GetType().Assembly));
|
||||
var appCaches = GetAppCaches();
|
||||
var globalSettings = SettingsForTests.GetDefaultGlobalSettings();
|
||||
var settings = SettingsForTests.GenerateMockWebRoutingSettings();
|
||||
var globalSettings = TestHelpers.SettingsForTests.GetDefaultGlobalSettings();
|
||||
var settings = TestHelpers.SettingsForTests.GenerateMockWebRoutingSettings();
|
||||
|
||||
IBackOfficeInfo backOfficeInfo = new AspNetBackOfficeInfo(globalSettings, IOHelper, logger, settings);
|
||||
IIpResolver ipResolver = new AspNetIpResolver();
|
||||
@@ -321,7 +322,7 @@ namespace Umbraco.Tests.Testing
|
||||
Composition.RegisterUnique<IPublishedUrlProvider>(factory =>
|
||||
new UrlProvider(
|
||||
factory.GetInstance<IUmbracoContextAccessor>(),
|
||||
SettingsForTests.GenerateMockWebRoutingSettings(),
|
||||
TestHelpers.SettingsForTests.GenerateMockWebRoutingSettings(),
|
||||
new UrlProviderCollection(Enumerable.Empty<IUrlProvider>()),
|
||||
new MediaUrlProviderCollection(Enumerable.Empty<IMediaUrlProvider>()),
|
||||
factory.GetInstance<IVariationContextAccessor>()
|
||||
@@ -411,14 +412,14 @@ namespace Umbraco.Tests.Testing
|
||||
|
||||
protected virtual void ComposeSettings()
|
||||
{
|
||||
Composition.Configs.Add(SettingsForTests.GetDefaultGlobalSettings);
|
||||
Composition.Configs.Add(SettingsForTests.GetDefaultHostingSettings);
|
||||
Composition.Configs.Add(SettingsForTests.GenerateMockRequestHandlerSettings);
|
||||
Composition.Configs.Add(SettingsForTests.GenerateMockWebRoutingSettings);
|
||||
Composition.Configs.Add(SettingsForTests.GenerateMockSecuritySettings);
|
||||
Composition.Configs.Add(SettingsForTests.GenerateMockUserPasswordConfiguration);
|
||||
Composition.Configs.Add(SettingsForTests.GenerateMockMemberPasswordConfiguration);
|
||||
Composition.Configs.Add(SettingsForTests.GenerateMockContentSettings);
|
||||
Composition.Configs.Add(TestHelpers.SettingsForTests.GetDefaultGlobalSettings);
|
||||
Composition.Configs.Add(TestHelpers.SettingsForTests.GetDefaultHostingSettings);
|
||||
Composition.Configs.Add(TestHelpers.SettingsForTests.GenerateMockRequestHandlerSettings);
|
||||
Composition.Configs.Add(TestHelpers.SettingsForTests.GenerateMockWebRoutingSettings);
|
||||
Composition.Configs.Add(TestHelpers.SettingsForTests.GenerateMockSecuritySettings);
|
||||
Composition.Configs.Add(TestHelpers.SettingsForTests.GenerateMockUserPasswordConfiguration);
|
||||
Composition.Configs.Add(TestHelpers.SettingsForTests.GenerateMockMemberPasswordConfiguration);
|
||||
Composition.Configs.Add(TestHelpers.SettingsForTests.GenerateMockContentSettings);
|
||||
|
||||
//Composition.Configs.Add<IUserPasswordConfiguration>(() => new DefaultUserPasswordConfig());
|
||||
}
|
||||
@@ -548,7 +549,7 @@ namespace Umbraco.Tests.Testing
|
||||
|
||||
// reset all other static things that should not be static ;(
|
||||
UriUtility.ResetAppDomainAppVirtualPath(HostingEnvironment);
|
||||
SettingsForTests.Reset(); // FIXME: should it be optional?
|
||||
TestHelpers.SettingsForTests.Reset(); // FIXME: should it be optional?
|
||||
|
||||
// clear static events
|
||||
DocumentRepository.ClearScopeEvents();
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Castle.Core" Version="4.3.1" />
|
||||
<PackageReference Include="Castle.Core" Version="4.4.0" />
|
||||
<PackageReference Include="Examine.Core">
|
||||
<Version>2.0.0-alpha.20200128.15</Version>
|
||||
</PackageReference>
|
||||
@@ -100,9 +100,9 @@
|
||||
<PackageReference Include="Microsoft.Owin.Testing" Version="4.0.1" />
|
||||
<PackageReference Include="Microsoft.Web.Infrastructure" Version="1.0.0.0" />
|
||||
<PackageReference Include="MiniProfiler" Version="4.0.138" />
|
||||
<PackageReference Include="Moq" Version="4.10.1" />
|
||||
<PackageReference Include="Moq" Version="4.13.1" />
|
||||
<PackageReference Include="NPoco" Version="4.0.2" />
|
||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.12.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="Owin" Version="1.0" />
|
||||
@@ -221,9 +221,7 @@
|
||||
<Compile Include="TestHelpers\Entities\MockedUserGroup.cs" />
|
||||
<Compile Include="Testing\Objects\Accessors\NoHttpContextAccessor.cs" />
|
||||
<Compile Include="TestHelpers\Stubs\TestExamineManager.cs" />
|
||||
<Compile Include="Testing\Objects\Accessors\TestVariationContextAccessor.cs" />
|
||||
<Compile Include="Testing\ContentBaseExtensions.cs" />
|
||||
<Compile Include="Testing\Objects\Accessors\TestDefaultCultureAccessor.cs" />
|
||||
<Compile Include="Testing\Objects\TestUmbracoContextFactory.cs" />
|
||||
<Compile Include="Testing\TestDatabase.cs" />
|
||||
<Compile Include="Testing\TestingTests\NUnitTests.cs" />
|
||||
@@ -239,10 +237,8 @@
|
||||
<Compile Include="TestHelpers\Entities\MockedPropertyTypes.cs" />
|
||||
<Compile Include="Testing\UmbracoTestOptions.cs" />
|
||||
<Compile Include="CoreThings\TryConvertToTests.cs" />
|
||||
<Compile Include="Testing\Objects\Accessors\TestPublishedSnapshotAccessor.cs" />
|
||||
<Compile Include="TestHelpers\TestObjects-Mocks.cs" />
|
||||
<Compile Include="TestHelpers\TestObjects.cs" />
|
||||
<Compile Include="Testing\Objects\Accessors\TestUmbracoContextAccessor.cs" />
|
||||
<Compile Include="CoreThings\UdiTests.cs" />
|
||||
<Compile Include="UmbracoExamine\RandomIdRamDirectory.cs" />
|
||||
<Compile Include="UmbracoExamine\UmbracoContentValueSetValidatorTests.cs" />
|
||||
@@ -585,6 +581,10 @@
|
||||
<Project>{f6de8da0-07cc-4ef2-8a59-2bc81dbb3830}</Project>
|
||||
<Name>Umbraco.PublishedCache.NuCache</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Umbraco.Tests.Common\Umbraco.Tests.Common.csproj">
|
||||
<Project>{a499779c-1b3b-48a8-b551-458e582e6e96}</Project>
|
||||
<Name>Umbraco.Tests.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Umbraco.Web\Umbraco.Web.csproj">
|
||||
<Project>{651E1350-91B6-44B7-BD60-7207006D7003}</Project>
|
||||
<Name>Umbraco.Web</Name>
|
||||
|
||||
@@ -13,9 +13,9 @@ using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.Common;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.TestHelpers.Stubs;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Models;
|
||||
using Umbraco.Web.Mvc;
|
||||
|
||||
@@ -7,8 +7,8 @@ using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Tests.Common;
|
||||
using Umbraco.Tests.TestHelpers.Stubs;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Web.Models;
|
||||
using Umbraco.Web.Mvc;
|
||||
using Current = Umbraco.Web.Composing.Current;
|
||||
|
||||
@@ -11,9 +11,9 @@ using Umbraco.Core.Dictionary;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.Common;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.Testing;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Mvc;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
@@ -156,7 +156,7 @@ namespace Umbraco.Tests.Web.Mvc
|
||||
var content = Mock.Of<IPublishedContent>(publishedContent => publishedContent.Id == 12345);
|
||||
|
||||
|
||||
var publishedRouter = BaseWebTest.CreatePublishedRouter(SettingsForTests.GenerateMockWebRoutingSettings());
|
||||
var publishedRouter = BaseWebTest.CreatePublishedRouter(TestHelpers.SettingsForTests.GenerateMockWebRoutingSettings());
|
||||
var frequest = publishedRouter.CreateRequest(umbracoContext, new Uri("http://localhost/test"));
|
||||
frequest.PublishedContent = content;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ using Umbraco.Core.Strings;
|
||||
using Umbraco.Tests.LegacyXmlPublishedCache;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.Testing;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Tests.Common;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Models;
|
||||
using Umbraco.Web.Mvc;
|
||||
@@ -387,7 +387,7 @@ namespace Umbraco.Tests.Web.Mvc
|
||||
{
|
||||
var umbracoContext = GetUmbracoContext("/dang", 0);
|
||||
|
||||
var publishedRouter = BaseWebTest.CreatePublishedRouter(SettingsForTests.GenerateMockWebRoutingSettings());
|
||||
var publishedRouter = BaseWebTest.CreatePublishedRouter(TestHelpers.SettingsForTests.GenerateMockWebRoutingSettings());
|
||||
var frequest = publishedRouter.CreateRequest(umbracoContext, new Uri("http://localhost/dang"));
|
||||
|
||||
frequest.Culture = CultureInfo.InvariantCulture;
|
||||
|
||||
@@ -7,10 +7,10 @@ using System.Web.Routing;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.Common;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.TestHelpers.Stubs;
|
||||
using Umbraco.Tests.Testing;
|
||||
using Umbraco.Tests.Testing.Objects.Accessors;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Mvc;
|
||||
using Umbraco.Web.PublishedCache;
|
||||
|
||||
@@ -122,6 +122,7 @@ EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Umbraco.Web.Website", "Umbraco.Web.Website\Umbraco.Web.Website.csproj", "{5A246D54-3109-4D2B-BE7D-FC0787D126AE}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Tests.Integration", "Umbraco.Tests.Integration\Umbraco.Tests.Integration.csproj", "{D6319409-777A-4BD0-93ED-B2DFD805B32C}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Tests.Common", "Umbraco.Tests.Common\Umbraco.Tests.Common.csproj", "{A499779C-1B3B-48A8-B551-458E582E6E96}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -195,6 +196,10 @@ Global
|
||||
{D6319409-777A-4BD0-93ED-B2DFD805B32C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D6319409-777A-4BD0-93ED-B2DFD805B32C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D6319409-777A-4BD0-93ED-B2DFD805B32C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A499779C-1B3B-48A8-B551-458E582E6E96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A499779C-1B3B-48A8-B551-458E582E6E96}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A499779C-1B3B-48A8-B551-458E582E6E96}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A499779C-1B3B-48A8-B551-458E582E6E96}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -209,6 +214,7 @@ Global
|
||||
{C7311C00-2184-409B-B506-52A5FAEA8736} = {FD962632-184C-4005-A5F3-E705D92FC645}
|
||||
{FB5676ED-7A69-492C-B802-E7B24144C0FC} = {B5BD12C1-A454-435E-8A46-FF4A364C0382}
|
||||
{D6319409-777A-4BD0-93ED-B2DFD805B32C} = {B5BD12C1-A454-435E-8A46-FF4A364C0382}
|
||||
{A499779C-1B3B-48A8-B551-458E582E6E96} = {B5BD12C1-A454-435E-8A46-FF4A364C0382}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {7A0F2E34-D2AF-4DAB-86A0-7D7764B3D0EC}
|
||||
|
||||
Reference in New Issue
Block a user