Example #1
0
        public async Task DeletePermissionTestAsync()
        {
            await using (var context = NewContext())
            {
                var service = new PermissionService(context);

                var deletedPermission = new Permission
                {
                    CommandName = "test",
                    EntityId    = ValidRoleEntity,
                    GuildId     = ValidGuildEntity,
                    Status      = PermissionStatus.Deny,
                    Type        = EntityType.Role
                };
                await service.DeleteAsync(deletedPermission);

                await context.CommitAsync()
                .ConfigureAwait(false);
            }

            await using (var context = NewContext())
            {
                var service = new PermissionService(context);

                var permissions = await service.ListPermissionsAsync(ValidGuildEntity);

                Assert.Equal(3, permissions.Count);
            }
        }