diff --git a/src/Umbraco.Configuration/Properties/AssemblyInfo.cs b/src/Umbraco.Configuration/Properties/AssemblyInfo.cs index d10dd929da..b77c087e22 100644 --- a/src/Umbraco.Configuration/Properties/AssemblyInfo.cs +++ b/src/Umbraco.Configuration/Properties/AssemblyInfo.cs @@ -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 diff --git a/src/Umbraco.Tests.Common/SettingsForTests.cs b/src/Umbraco.Tests.Common/SettingsForTests.cs new file mode 100644 index 0000000000..e63124a79a --- /dev/null +++ b/src/Umbraco.Tests.Common/SettingsForTests.cs @@ -0,0 +1,182 @@ +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(IUmbracoVersion umbVersion, IIOHelper ioHelper) + { + _umbVersion = umbVersion; + _ioHelper = ioHelper; + } + + public IGlobalSettings GenerateMockGlobalSettings() + { + var config = Mock.Of( + 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; + } + + /// + /// Returns generated settings which can be stubbed to return whatever values necessary + /// + /// + public IContentSettings GenerateMockContentSettings() + { + + var content = new Mock(); + + //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 SavedAppSettings = new Dictionary(); + + //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; + } + + /// + /// This sets all settings back to default settings + /// + private void ResetSettings() + { + _defaultGlobalSettings = null; + } + + private IGlobalSettings _defaultGlobalSettings; + private IHostingSettings _defaultHostingSettings; + private readonly IUmbracoVersion _umbVersion; + private readonly IIOHelper _ioHelper; + + public IGlobalSettings GetDefaultGlobalSettings() + { + if (_defaultGlobalSettings == null) + { + _defaultGlobalSettings = GenerateMockGlobalSettings(); + } + return _defaultGlobalSettings; + } + + public IHostingSettings GetDefaultHostingSettings() + { + if (_defaultHostingSettings == null) + { + _defaultHostingSettings = GenerateMockHostingSettings(); + } + return _defaultHostingSettings; + } + + private IHostingSettings GenerateMockHostingSettings() + { + var config = Mock.Of( + settings => + settings.LocalTempStorageLocation == LocalTempStorage.EnvironmentTemp && + settings.DebugMode == false + ); + return config; + } + + public IWebRoutingSettings GenerateMockWebRoutingSettings() + { + var mock = new Mock(); + + 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(); + + 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(); + + return security.Object; + } + + public IUserPasswordConfiguration GenerateMockUserPasswordConfiguration() + { + var mock = new Mock(); + + return mock.Object; + } + + public IMemberPasswordConfiguration GenerateMockMemberPasswordConfiguration() + { + var mock = new Mock(); + + return mock.Object; + } + } +} diff --git a/src/Umbraco.Tests.Common/TestHelperBase.cs b/src/Umbraco.Tests.Common/TestHelperBase.cs new file mode 100644 index 0000000000..81bcc71a7d --- /dev/null +++ b/src/Umbraco.Tests.Common/TestHelperBase.cs @@ -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 +{ + /// + /// Common helper properties and methods useful to testing + /// + public abstract class TestHelperBase + { + public TestHelperBase() + { + IOHelper = new IOHelper(GetHostingEnvironment()); + MainDom = new MainDom(Mock.Of(), GetHostingEnvironment(), new MainDomSemaphoreLock(Mock.Of(), GetHostingEnvironment())); + UriUtility = new UriUtility(GetHostingEnvironment()); + SettingsForTests = new SettingsForTests(GetUmbracoVersion(), IOHelper); + } + + public ITypeFinder GetTypeFinder() + { + + var typeFinder = new TypeFinder(Mock.Of(), + new DefaultUmbracoAssemblyProvider(typeof(TestHelperBase).Assembly)); + return typeFinder; + } + + public TypeLoader GetMockedTypeLoader() + { + return new TypeLoader(IOHelper, Mock.Of(), Mock.Of(), new DirectoryInfo(IOHelper.MapPath("~/App_Data/TEMP")), Mock.Of()); + } + + public Configs GetConfigs() + { + return GetConfigsFactory().Create(IOHelper, Mock.Of()); + } + public IRuntimeState GetRuntimeState() + { + return new RuntimeState( + Mock.Of(), + Mock.Of(), + new Lazy(), + new Lazy(), + GetUmbracoVersion(), + GetHostingEnvironment(), + GetBackOfficeInfo() + ); + } + + public abstract IBackOfficeInfo GetBackOfficeInfo(); + + public IConfigsFactory GetConfigsFactory() + { + return new ConfigsFactory(); + } + + /// + /// Gets the current assembly directory. + /// + /// The assembly directory. + 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(); + + /// + /// Maps the given making it rooted on . must start with ~/ + /// + /// The relative path. + /// + 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(); + + return mock.Object; + } + } +} diff --git a/src/Umbraco.Tests/Testing/Objects/Accessors/TestVariationContextAccessor.cs b/src/Umbraco.Tests.Common/TestVariationContextAccessor.cs similarity index 87% rename from src/Umbraco.Tests/Testing/Objects/Accessors/TestVariationContextAccessor.cs rename to src/Umbraco.Tests.Common/TestVariationContextAccessor.cs index 134b709447..b2a07b74f2 100644 --- a/src/Umbraco.Tests/Testing/Objects/Accessors/TestVariationContextAccessor.cs +++ b/src/Umbraco.Tests.Common/TestVariationContextAccessor.cs @@ -1,6 +1,6 @@ using Umbraco.Core.Models.PublishedContent; -namespace Umbraco.Tests.Testing.Objects.Accessors +namespace Umbraco.Tests.Common { /// /// Provides an implementation of for tests. diff --git a/src/Umbraco.Tests.Common/Umbraco.Tests.Common.csproj b/src/Umbraco.Tests.Common/Umbraco.Tests.Common.csproj new file mode 100644 index 0000000000..e6963bc8aa --- /dev/null +++ b/src/Umbraco.Tests.Common/Umbraco.Tests.Common.csproj @@ -0,0 +1,18 @@ + + + + netstandard2.0 + + + + + + + + + + + + + + diff --git a/src/Umbraco.Tests/Cache/DistributedCacheBinderTests.cs b/src/Umbraco.Tests/Cache/DistributedCacheBinderTests.cs index 5fb4b19168..bd4f1ca21d 100644 --- a/src/Umbraco.Tests/Cache/DistributedCacheBinderTests.cs +++ b/src/Umbraco.Tests/Cache/DistributedCacheBinderTests.cs @@ -10,6 +10,7 @@ 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; diff --git a/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs b/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs index 71ed653449..af4c660112 100644 --- a/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs +++ b/src/Umbraco.Tests/Cache/PublishedCache/PublishedContentCacheTests.cs @@ -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; diff --git a/src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs b/src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs index bea0dce979..9208231e2a 100644 --- a/src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs +++ b/src/Umbraco.Tests/PublishedContent/NuCacheChildrenTests.cs @@ -20,6 +20,7 @@ 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; @@ -63,7 +64,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(); - configs.Add(SettingsForTests.GenerateMockContentSettings); + configs.Add(TestHelpers.SettingsForTests.GenerateMockContentSettings); configs.Add(() => globalSettings); Mock.Get(factory).Setup(x => x.GetInstance(typeof(IPublishedModelFactory))).Returns(PublishedModelFactory); diff --git a/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs b/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs index 7abd4179f0..d451a7e65a 100644 --- a/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs +++ b/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs @@ -18,6 +18,7 @@ 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; @@ -55,7 +56,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(() => globalSettings); var publishedModelFactory = new NoopPublishedModelFactory(); diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentSnapshotTestBase.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentSnapshotTestBase.cs index 1806493cdd..06a53db4ff 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentSnapshotTestBase.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentSnapshotTestBase.cs @@ -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 { diff --git a/src/Umbraco.Tests/Runtimes/StandaloneTests.cs b/src/Umbraco.Tests/Runtimes/StandaloneTests.cs index 2560ae8e94..54b5803beb 100644 --- a/src/Umbraco.Tests/Runtimes/StandaloneTests.cs +++ b/src/Umbraco.Tests/Runtimes/StandaloneTests.cs @@ -36,6 +36,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 +121,8 @@ namespace Umbraco.Tests.Runtimes .Append(); // 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 +160,7 @@ namespace Umbraco.Tests.Runtimes var scopeProvider = factory.GetInstance(); 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(); } diff --git a/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs b/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs index 41c8d59105..8d410e3570 100644 --- a/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs +++ b/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs @@ -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; diff --git a/src/Umbraco.Tests/Security/BackOfficeCookieManagerTests.cs b/src/Umbraco.Tests/Security/BackOfficeCookieManagerTests.cs index 16b8859bed..2f4f77cee7 100644 --- a/src/Umbraco.Tests/Security/BackOfficeCookieManagerTests.cs +++ b/src/Umbraco.Tests/Security/BackOfficeCookieManagerTests.cs @@ -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 { diff --git a/src/Umbraco.Tests/Services/MemberServiceTests.cs b/src/Umbraco.Tests/Services/MemberServiceTests.cs index e95d3a6f60..f73081b6d5 100644 --- a/src/Umbraco.Tests/Services/MemberServiceTests.cs +++ b/src/Umbraco.Tests/Services/MemberServiceTests.cs @@ -24,6 +24,7 @@ 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 { diff --git a/src/Umbraco.Tests/TestHelpers/BaseWebTest.cs b/src/Umbraco.Tests/TestHelpers/BaseWebTest.cs index c92469a22a..579ca104ea 100644 --- a/src/Umbraco.Tests/TestHelpers/BaseWebTest.cs +++ b/src/Umbraco.Tests/TestHelpers/BaseWebTest.cs @@ -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; diff --git a/src/Umbraco.Tests/TestHelpers/ControllerTesting/TestControllerActivatorBase.cs b/src/Umbraco.Tests/TestHelpers/ControllerTesting/TestControllerActivatorBase.cs index 35197e13e0..a39219a570 100644 --- a/src/Umbraco.Tests/TestHelpers/ControllerTesting/TestControllerActivatorBase.cs +++ b/src/Umbraco.Tests/TestHelpers/ControllerTesting/TestControllerActivatorBase.cs @@ -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 { diff --git a/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs b/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs index 7ab86723d7..9c49fd43ba 100644 --- a/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs +++ b/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs @@ -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( - 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(TestHelper.GetUmbracoVersion(), TestHelper.IOHelper); - - - return config; - } + public static IGlobalSettings GenerateMockGlobalSettings() => _settingsForTests.GenerateMockGlobalSettings(); /// /// Returns generated settings which can be stubbed to return whatever values necessary /// /// - public static IContentSettings GenerateMockContentSettings() - { - - var content = new Mock(); - - //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(); - //// set some defaults that are wrong in the config file?! - //// this is annoying, really - //HideTopLevelNodeFromPath = false; - } + internal static IHostingSettings GetDefaultHostingSettings() => _settingsForTests.GetDefaultHostingSettings(); - /// - /// This sets all settings back to default settings - /// - 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( - settings => - settings.LocalTempStorageLocation == LocalTempStorage.EnvironmentTemp && - settings.DebugMode == false - ); - return config; - } - - public static IWebRoutingSettings GenerateMockWebRoutingSettings() - { - var mock = new Mock(); - - 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(); - - 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(); - - return security.Object; - } - - public static IUserPasswordConfiguration GenerateMockUserPasswordConfiguration() - { - var mock = new Mock(); - - return mock.Object; - } - - public static IMemberPasswordConfiguration GenerateMockMemberPasswordConfiguration() - { - var mock = new Mock(); - - return mock.Object; - } + public static IMemberPasswordConfiguration GenerateMockMemberPasswordConfiguration() => _settingsForTests.GenerateMockMemberPasswordConfiguration(); } } diff --git a/src/Umbraco.Tests/TestHelpers/TestHelper.cs b/src/Umbraco.Tests/TestHelpers/TestHelper.cs index b201959de6..16eed4b336 100644 --- a/src/Umbraco.Tests/TestHelpers/TestHelper.cs +++ b/src/Umbraco.Tests/TestHelpers/TestHelper.cs @@ -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,64 @@ namespace Umbraco.Tests.TestHelpers /// public static class TestHelper { - - public static ITypeFinder GetTypeFinder() + private static TestHelperInternal _testHelperInternal = new TestHelperInternal(); + private class TestHelperInternal : TestHelperBase { - - var typeFinder = new TypeFinder(Mock.Of(), - 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(), TestHelper.IOHelper, Mock.Of(), 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(), Mock.Of(), new DirectoryInfo(IOHelper.MapPath("~/App_Data/TEMP")), Mock.Of()); - } + public static ITypeFinder GetTypeFinder() => _testHelperInternal.GetTypeFinder(); - public static Configs GetConfigs() - { - return GetConfigsFactory().Create(IOHelper, Mock.Of()); - } - public static IRuntimeState GetRuntimeState() - { - return new RuntimeState( - Mock.Of(), - Mock.Of(), - new Lazy(), - new Lazy(), - 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(), 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(); /// /// Gets the current assembly directory. /// /// The assembly directory. - 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(), GetHostingEnvironment(), new MainDomSemaphoreLock(Mock.Of(), 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; /// /// Maps the given making it rooted on . must start with ~/ /// /// The relative path. /// - 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 +144,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 sorter = null, string[] ignoreProperties = null) { @@ -314,6 +288,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 +307,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 +336,6 @@ namespace Umbraco.Tests.TestHelpers return mock.Object; } - public static IPublishedUrlProvider GetPublishedUrlProvider() - { - var mock = new Mock(); - - return mock.Object; - } + public static IPublishedUrlProvider GetPublishedUrlProvider() => _testHelperInternal.GetPublishedUrlProvider(); } } diff --git a/src/Umbraco.Tests/TestHelpers/TestObjects-Mocks.cs b/src/Umbraco.Tests/TestHelpers/TestObjects-Mocks.cs index 93ae4a13b1..916a0fb790 100644 --- a/src/Umbraco.Tests/TestHelpers/TestObjects-Mocks.cs +++ b/src/Umbraco.Tests/TestHelpers/TestObjects-Mocks.cs @@ -17,6 +17,7 @@ using Umbraco.Core.Models.PublishedContent; using Umbraco.Core.Persistence; using Umbraco.Core.Persistence.SqlSyntax; using Umbraco.Core.Services; +using Umbraco.Tests.Common; using Umbraco.Tests.Testing.Objects.Accessors; using Umbraco.Web; using Umbraco.Web.PublishedCache; diff --git a/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs b/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs index b02af84e09..4b75ce2046 100644 --- a/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs +++ b/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs @@ -32,6 +32,7 @@ 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 { diff --git a/src/Umbraco.Tests/Testing/Objects/TestUmbracoContextFactory.cs b/src/Umbraco.Tests/Testing/Objects/TestUmbracoContextFactory.cs index 20b18fa728..4404f7225f 100644 --- a/src/Umbraco.Tests/Testing/Objects/TestUmbracoContextFactory.cs +++ b/src/Umbraco.Tests/Testing/Objects/TestUmbracoContextFactory.cs @@ -3,6 +3,7 @@ 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; @@ -21,7 +22,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(); diff --git a/src/Umbraco.Tests/Testing/UmbracoTestBase.cs b/src/Umbraco.Tests/Testing/UmbracoTestBase.cs index 58a6fa6d41..22b23c9835 100644 --- a/src/Umbraco.Tests/Testing/UmbracoTestBase.cs +++ b/src/Umbraco.Tests/Testing/UmbracoTestBase.cs @@ -63,6 +63,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 { /// @@ -138,7 +140,7 @@ namespace Umbraco.Tests.Testing protected virtual IProfilingLogger ProfilingLogger => Factory.GetInstance(); - protected IHostingEnvironment HostingEnvironment { get; } = new AspNetHostingEnvironment(SettingsForTests.GetDefaultHostingSettings()); + protected IHostingEnvironment HostingEnvironment { get; } = new AspNetHostingEnvironment(TestHelpers.SettingsForTests.GetDefaultHostingSettings()); protected IIpResolver IpResolver => Factory.GetInstance(); protected IBackOfficeInfo BackOfficeInfo => Factory.GetInstance(); protected AppCaches AppCaches => Factory.GetInstance(); @@ -173,8 +175,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 +323,7 @@ namespace Umbraco.Tests.Testing Composition.RegisterUnique(factory => new UrlProvider( factory.GetInstance(), - SettingsForTests.GenerateMockWebRoutingSettings(), + TestHelpers.SettingsForTests.GenerateMockWebRoutingSettings(), new UrlProviderCollection(Enumerable.Empty()), new MediaUrlProviderCollection(Enumerable.Empty()), factory.GetInstance() @@ -411,14 +413,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(() => new DefaultUserPasswordConfig()); } @@ -548,7 +550,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(); diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index 0090b28a0a..1cf4695b42 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -222,7 +222,6 @@ - @@ -586,6 +585,10 @@ {f6de8da0-07cc-4ef2-8a59-2bc81dbb3830} Umbraco.PublishedCache.NuCache + + {a499779c-1b3b-48a8-b551-458e582e6e96} + Umbraco.Tests.Common + {651E1350-91B6-44B7-BD60-7207006D7003} Umbraco.Web diff --git a/src/Umbraco.Tests/Web/Mvc/RenderIndexActionSelectorAttributeTests.cs b/src/Umbraco.Tests/Web/Mvc/RenderIndexActionSelectorAttributeTests.cs index bdd7c6eb93..63b27ee865 100644 --- a/src/Umbraco.Tests/Web/Mvc/RenderIndexActionSelectorAttributeTests.cs +++ b/src/Umbraco.Tests/Web/Mvc/RenderIndexActionSelectorAttributeTests.cs @@ -13,6 +13,7 @@ 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; diff --git a/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs b/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs index 240fdf835d..512ff6fe65 100644 --- a/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs +++ b/src/Umbraco.Tests/Web/Mvc/SurfaceControllerTests.cs @@ -11,6 +11,7 @@ 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; @@ -156,7 +157,7 @@ namespace Umbraco.Tests.Web.Mvc var content = Mock.Of(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; diff --git a/src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs b/src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs index ab916b8428..2337ea6896 100644 --- a/src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs +++ b/src/Umbraco.Tests/Web/Mvc/UmbracoViewPageTests.cs @@ -17,6 +17,7 @@ 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 +388,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; diff --git a/src/Umbraco.Tests/Web/WebExtensionMethodTests.cs b/src/Umbraco.Tests/Web/WebExtensionMethodTests.cs index 08cd84744b..44a4020d72 100644 --- a/src/Umbraco.Tests/Web/WebExtensionMethodTests.cs +++ b/src/Umbraco.Tests/Web/WebExtensionMethodTests.cs @@ -7,6 +7,7 @@ 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; diff --git a/src/umbraco.sln b/src/umbraco.sln index f98f7e034e..be363ef2e6 100644 --- a/src/umbraco.sln +++ b/src/umbraco.sln @@ -117,9 +117,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Umbraco.Examine.Lucene", "U EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Umbraco.Web.BackOffice", "Umbraco.Web.BackOffice\Umbraco.Web.BackOffice.csproj", "{9B95EEF7-63FE-4432-8C63-166BE9C1A929}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Web.UI.NetCore", "Umbraco.Web.UI.NetCore\Umbraco.Web.UI.NetCore.csproj", "{DCDFE97C-5630-4F6F-855D-8AEEB96556A5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Umbraco.Web.UI.NetCore", "Umbraco.Web.UI.NetCore\Umbraco.Web.UI.NetCore.csproj", "{DCDFE97C-5630-4F6F-855D-8AEEB96556A5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Web.Website", "Umbraco.Web.Website\Umbraco.Web.Website.csproj", "{5A246D54-3109-4D2B-BE7D-FC0787D126AE}" +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.Common", "Umbraco.Tests.Common\Umbraco.Tests.Common.csproj", "{A499779C-1B3B-48A8-B551-458E582E6E96}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -189,6 +191,10 @@ Global {5A246D54-3109-4D2B-BE7D-FC0787D126AE}.Debug|Any CPU.Build.0 = Debug|Any CPU {5A246D54-3109-4D2B-BE7D-FC0787D126AE}.Release|Any CPU.ActiveCfg = Release|Any CPU {5A246D54-3109-4D2B-BE7D-FC0787D126AE}.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 @@ -202,6 +208,7 @@ Global {3A33ADC9-C6C0-4DB1-A613-A9AF0210DF3D} = {B5BD12C1-A454-435E-8A46-FF4A364C0382} {C7311C00-2184-409B-B506-52A5FAEA8736} = {FD962632-184C-4005-A5F3-E705D92FC645} {FB5676ED-7A69-492C-B802-E7B24144C0FC} = {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}