public void TestLoadPlugin() { _pluginLoader = new TestPluginLoader("MenuItemFeatureTestPlugin", _pluginManager); _pluginLoader.Load(); Assert.AreEqual(1, _pluginManager.Plugins.Count, "No plugins loaded."); Assert.AreEqual("MenuItemFeatureTestPlugin", _pluginManager.Plugins[0].Name, "Plugin Name incorrect"); Assert.AreEqual("plugin-vendor", _pluginManager.Plugins[0].Organization, "Plugin Vendor incorrect"); Assert.IsTrue(_pluginManager.Enabled, "Plugin manager isn't enabled"); Assert.IsNull(_pluginManager.Plugins[0].Error, "Error loading plugin manager"); }
public void TestLoadPlugin() { _pluginLoader = new TestPluginLoader("TabPageFeatureTestPlugin", _pluginManager); _pluginLoader.Load(); Assert.AreEqual(1, _pluginManager.Plugins.Count, "No plugin loaded."); Assert.AreEqual(8, _pluginManager.Plugins[0].Features.Count, "No features loaded."); Assert.IsNotNull(_pluginManager.Plugins[0].GetSearch("pl")); Assert.IsNotNull(_pluginManager.Plugins[0].GetSearch("svr")); Assert.IsNotNull(_pluginManager.Plugins[0].GetSearch("vm")); Assert.IsNotNull(_pluginManager.Plugins[0].GetSearch("sr")); Assert.IsNotNull(_pluginManager.Plugins[0].GetSearch("ut")); Assert.IsNotNull(_pluginManager.Plugins[0].GetSearch("dt")); }
public void TestLoadPlugin() { _pluginLoader = new TestPluginLoader("ParentMenuItemFeatureTestPlugin", _pluginManager); _pluginLoader.Load(); Assert.AreEqual(1, _pluginManager.Plugins.Count, "No plugins loaded."); Assert.AreEqual(1, _pluginManager.Plugins[0].Features.Count, "No features only"); Assert.IsInstanceOf <ParentMenuItemFeature>(_pluginManager.Plugins[0].Features[0], "ParentMenuItemFeature wasn't loaded"); ParentMenuItemFeature parentFeature = (ParentMenuItemFeature)_pluginManager.Plugins[0].Features[0]; Assert.AreEqual(1, parentFeature.Features.Count, "Child feature wasn't loaded."); Assert.AreEqual("file_ShellTest1", parentFeature.Features[0].Name); Assert.IsInstanceOf <MenuItemFeature>(parentFeature.Features[0]); }
public void TestLoadPlugin() { _pluginLoader = new TestPluginLoader("ParentMenuItemFeatureTestPlugin", _pluginManager); _pluginLoader.Load(); Assert.AreEqual(1, _pluginManager.Plugins.Count, "No plugins loaded."); Assert.AreEqual(1, _pluginManager.Plugins[0].Features.Count, "No features only"); Assert.IsInstanceOf<ParentMenuItemFeature>(_pluginManager.Plugins[0].Features[0], "ParentMenuItemFeature wasn't loaded"); ParentMenuItemFeature parentFeature = (ParentMenuItemFeature)_pluginManager.Plugins[0].Features[0]; Assert.AreEqual(1, parentFeature.Features.Count, "Child feature wasn't loaded."); Assert.AreEqual("file_ShellTest1", parentFeature.Features[0].Name); Assert.IsInstanceOf<MenuItemFeature>(parentFeature.Features[0]); }
public void TestHeadings() { _pluginLoader = new TestPluginLoader("MenuItemFeatureTestPlugin", _pluginManager); _pluginLoader.Load(); _pluginManager.Plugins[0].Enabled = true; Assert.AreEqual(PluginMenu.file, ((MenuItemFeature)_pluginManager.Plugins[0].Features[0]).Menu, "file_ShellTest1 plugin heading incorrect."); Assert.AreEqual(PluginMenu.view, ((MenuItemFeature)_pluginManager.Plugins[0].Features[1]).Menu, "file_ShellTest1 plugin heading incorrect."); Assert.AreEqual(PluginMenu.pool, ((MenuItemFeature)_pluginManager.Plugins[0].Features[2]).Menu, "file_ShellTest1 plugin heading incorrect."); Assert.AreEqual(PluginMenu.server, ((MenuItemFeature)_pluginManager.Plugins[0].Features[3]).Menu, "file_ShellTest1 plugin heading incorrect."); Assert.AreEqual(PluginMenu.vm, ((MenuItemFeature)_pluginManager.Plugins[0].Features[4]).Menu, "file_ShellTest1 plugin heading incorrect."); Assert.AreEqual(PluginMenu.storage, ((MenuItemFeature)_pluginManager.Plugins[0].Features[5]).Menu, "file_ShellTest1 plugin heading incorrect."); Assert.AreEqual(PluginMenu.templates, ((MenuItemFeature)_pluginManager.Plugins[0].Features[6]).Menu, "file_ShellTest1 plugin heading incorrect."); Assert.AreEqual(PluginMenu.tools, ((MenuItemFeature)_pluginManager.Plugins[0].Features[7]).Menu, "file_ShellTest1 plugin heading incorrect."); Assert.AreEqual(PluginMenu.window, ((MenuItemFeature)_pluginManager.Plugins[0].Features[8]).Menu, "file_ShellTest1 plugin heading incorrect."); Assert.AreEqual(PluginMenu.help, ((MenuItemFeature)_pluginManager.Plugins[0].Features[9]).Menu, "file_ShellTest1 plugin heading incorrect."); }
public void TestLoadPlugin() { _batchFile = new ShellCmdTestBatchFile(); _pluginLoader = new TestPluginLoader("ShellCmdTestPlugin", _pluginManager, _batchFile.Xml); _pluginLoader.Load(); Assert.IsTrue(File.Exists(_batchFile.BatchFile), "test batch file wasn't written"); Assert.IsFalse(File.Exists(_batchFile.FileThatBatchFileWillWrite), "test file shouldn't exist"); Assert.AreEqual(1, _pluginManager.Plugins.Count, "No plugins loaded."); Assert.AreEqual("ShellCmdTestPlugin", _pluginManager.Plugins[0].Name, "Plugin Name incorrect"); Assert.AreEqual("plugin-vendor", _pluginManager.Plugins[0].Organization, "Plugin Vendor incorrect"); Assert.IsTrue(_pluginManager.Enabled, "Plugin manager isn't enabled"); Assert.IsNull(_pluginManager.Plugins[0].Error, "Error when loading plugin manager"); Assert.AreEqual(1, _pluginManager.Plugins[0].Features.Count, "MenuItem feature wasn't loaded"); MenuItemFeature menuItemFeature = (MenuItemFeature)_pluginManager.Plugins[0].Features[0]; Assert.IsNotNull(menuItemFeature.ShellCmd, "ShellCmd wasn't loaded"); Assert.AreEqual(menuItemFeature.ShellCmd.Filename, _batchFile.BatchFile, "Batch file name wasn't read from plugin XML"); // now execute the command and see if the test file is written by the batch file. menuItemFeature.GetCommand(new MockMainWindow(), new SelectedItem[] { new SelectedItem((IXenObject)null) }).Execute(); int i = 0; bool completed = false; while (i < 300) { if (File.Exists(_batchFile.FileThatBatchFileWillWrite)) { completed = true; break; } Thread.Sleep(100); i++; } Assert.IsTrue(completed, "test didn't complete"); }
public void TestFirstFeatureDetails() { _pluginLoader = new TestPluginLoader("MenuItemFeatureTestPlugin", _pluginManager); _pluginLoader.Load(); _pluginManager.Plugins[0].Enabled = true; Assert.AreEqual(1, _pluginManager.Plugins.Count, "plugin wasn't loaded"); Assert.AreEqual(10, _pluginManager.Plugins[0].Features.Count, "features weren't loaded"); Assert.IsTrue(_pluginManager.Plugins[0].Enabled); MenuItemFeature menuItemFeature = (MenuItemFeature)_pluginManager.Plugins[0].Features[0]; Assert.AreEqual(PluginMenu.file, menuItemFeature.Menu, "file_ShellTest1 plugin heading incorrect."); //Assert.IsTrue(menuItemFeature.Enabled, "file_ShellTest1 plugin not enabled."); Assert.AreEqual("file_ShellTest1", menuItemFeature.Name, "file_ShellTest1 plugin name incorrect."); Assert.AreEqual("the label", menuItemFeature.Label, "file_ShellTest1 plugin label incorrect."); Assert.AreEqual("the description", menuItemFeature.Description, "file_ShellTest1 plugin description incorrect."); Assert.AreEqual("the tooltip", menuItemFeature.Tooltip, "file_ShellTest1 plugin tooltip incorrect."); Assert.AreEqual("MenuItemFeatureTestPlugin", menuItemFeature.PluginName, "file_ShellTest1 plugin name was incorrect."); Assert.IsNull(menuItemFeature.ParentFeature, "file_ShellTest1 shouldn't have parent feature"); Assert.IsInstanceOf <ShellCmd>(menuItemFeature.ShellCmd, "file_ShellTest1 should have shell cmd."); }
public void TestFirstFeatureDetails() { _pluginLoader = new TestPluginLoader("MenuItemFeatureTestPlugin", _pluginManager); _pluginLoader.Load(); _pluginManager.Plugins[0].Enabled = true; Assert.AreEqual(1, _pluginManager.Plugins.Count, "plugin wasn't loaded"); Assert.AreEqual(10, _pluginManager.Plugins[0].Features.Count, "features weren't loaded"); Assert.IsTrue(_pluginManager.Plugins[0].Enabled); MenuItemFeature menuItemFeature = (MenuItemFeature)_pluginManager.Plugins[0].Features[0]; Assert.AreEqual(PluginMenu.file, menuItemFeature.Menu, "file_ShellTest1 plugin heading incorrect."); //Assert.IsTrue(menuItemFeature.Enabled, "file_ShellTest1 plugin not enabled."); Assert.AreEqual("file_ShellTest1", menuItemFeature.Name, "file_ShellTest1 plugin name incorrect."); Assert.AreEqual("the label", menuItemFeature.Label, "file_ShellTest1 plugin label incorrect."); Assert.AreEqual("the description", menuItemFeature.Description, "file_ShellTest1 plugin description incorrect."); Assert.AreEqual("the tooltip", menuItemFeature.Tooltip, "file_ShellTest1 plugin tooltip incorrect."); Assert.AreEqual("MenuItemFeatureTestPlugin", menuItemFeature.PluginName, "file_ShellTest1 plugin name was incorrect."); Assert.IsNull(menuItemFeature.ParentFeature, "file_ShellTest1 shouldn't have parent feature"); Assert.IsInstanceOf<ShellCmd>(menuItemFeature.ShellCmd, "file_ShellTest1 should have shell cmd."); }