Exemplo n.º 1
0
        public async Task DeleteRole_Exist_Test()
        {
            var createRoleDto = new CreateRoleDto()
            {
                Name               = "RoleTest",
                DisplayName        = "Test role",
                Description        = "Role for test",
                GrantedPermissions = new List <string>()
                {
                    PermissionNames.Pages_Roles
                }
            };
            var roleDto = await _roleAppService.CreateAsync(createRoleDto);

            await UsingDbContextAsync(async context =>
            {
                var testTenant = await context.Roles.FirstOrDefaultAsync(r => r.Id == roleDto.Id);
                testTenant.ShouldNotBeNull();
            });

            await _roleAppService.DeleteAsync(new EntityDto <int>(roleDto.Id));

            await UsingDbContextAsync(async context =>
            {
                var testTenant = await context.Roles.FirstOrDefaultAsync(r => r.Id == roleDto.Id);
                testTenant.IsDeleted.ShouldBeTrue();
            });
        }
        public async Task DeleteRole_Test()
        {
            // Arrange
            Role defaultRole = await InitDateAsync();

            // Act
            await _roleAppService.DeleteAsync(new EntityDto <int>(defaultRole.Id));

            // Assert
            await UsingDbContextAsync(async context =>
            {
                var johnNashUser = await context.Roles.FirstOrDefaultAsync(r => r.Id == defaultRole.Id && r.TenantId == AbpSession.TenantId && r.IsDeleted == false);
                johnNashUser.ShouldBeNull();
            });
        }
Exemplo n.º 3
0
 public async Task <ActionResult> DeleteAsync([FromRoute] long id)
 {
     return(Result(await _roleService.DeleteAsync(id)));
 }
Exemplo n.º 4
0
 ///<inheritdoc/>
 protected override async Task RemoveAsync(Guid key, CancellationToken cancellationToken = default)
 => await _roleAppService.DeleteAsync(key, cancellationToken);