示例#1
0
        public async Task CreateUseAndBlockDelete()
        {
            var settingsId = 0;
            var proxyId    = 0;

            using (var context = Repository.GetEntityContext())
            {
                var proxy = new ProxySetting(ProxySettingType.Manual);
                await context.Save(proxy).ConfigureAwait(false);

                var setting = new MangaReader.Core.Services.MangaSetting()
                {
                    Folder = AppConfig.DownloadFolder
                };
                setting.ProxySetting = proxy;
                await context.Save(setting).ConfigureAwait(false);

                async Task DeleteProxy()
                {
                    await context.Delete(proxy).ConfigureAwait(false);
                }

                settingsId = setting.Id;
                proxyId    = proxy.Id;
                Assert.ThrowsAsync <EntityException <ProxySetting> >(DeleteProxy);
            }

            using (var context = Repository.GetEntityContext())
            {
                var setting = await context.Get <MangaReader.Core.Services.MangaSetting>().SingleAsync(s => s.Id == settingsId).ConfigureAwait(false);

                var proxy = await context.Get <ProxySetting>().SingleAsync(s => s.Id == proxyId).ConfigureAwait(false);

                await context.Delete(setting).ConfigureAwait(false);

                await context.Delete(proxy).ConfigureAwait(false);
            }
        }
示例#2
0
 public static Type GetPluginType(MangaSetting mangaSetting)
 {
     return(ConfigStorage.Plugins.Single(p => p.MangaGuid == mangaSetting.Manga).GetType());
 }
示例#3
0
 public MangaSettingCache(MangaSetting mangaSetting) : this(GetPluginType(mangaSetting), mangaSetting.ProxySetting)
 {
 }