本文整理汇总了C#中PluginManager.FindZvsPlugin方法的典型用法代码示例。如果您正苦于以下问题:C# PluginManager.FindZvsPlugin方法的具体用法?C# PluginManager.FindZvsPlugin怎么用?C# PluginManager.FindZvsPlugin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginManager
的用法示例。
在下文中一共展示了PluginManager.FindZvsPlugin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindZvsPluginInvalidIdAsyncTest
public async Task FindZvsPluginInvalidIdAsyncTest()
{
//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 pluginManager = new PluginManager(new List<ZvsPlugin>(), dbConnection, log, new StubIAdapterManager());
await pluginManager.StartAsync(CancellationToken.None);
//act
var plugin = pluginManager.FindZvsPlugin(1);
//assert
Assert.IsNull(plugin, "Found a plugin?");
}
示例2: FindZvsPluginAsyncTest
public async Task FindZvsPluginAsyncTest()
{
//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
{
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)
};
var pluginManager = new PluginManager(new List<ZvsPlugin> { unitTestingPlugin }, dbConnection, log, new StubIAdapterManager());
await pluginManager.StartAsync(CancellationToken.None);
//act
var plugin = pluginManager.FindZvsPlugin(1);
//assert
Assert.IsNotNull(plugin, "Registered plugin not found!");
Assert.IsTrue(plugin.PluginGuid == unitTestingPlugin.PluginGuid, "Found wrong plugin!");
}