Merge pull request #12663 from umbraco/v10/bugfix/fix-automoq

V10: Fix AutoMoq for unit tests
This commit is contained in:
Ronald Barendse
2022-07-06 15:32:48 +02:00
committed by GitHub
2 changed files with 13 additions and 21 deletions

View File

@@ -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<IFireAndForgetRunner>())
: this(
databaseBuilder,
logger,
umbracoVersion,
connectionStrings,
installationService,
cookieManager,
userAgentProvider,
umbracoDatabaseFactory,
StaticServiceProvider.Instance.GetRequiredService<IFireAndForgetRunner>())
{
_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;

View File

@@ -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<IUserStore<BackOfficeIdentityUser>>(cc =>