From 6d809042806c49d53cd96ff68fd46ff832157d36 Mon Sep 17 00:00:00 2001 From: nikolajlauridsen Date: Wed, 6 Jul 2022 14:52:00 +0200 Subject: [PATCH 1/2] Make InstallHelper moq greedy --- .../AutoFixture/Customizations/UmbracoCustomizations.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/Umbraco.Tests.UnitTests/AutoFixture/Customizations/UmbracoCustomizations.cs b/tests/Umbraco.Tests.UnitTests/AutoFixture/Customizations/UmbracoCustomizations.cs index 45ff7320c2..76643279fa 100644 --- a/tests/Umbraco.Tests.UnitTests/AutoFixture/Customizations/UmbracoCustomizations.cs +++ b/tests/Umbraco.Tests.UnitTests/AutoFixture/Customizations/UmbracoCustomizations.cs @@ -12,6 +12,7 @@ using Umbraco.Cms.Core.Configuration.Models; using Umbraco.Cms.Core.Hosting; using Umbraco.Cms.Core.Security; using Umbraco.Cms.Core.Services; +using Umbraco.Cms.Infrastructure.Install; using Umbraco.Cms.Infrastructure.Migrations.Install; using Umbraco.Cms.Web.BackOffice.Controllers; using Umbraco.Cms.Web.BackOffice.Install; @@ -37,7 +38,8 @@ internal class UmbracoCustomizations : ICustomization .Customize(new ConstructorCustomization(typeof(BackOfficeUserManager), new GreedyConstructorQuery())) .Customize(new ConstructorCustomization(typeof(MemberManager), new GreedyConstructorQuery())) .Customize(new ConstructorCustomization(typeof(DatabaseSchemaCreatorFactory), new GreedyConstructorQuery())) - .Customize(new ConstructorCustomization(typeof(BackOfficeServerVariables), new GreedyConstructorQuery())); + .Customize(new ConstructorCustomization(typeof(BackOfficeServerVariables), new GreedyConstructorQuery())) + .Customize(new ConstructorCustomization(typeof(InstallHelper), new GreedyConstructorQuery())); // When requesting an IUserStore ensure we actually uses a IUserLockoutStore fixture.Customize>(cc => From 9c5006e5c8e2b8b0488bbb83fecc71e605348dee Mon Sep 17 00:00:00 2001 From: nikolajlauridsen Date: Wed, 6 Jul 2022 14:53:57 +0200 Subject: [PATCH 2/2] Remove body from obsolete constructor --- .../Install/InstallHelper.cs | 30 +++++++------------ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/src/Umbraco.Infrastructure/Install/InstallHelper.cs b/src/Umbraco.Infrastructure/Install/InstallHelper.cs index 1cec345110..85839e8757 100644 --- a/src/Umbraco.Infrastructure/Install/InstallHelper.cs +++ b/src/Umbraco.Infrastructure/Install/InstallHelper.cs @@ -64,28 +64,18 @@ namespace Umbraco.Cms.Infrastructure.Install ICookieManager cookieManager, IUserAgentProvider userAgentProvider, IUmbracoDatabaseFactory umbracoDatabaseFactory) - : this( - databaseBuilder, - logger, - umbracoVersion, - connectionStrings, - installationService, - cookieManager, - userAgentProvider, - umbracoDatabaseFactory, - StaticServiceProvider.Instance.GetRequiredService()) + : this( + databaseBuilder, + logger, + umbracoVersion, + connectionStrings, + installationService, + cookieManager, + userAgentProvider, + umbracoDatabaseFactory, + StaticServiceProvider.Instance.GetRequiredService()) { - _logger = logger; - _umbracoVersion = umbracoVersion; - _databaseBuilder = databaseBuilder; - _connectionStrings = connectionStrings; - _installationService = installationService; - _cookieManager = cookieManager; - _userAgentProvider = userAgentProvider; - _umbracoDatabaseFactory = umbracoDatabaseFactory; - // We need to initialize the type already, as we can't detect later, if the connection string is added on the fly. - GetInstallationType(); } public InstallationType GetInstallationType() => _installationType ??= IsBrandNewInstall ? InstallationType.NewInstall : InstallationType.Upgrade;