Files
Umbraco-CMS/src/Umbraco.Tests.Integration/Umbraco.Web.BackOffice/UmbracoBackOfficeServiceCollectionExtensionsTests.cs
Bjarke Berg 0c908a7bbb Introduced interface on BackOfficeUserManager (#8913)
* Introduced IBackOfficeUserManager

* Fixed test

* Moved class into own file

Co-authored-by: Elitsa Marinovska <elm@umbraco.dk>
2020-09-22 14:44:41 +02:00

43 lines
1.5 KiB
C#

using System;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.DependencyInjection;
using NUnit.Framework;
using Umbraco.Extensions;
using Umbraco.Core.BackOffice;
using Umbraco.Tests.Integration.Testing;
namespace Umbraco.Tests.UnitTests.Umbraco.Web.BackOffice.Extensions
{
[TestFixture]
public class UmbracoBackOfficeServiceCollectionExtensionsTests : UmbracoIntegrationTest
{
[Test]
public void AddUmbracoBackOfficeIdentity_ExpectBackOfficeUserStoreResolvable()
{
var userStore = Services.GetService<IUserStore<BackOfficeIdentityUser>>();
Assert.IsNotNull(userStore);
Assert.AreEqual(typeof(BackOfficeUserStore), userStore.GetType());
}
[Test]
public void AddUmbracoBackOfficeIdentity_ExpectBackOfficeClaimsPrincipalFactoryResolvable()
{
var principalFactory = Services.GetService<IUserClaimsPrincipalFactory<BackOfficeIdentityUser>>();
Assert.IsNotNull(principalFactory);
Assert.AreEqual(typeof(BackOfficeClaimsPrincipalFactory<BackOfficeIdentityUser>), principalFactory.GetType());
}
[Test]
public void AddUmbracoBackOfficeIdentity_ExpectBackOfficeUserManagerResolvable()
{
var userManager = Services.GetService<IBackOfficeUserManager>();
Assert.NotNull(userManager);
}
protected override Action<IServiceCollection> CustomTestSetup => (services) => services.AddUmbracoBackOfficeIdentity();
}
}