2020-12-23 11:35:49 +01:00
|
|
|
// Copyright (c) Umbraco.
|
|
|
|
|
// See LICENSE for more details.
|
|
|
|
|
|
2020-05-17 10:39:30 +01:00
|
|
|
using Microsoft.AspNetCore.Identity;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using NUnit.Framework;
|
2021-02-09 10:22:42 +01:00
|
|
|
using Umbraco.Cms.Core.DependencyInjection;
|
2021-02-15 12:01:12 +01:00
|
|
|
using Umbraco.Cms.Core.Security;
|
2021-02-11 08:30:27 +01:00
|
|
|
using Umbraco.Cms.Tests.Integration.Testing;
|
2021-02-10 11:11:18 +01:00
|
|
|
using Umbraco.Extensions;
|
2020-05-17 10:39:30 +01:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
namespace Umbraco.Cms.Tests.Integration.Umbraco.Web.BackOffice;
|
|
|
|
|
|
|
|
|
|
[TestFixture]
|
2025-03-21 18:02:31 +01:00
|
|
|
internal sealed class UmbracoBackOfficeServiceCollectionExtensionsTests : UmbracoIntegrationTest
|
2020-05-17 10:39:30 +01:00
|
|
|
{
|
2022-06-21 08:09:38 +02:00
|
|
|
protected override void CustomTestSetup(IUmbracoBuilder builder) => builder.AddBackOfficeIdentity();
|
2020-12-23 13:57:41 +11:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
[Test]
|
|
|
|
|
public void AddUmbracoBackOfficeIdentity_ExpectBackOfficeUserStoreResolvable()
|
|
|
|
|
{
|
|
|
|
|
var userStore = Services.GetService<IUserStore<BackOfficeIdentityUser>>();
|
2020-05-17 10:39:30 +01:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
Assert.IsNotNull(userStore);
|
|
|
|
|
Assert.AreEqual(typeof(BackOfficeUserStore), userStore.GetType());
|
|
|
|
|
}
|
2020-05-17 10:39:30 +01:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
[Test]
|
|
|
|
|
public void AddUmbracoBackOfficeIdentity_ExpectBackOfficeClaimsPrincipalFactoryResolvable()
|
|
|
|
|
{
|
|
|
|
|
var principalFactory = Services.GetService<IUserClaimsPrincipalFactory<BackOfficeIdentityUser>>();
|
2020-05-18 08:21:34 +01:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
Assert.IsNotNull(principalFactory);
|
|
|
|
|
Assert.AreEqual(typeof(BackOfficeClaimsPrincipalFactory), principalFactory.GetType());
|
|
|
|
|
}
|
2020-05-18 08:21:34 +01:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
[Test]
|
|
|
|
|
public void AddUmbracoBackOfficeIdentity_ExpectBackOfficeUserManagerResolvable()
|
|
|
|
|
{
|
|
|
|
|
var userManager = Services.GetService<IBackOfficeUserManager>();
|
2020-05-17 10:39:30 +01:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
Assert.NotNull(userManager);
|
2020-05-17 10:39:30 +01:00
|
|
|
}
|
|
|
|
|
}
|