2020-05-17 10:39:30 +01:00
|
|
|
using Microsoft.AspNetCore.Identity;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using NUnit.Framework;
|
2020-12-23 13:57:41 +11:00
|
|
|
using Umbraco.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()
|
|
|
|
|
{
|
|
|
|
|
var userStore = Services.GetService<IUserStore<BackOfficeIdentityUser>>();
|
|
|
|
|
|
|
|
|
|
Assert.IsNotNull(userStore);
|
|
|
|
|
Assert.AreEqual(typeof(BackOfficeUserStore), userStore.GetType());
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-18 08:21:34 +01:00
|
|
|
[Test]
|
|
|
|
|
public void AddUmbracoBackOfficeIdentity_ExpectBackOfficeClaimsPrincipalFactoryResolvable()
|
|
|
|
|
{
|
|
|
|
|
var principalFactory = Services.GetService<IUserClaimsPrincipalFactory<BackOfficeIdentityUser>>();
|
|
|
|
|
|
|
|
|
|
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-09-22 14:44:41 +02:00
|
|
|
var userManager = Services.GetService<IBackOfficeUserManager>();
|
2020-05-17 10:39:30 +01:00
|
|
|
|
|
|
|
|
Assert.NotNull(userManager);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|