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/modules/permission-management/test/Volo.Abp.PermissionManageme.../Volo/Abp/PermissionManagement/PermissionDataSeeder_Tests.cs

39 lines
1.3 KiB

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Shouldly;
using Xunit;
namespace Volo.Abp.PermissionManagement
{
public class PermissionDataSeeder_Tests : PermissionTestBase
{
private readonly IPermissionDataSeeder _permissionDataSeeder;
private readonly IPermissionGrantRepository _grantpermissionGrantRepository;
public PermissionDataSeeder_Tests()
{
_permissionDataSeeder = GetRequiredService<IPermissionDataSeeder>();
_grantpermissionGrantRepository = GetRequiredService<IPermissionGrantRepository>();
}
[Fact]
public async Task SeedAsync()
{
(await _grantpermissionGrantRepository.FindAsync("MyPermission1", "Test", "Test")).ShouldBeNull();
(await _grantpermissionGrantRepository.FindAsync("MyPermission2", "Test", "Test")).ShouldBeNull();
await _permissionDataSeeder.SeedAsync("Test", "Test", new List<string>()
{
"MyPermission1",
"MyPermission2"
});
(await _grantpermissionGrantRepository.FindAsync("MyPermission1", "Test", "Test")).ShouldNotBeNull();
(await _grantpermissionGrantRepository.FindAsync("MyPermission2", "Test", "Test")).ShouldNotBeNull();
}
}
}