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


C# PluginManager.SetPluginProperty方法代码示例

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


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

示例1: SetPluginPropertyCastPropertyTest

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

            var logEntries = new List<LogEntry>();
            var log = new StubIFeedback<LogEntry>
            {
                ReportAsyncT0CancellationToken = (e, c) =>
                {
                    Console.WriteLine(e.ToString());
                    logEntries.Add(e);
                    return Task.FromResult(0);
                }
            };
            var unitTestingPlugin = new StubUnitTestPlugin();
            var pluginManager = new PluginManager(new List<ZvsPlugin> { unitTestingPlugin }, dbConnection, log, new StubIAdapterManager());

            //act
            await pluginManager.SetPluginProperty(unitTestingPlugin, "PropertyTest", "abc", CancellationToken.None);

            //assert 
            Assert.IsTrue(unitTestingPlugin.PropertyTest == 0, "Expected TestSetting property to be 0");
            Assert.IsTrue(logEntries.Count(o => o.Level == LogEntryLevel.Error && o.Message.Contains("Cannot cast value")) == 1, "Expected 1 cannot cast value on plugin setting error");
        }
开发者ID:ruisebastiao,项目名称:zVirtualScenes,代码行数:26,代码来源:PluginManagerTests.cs

示例2: SetPluginPropertyTest

        public async Task SetPluginPropertyTest()
        {
            //Arrange 
            var dbConnection = new StubIEntityContextConnection { NameOrConnectionStringGet = () => "am-SetPluginPropertyTest" };
            Database.SetInitializer(new CreateFreshDbInitializer());

            var logEntries = new List<LogEntry>();
            var log = new StubIFeedback<LogEntry>
            {
                ReportAsyncT0CancellationToken = (e, c) =>
                {
                    Console.WriteLine(e.ToString());
                    logEntries.Add(e);
                    return Task.FromResult(0);
                }
            };
            var unitTestingPlugin = new StubUnitTestPlugin();
            var pluginManager = new PluginManager(new List<ZvsPlugin> { unitTestingPlugin }, dbConnection, log, new StubIAdapterManager());

            //act
            await pluginManager.SetPluginProperty(unitTestingPlugin, "PropertyTest", "360", CancellationToken.None);

            //assert 
            Assert.IsTrue(logEntries.Count(o => o.Level == LogEntryLevel.Error) == 0, "Expected 0 errors");
            Assert.IsTrue(unitTestingPlugin.PropertyTest == 360, "Expected TestSetting property to be 360");
        }
开发者ID:m19brandon,项目名称:zVirtualScenes,代码行数:26,代码来源:PluginManagerTests.cs


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