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;
|
2020-12-04 02:21:21 +11:00
|
|
|
using Umbraco.Core.Security;
|
2020-05-17 10:39:30 +01:00
|
|
|
using Umbraco.Tests.Integration.Testing;
|
2020-12-23 12:02:01 +11:00
|
|
|
using Umbraco.Web.BackOffice.DependencyInjection;
|
2020-05-17 10:39:30 +01:00
|
|
|
|
2020-10-26 13:34:08 +01:00
|
|
|
namespace Umbraco.Tests.Integration.Umbraco.Web.BackOffice
|
2020-05-17 10:39:30 +01:00
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
public class UmbracoBackOfficeServiceCollectionExtensionsTests : UmbracoIntegrationTest
|
|
|
|
|
{
|
2020-12-23 13:57:41 +11:00
|
|
|
protected override void CustomTestSetup(IUmbracoBuilder builder) => builder.Services.AddUmbracoBackOfficeIdentity();
|
|
|
|
|
|
2020-05-17 10:39:30 +01:00
|
|
|
[Test]
|
|
|
|
|
public void AddUmbracoBackOfficeIdentity_ExpectBackOfficeUserStoreResolvable()
|
|
|
|
|
{
|
2020-12-23 11:35:49 +01:00
|
|
|
IUserStore<BackOfficeIdentityUser> userStore = Services.GetService<IUserStore<BackOfficeIdentityUser>>();
|
2020-05-17 10:39:30 +01:00
|
|
|
|
|
|
|
|
Assert.IsNotNull(userStore);
|
|
|
|
|
Assert.AreEqual(typeof(BackOfficeUserStore), userStore.GetType());
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-18 08:21:34 +01:00
|
|
|
[Test]
|
|
|
|
|
public void AddUmbracoBackOfficeIdentity_ExpectBackOfficeClaimsPrincipalFactoryResolvable()
|
|
|
|
|
{
|
2020-12-23 11:35:49 +01:00
|
|
|
IUserClaimsPrincipalFactory<BackOfficeIdentityUser> principalFactory = Services.GetService<IUserClaimsPrincipalFactory<BackOfficeIdentityUser>>();
|
2020-05-18 08:21:34 +01:00
|
|
|
|
|
|
|
|
Assert.IsNotNull(principalFactory);
|
2020-12-03 20:30:35 +11:00
|
|
|
Assert.AreEqual(typeof(BackOfficeClaimsPrincipalFactory), principalFactory.GetType());
|
2020-05-18 08:21:34 +01:00
|
|
|
}
|
|
|
|
|
|
2020-05-17 10:39:30 +01:00
|
|
|
[Test]
|
|
|
|
|
public void AddUmbracoBackOfficeIdentity_ExpectBackOfficeUserManagerResolvable()
|
|
|
|
|
{
|
2020-12-23 11:35:49 +01:00
|
|
|
IBackOfficeUserManager userManager = Services.GetService<IBackOfficeUserManager>();
|
2020-05-17 10:39:30 +01:00
|
|
|
|
|
|
|
|
Assert.NotNull(userManager);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|