You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
abp/test/Volo.Abp.Permissions.Tests/Volo/Abp/Permissions/PermissionManager_Basic_Tes...

31 lines
864 B

using System.Threading.Tasks;
using Shouldly;
using Xunit;
namespace Volo.Abp.Permissions
{
public class PermissionChecker_Basic_Tests : PermissionTestBase
{
private readonly IPermissionChecker _permissionChecker;
public PermissionChecker_Basic_Tests()
{
_permissionChecker = GetRequiredService<IPermissionChecker>();
}
[Fact]
public async Task Should_Throw_Exception_If_Permission_Is_Not_Defined()
{
await Assert.ThrowsAsync<AbpException>(async () =>
await _permissionChecker.IsGrantedAsync("UndefinedPermissionName")
);
}
[Fact]
public async Task Should_Return_False_As_Default_For_Any_Permission()
{
(await _permissionChecker.IsGrantedAsync("MyPermission1")).ShouldBeFalse();
}
}
}