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

33 lines
995 B
C#
Raw Normal View History

2020-06-25 11:22:59 +02:00
using System.Threading;
using AutoFixture.NUnit3;
using Microsoft.AspNetCore.Identity;
using Moq;
using NUnit.Framework;
using Umbraco.Core.BackOffice;
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.Web.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(
2020-06-25 11:22:59 +02:00
[Frozen] IUserStore<BackOfficeIdentityUser> userStore,
UsersController sut,
2020-06-25 11:22:59 +02:00
BackOfficeIdentityUser user,
int[] userIds,
string expectedMessage)
{
2020-06-25 11:22:59 +02:00
Mock.Get(userStore)
.Setup(x => x.FindByIdAsync(It.IsAny<string>(), It.IsAny<CancellationToken>()))
.ReturnsAsync(user);
2020-06-25 11:22:59 +02:00
Assert.ThrowsAsync<HttpResponseException>(() => sut.PostUnlockUsers(userIds));
}
2020-06-25 11:22:59 +02:00
}
}