public void TestLoadPluginEmpty() { var loader = new AggregatedPluginLoader(); loader.LoadAllOfType <ILogFileOutlinePlugin>().Should().BeEmpty(); loader.LoadAllOfType <IFileFormatPlugin>().Should().BeEmpty(); }
public void TestLoadPluginEmpty() { var loader = new AggregatedPluginLoader(); loader.LoadAllOfType <IWidgetPlugin>().Should().BeEmpty(); loader.LoadAllOfType <ILogAnalyserPlugin>().Should().BeEmpty(); }
public void TestLoadTwoLoaders() { var loader1 = new PluginRegistry(); var plugin1 = CreateWidgetPlugin(); loader1.Register(plugin1); var loader2 = new PluginRegistry(); var plugin2 = CreateWidgetPlugin(); loader2.Register(plugin2); var aggregatedLoader = new AggregatedPluginLoader(loader1, loader2); var plugins = aggregatedLoader.LoadAllOfType <IFileFormatPlugin>(); plugins.Should().BeEquivalentTo(plugin1, plugin2); }
private static IPluginLoader CreatePluginSystem(PluginArchiveLoader pluginScanner) { // Currently, we deploy some well known "plugins" via the installer and they're // not available as *.tvp files just yet (which means the PluginArchiveLoader won't find them). // Therefore we register those at a PluginRegistry. var wellKnownPlugins = LoadWellKnownPlugins(); // Even though we're dealing with the limitation above, the rest of the application should not need // to care, which is why we make both of those types of plugin accessible from one loader var pluginLoader = new AggregatedPluginLoader(pluginScanner, wellKnownPlugins); // Last but not least, the PluginArchiveLoader doesn't cache anything which means // that multiple Load requests would result in the same plugin being loaded many times. // we don't want that (unnecessary work, waste of CPU time, etc..), so that's why there's a cache. var pluginCache = new PluginCache(pluginLoader); return(pluginCache); }