当前位置: 首页>>代码示例>>C#>>正文


C# PluginManager.DisablePluginAsync方法代码示例

本文整理汇总了C#中PluginManager.DisablePluginAsync方法的典型用法代码示例。如果您正苦于以下问题:C# PluginManager.DisablePluginAsync方法的具体用法?C# PluginManager.DisablePluginAsync怎么用?C# PluginManager.DisablePluginAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PluginManager的用法示例。


在下文中一共展示了PluginManager.DisablePluginAsync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DisablePluginAsyncNotFoundTest

        public async Task DisablePluginAsyncNotFoundTest()
        {
            //Arrange 
            var dbConnection = new UnitTestDbConnection();
            Database.SetInitializer(new CreateFreshDbInitializer());

            var log = new StubIFeedback<LogEntry>();
            var pluginManager = new PluginManager(new List<ZvsPlugin> { }, dbConnection, log, new StubIAdapterManager());

            //act
            var result = await pluginManager.DisablePluginAsync(Guid.Parse("a0f912a6-b8bb-406a-360f-1eb13f50aae4"), CancellationToken.None);

            //assert 
            Assert.IsTrue(result.HasError, result.Message);
        }
开发者ID:ruisebastiao,项目名称:zVirtualScenes,代码行数:15,代码来源:PluginManagerTests.cs

示例2: DisablePluginAsyncTest

        public async Task DisablePluginAsyncTest()
        {
            //Arrange 
            var dbConnection = new UnitTestDbConnection();
            Database.SetInitializer(new CreateFreshDbInitializer());

            var log = new StubIFeedback<LogEntry>();
            var hasStopped = false;
            var unitTestingPlugin = new StubUnitTestPlugin
            {
                PluginGuidGet = () => Guid.Parse("a0f912a6-b8bb-406a-360f-1eb13f50aae4"),
                NameGet = () => "Unit Testing Plugin",
                DescriptionGet = () => "",
                OnSettingsCreatingPluginSettingBuilder = s => Task.FromResult(0),
                OnDeviceSettingsCreatingDeviceSettingBuilder = s => Task.FromResult(0),
                OnSceneSettingsCreatingSceneSettingBuilder = s => Task.FromResult(0),
                StopAsync01 = async () => hasStopped = true
            };

            var pluginManager = new PluginManager(new List<ZvsPlugin> { unitTestingPlugin }, dbConnection, log, new StubIAdapterManager());

            var plugin = new Plugin
            {
                PluginGuid = Guid.Parse("a0f912a6-b8bb-406a-360f-1eb13f50aae4"),
            };
            using (var context = new ZvsContext(dbConnection))
            {
                context.Plugins.Add(plugin);
                await context.SaveChangesAsync(CancellationToken.None);
            }

            //act
            var result = await pluginManager.DisablePluginAsync(Guid.Parse("a0f912a6-b8bb-406a-360f-1eb13f50aae4"), CancellationToken.None);

            //assert 
            Assert.IsFalse(result.HasError, result.Message);
            Assert.IsTrue(hasStopped, "Expected plugin StopAsync to be called.");
        }
开发者ID:ruisebastiao,项目名称:zVirtualScenes,代码行数:38,代码来源:PluginManagerTests.cs


注:本文中的PluginManager.DisablePluginAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。