Files
Umbraco-CMS/src/Umbraco.Tests.UnitTests/Umbraco.Web.BackOffice/Controllers/UsersControllerUnitTests.cs

31 lines
939 B
C#
Raw Normal View History

using AutoFixture.NUnit3;
using Moq;
using NUnit.Framework;
using Umbraco.Core.Security;
2020-07-01 17:42:39 +02:00
using Umbraco.Tests.UnitTests.AutoFixture;
using Umbraco.Web.BackOffice.Controllers;
2020-06-25 11:22:59 +02:00
using Umbraco.Web.Common.Exceptions;
namespace Umbraco.Tests.UnitTests.Umbraco.Web.BackOffice.Controllers
{
[TestFixture]
public class UsersControllerUnitTests
{
2020-06-25 11:22:59 +02:00
[Test,AutoMoqData]
2020-07-01 17:42:39 +02:00
public void PostUnlockUsers_When_User_Lockout_Update_Fails_Expect_Failure_Response(
[Frozen] IBackOfficeUserManager backOfficeUserManager,
UsersController sut,
2020-06-25 11:22:59 +02:00
BackOfficeIdentityUser user,
int[] userIds,
string expectedMessage)
{
Mock.Get(backOfficeUserManager)
.Setup(x => x.FindByIdAsync(It.IsAny<string>()))
2020-06-25 11:22:59 +02:00
.ReturnsAsync(user);
2020-06-25 11:22:59 +02:00
Assert.ThrowsAsync<HttpResponseException>(() => sut.PostUnlockUsers(userIds));
}
2020-06-25 11:22:59 +02:00
}
}