Files
Umbraco-CMS/src/Umbraco.Tests.UnitTests/Umbraco.Web.BackOffice/Controllers/UsersControllerUnitTests.cs
Mole 9cd752c2f8 Netcore: Align Namespaces in Tests and Web.BackOffice (#9274)
* Align namespaces in integration tests

* Align namespaces in unit tests

* Align namespaces in Backoffice.Filters

* Align namespaces in Backoffice.ActionResults

* Align namespaces in Backoffice.Mapping

* Align namespaces in Backoffice.PorpertyEditors and SignalR

* Align namespaces in Backoffice.Trees

* Align unit tests after migration
2020-10-26 13:34:08 +01:00

33 lines
1005 B
C#

using System.Threading;
using AutoFixture.NUnit3;
using Microsoft.AspNetCore.Identity;
using Moq;
using NUnit.Framework;
using Umbraco.Core.BackOffice;
using Umbraco.Tests.UnitTests.AutoFixture;
using Umbraco.Web.BackOffice.Controllers;
using Umbraco.Web.Common.Exceptions;
namespace Umbraco.Tests.UnitTests.Umbraco.Web.BackOffice.Controllers
{
[TestFixture]
public class UsersControllerUnitTests
{
[Test,AutoMoqData]
public void PostUnlockUsers_When_User_Lockout_Update_Fails_Expect_Failure_Response(
[Frozen] IBackOfficeUserManager backOfficeUserManager,
UsersController sut,
BackOfficeIdentityUser user,
int[] userIds,
string expectedMessage)
{
Mock.Get(backOfficeUserManager)
.Setup(x => x.FindByIdAsync(It.IsAny<string>()))
.ReturnsAsync(user);
Assert.ThrowsAsync<HttpResponseException>(() => sut.PostUnlockUsers(userIds));
}
}
}