本文整理汇总了C#中ExpectedMenuItem类的典型用法代码示例。如果您正苦于以下问题:C# ExpectedMenuItem类的具体用法?C# ExpectedMenuItem怎么用?C# ExpectedMenuItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExpectedMenuItem类属于命名空间,在下文中一共展示了ExpectedMenuItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToolBar_AfterPoolDisconnection
public void ToolBar_AfterPoolDisconnection()
{
// disconnect from the pool and check that the toolbar buttons have be disabled.
// select pool
SelectInTree(GetAnyPool());
IXenConnection connection = GetAnyPool().Connection;
// now disconnect
MW<bool>(new DisconnectCommand(Program.MainWindow, connection, false).Execute);
// wait until the New Storage button is disabled.
MWWaitFor(() => !MainWindowWrapper.MainToolStrip.Items[6].Enabled);
ExpectedMenuItem[] buttons = new ExpectedMenuItem[]{
new ExpectedSeparator(),
new ExpectedTextMenuItem("Add New Server", true ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("New Pool", true ),
new ExpectedTextMenuItem("New Storage", false ),
new ExpectedTextMenuItem("New VM", false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Shut Down", false ),
new ExpectedTextMenuItem("Reboot", false ),
new ExpectedTextMenuItem("Suspend", false ),
};
// check toolbar buttons (while disconnected)
VerifyToolbar(buttons);
}
示例2: ToolBar_XenCenterNode
public void ToolBar_XenCenterNode()
{
ExpectedMenuItem[] buttons = new ExpectedMenuItem[]{
new ExpectedSeparator(),
new ExpectedTextMenuItem("Add New Server", true ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("New Pool", true ),
new ExpectedTextMenuItem("New Storage", false ),
new ExpectedTextMenuItem("New VM", false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Shut Down", false ),
new ExpectedTextMenuItem("Reboot", false ),
new ExpectedTextMenuItem("Suspend", false ),
};
VerifyToolbar(null, buttons);
}
示例3: ToolBar_DefaultTemplate
public void ToolBar_DefaultTemplate()
{
EnsureChecked(MainWindowWrapper.ViewMenuItems.TemplatesToolStripMenuItem);
ExpectedMenuItem[] buttons = new ExpectedMenuItem[]{
new ExpectedSeparator(),
new ExpectedTextMenuItem("Add New Server", true ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("New Pool", true ),
new ExpectedTextMenuItem("New Storage", true ),
new ExpectedTextMenuItem("New VM", true ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Shut Down", false ),
new ExpectedTextMenuItem("Reboot", false ),
new ExpectedTextMenuItem("Suspend", false ),
};
VerifyToolbar(GetAnyDefaultTemplate(), buttons);
}
示例4: VerifyContextMenu
// In the expected items, represent a separator by a null
protected void VerifyContextMenu(object ixmo, ExpectedMenuItem[] expectedItems)
{
string ixmoString = (ixmo == null ? "XenCenter node" : ixmo.ToString());
Assert.IsTrue(SelectInTree(ixmo), "Couldn't find a node for " + ixmoString + " in the tree");
MW(() =>
{
var tree = TestUtils.GetFlickerFreeTreeView(MainWindowWrapper.Item, "navigationPane.navigationView.treeView");
// Generate the TreeContextMenu
var e = new VirtualTreeNodeMouseClickEventArgs(tree.SelectedNode, MouseButtons.Right, 1, 0, 0);
var view = TestUtils.GetNavigationView(MainWindowWrapper.Item, "navigationPane.navigationView");
TestUtils.ExecuteMethod(view, "HandleNodeRightClick", new object[] { e });
});
var menu = TestUtils.GetContextMenuStrip(MainWindowWrapper.Item, "navigationPane.navigationView.TreeContextMenu");
AssertToolStripItems(ixmoString, expectedItems, menu.Items, true);
// Close the menu again
MW(menu.Close);
Thread.Sleep(100);
}
示例5: ToolBar_Slave
public void ToolBar_Slave()
{
ExpectedMenuItem[] buttons = new ExpectedMenuItem[]{
new ExpectedSeparator(),
new ExpectedTextMenuItem("Add New Server", true ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("New Pool", true ),
new ExpectedTextMenuItem("New Storage", true ),
new ExpectedTextMenuItem("New VM", true ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Shut Down", true ),
new ExpectedTextMenuItem("Reboot", true ),
new ExpectedTextMenuItem("Suspend", false ),
};
VerifyToolbar(GetAnyHost(IsSlave), buttons);
}
示例6: ToolBar_Network
public void ToolBar_Network()
{
PutInOrgView(true);
try
{
ExpectedMenuItem[] buttons = new ExpectedMenuItem[]{
new ExpectedSeparator(),
new ExpectedTextMenuItem("Add New Server", true ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("New Pool", true ),
new ExpectedTextMenuItem("New Storage", false ),
new ExpectedTextMenuItem("New VM", false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Shut Down", false ),
new ExpectedTextMenuItem("Reboot", false ),
new ExpectedTextMenuItem("Suspend", false ),
};
foreach (XenAPI.Network network in GetAllXenObjects<XenAPI.Network>(n => n.name_label != "Guest installer network"))
{
VerifyToolbar(network, buttons);
}
}
finally
{
PutInOrgView(false);
}
}
示例7: MainMenu_SR
public void MainMenu_SR()
{
EnsureChecked(MainWindowWrapper.ViewMenuItems.LocalStorageToolStripMenuItem);
foreach (SR sr in GetAllXenObjects<SR>(s => !s.IsToolsSR))
{
ExpectedMenuItem[] poolToolStripMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&New Pool...", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Add Server", true, false, new ExpectedMenuItem[]{ new ExpectedTextMenuItem("(empty)", false), new ExpectedSeparator(), new ExpectedTextMenuItem("&Add New Server...", true)} ),
new ExpectedTextMenuItem("Re&move Server", false, false ),
new ExpectedTextMenuItem("Reconnec&t As...", true, false ),
new ExpectedTextMenuItem("Dis&connect", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Manage &vApps...", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&High Availability...", true, false ),
new ExpectedTextMenuItem("Di&saster Recovery", true, false, new ExpectedMenuItem[]{ new ExpectedTextMenuItem("&Configure...", true), new ExpectedTextMenuItem("&Disaster Recovery Wizard...", true)} ),
new ExpectedTextMenuItem("VM &Protection Policies...", true, false ),
new ExpectedTextMenuItem("E&xport Resource Data...", false, false ),
new ExpectedTextMenuItem("View Wor&kload Reports...", false, false ),
new ExpectedTextMenuItem("Disconnect Workload &Balancing Server", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Change Server Pass&word...", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Mak&e into standalone server", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("P&roperties", true, false )
};
ExpectedMenuItem[] HostMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&Add...", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Reb&oot", false, false ),
new ExpectedTextMenuItem("Power O&n", false, false ),
new ExpectedTextMenuItem("S&hut Down", false, false ),
new ExpectedTextMenuItem("Restart Toolstac&k", false, false),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Connect/Disconnect", true, false, new ExpectedMenuItem[]{new ExpectedTextMenuItem("&Connect", false),new ExpectedTextMenuItem("Dis&connect", false),new ExpectedTextMenuItem("Reconnec&t As...", false),new ExpectedSeparator(),new ExpectedTextMenuItem("C&onnect All", false), new ExpectedTextMenuItem("Di&sconnect All", true)} ),
new ExpectedTextMenuItem("Add to &Pool", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Back Up...", false, false ),
new ExpectedTextMenuItem("Restore From Back&up...", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Enter &Maintenance Mode...", sr.Home != null, false ),
new ExpectedTextMenuItem("Remove Crash &Dump Files", false, false ),
new ExpectedTextMenuItem("Pass&word", false, false, new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&Change...", false, false ),
new ExpectedTextMenuItem("&Forget Password", false, false )}),
new ExpectedSeparator(),
new ExpectedTextMenuItem("D&estroy", false, false ),
new ExpectedTextMenuItem("Remo&ve from " + Branding.BRAND_CONSOLE, false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("P&roperties", sr.Home != null, false )
};
ExpectedMenuItem[] VMToolStripMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&New VM...", true, false ),
new ExpectedTextMenuItem("&Start/Shut down", false, false, new ExpectedMenuItem[]{new ExpectedTextMenuItem("&Start", false),new ExpectedTextMenuItem("S&uspend", false),new ExpectedTextMenuItem("Reb&oot", false),new ExpectedTextMenuItem("Start in Reco&very Mode", false),new ExpectedSeparator(),new ExpectedTextMenuItem("Force Shut&down", false),new ExpectedTextMenuItem("Force Re&boot", false )}),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Assign to VM Protection Polic&y", false, false ),
new ExpectedTextMenuItem("Assign to vA&pp", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Copy VM...", false, false ),
new ExpectedTextMenuItem("&Move VM...", false, false ),
new ExpectedTextMenuItem("Ta&ke a Snapshot...", false, false ),
new ExpectedTextMenuItem("Convert to &Template...", false, false ),
new ExpectedTextMenuItem("&Export...", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Inst&all " + Branding.PRODUCT_BRAND + " Tools...", false, false ),
new ExpectedTextMenuItem("Send Ctrl+&Alt+Del", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Delete VM...", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("P&roperties", false, false )
};
ExpectedMenuItem[] StorageToolStripMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&New SR...", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Re&pair...", false, false ),
new ExpectedTextMenuItem("Set as Defaul&t", CanSetAsDefault(sr), false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Virtual Disks", true, false, new ExpectedMenuItem[]{new ExpectedTextMenuItem("New &Virtual Disk...", true),new ExpectedTextMenuItem("&Attach Virtual Disk...", false)} ),
// new ExpectedTextMenuItem("Storage&Link", false, false, new ExpectedMenuItem[]{new ExpectedTextMenuItem("&Change Server Password...", false),new ExpectedTextMenuItem("&Remove Servers...", false), new ExpectedSeparator(), new ExpectedTextMenuItem("&Add Storage System...", false), new ExpectedTextMenuItem("R&emove Storage System...", false), new ExpectedSeparator(), new ExpectedTextMenuItem("&Destroy Storage Volume...", false)} ),
new ExpectedTextMenuItem("Re&claim freed space", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Detach...", CanDetach(sr), false ),
new ExpectedTextMenuItem("R&eattach...", false, false ),
new ExpectedTextMenuItem("&Forget", CanForget(sr), false ),
new ExpectedTextMenuItem("Destr&oy...", CanDestroy(sr), false ),
new ExpectedTextMenuItem("&Convert SR...", CanConvertSR(sr), false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("P&roperties", true, false )
};
ExpectedMenuItem[] templatesToolStripMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("Create &VM From Selection", false, false, new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&New VM wizard...", false, false ),
new ExpectedTextMenuItem("&Quick Create", false, false )} ),
//.........这里部分代码省略.........
示例8: ToolBar_VMWithTools
public void ToolBar_VMWithTools()
{
ExpectedMenuItem[] buttons = new ExpectedMenuItem[]{
new ExpectedSeparator(),
new ExpectedTextMenuItem("Add New Server", true ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("New Pool", true ),
new ExpectedTextMenuItem("New Storage", true ),
new ExpectedTextMenuItem("New VM", true ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Shut Down", true ),
new ExpectedTextMenuItem("Reboot", true ),
new ExpectedTextMenuItem("Suspend", true ),
};
foreach (VM vm in GetAllXenObjects<VM>(HasTools))
{
VerifyToolbar(vm, buttons);
}
}
示例9: MainMenu_Snapshot
public void MainMenu_Snapshot()
{
PutInOrgView(OBJECT_VIEW);
try
{
foreach (VM snapshot in GetAllXenObjects<VM>(v => v.is_a_snapshot))
{
ExpectedMenuItem[] poolToolStripMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&New Pool...", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Add Server", false, false),
new ExpectedTextMenuItem("Re&move Server", false, false ),
new ExpectedTextMenuItem("Reconnec&t As...", false, false ),
new ExpectedTextMenuItem("Dis&connect", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Manage &vApps...", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&High Availability...", false, false ),
new ExpectedTextMenuItem("Di&saster Recovery", false, false ),
new ExpectedTextMenuItem("VM &Protection Policies...", false, false ),
new ExpectedTextMenuItem("View Wor&kload Reports...", false, false ),
new ExpectedTextMenuItem("Disconnect Workload &Balancing Server", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Change Server Pass&word...", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Delete Pool...", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("P&roperties", false, false )
};
ExpectedMenuItem[] HostMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&Add...", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Reb&oot", false, false ),
new ExpectedTextMenuItem("Power O&n", false, false ),
new ExpectedTextMenuItem("S&hut Down", false, false ),
new ExpectedTextMenuItem("Restart Toolstac&k", false, false),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Connect/Disconnect", true, false, new ExpectedMenuItem[]{new ExpectedTextMenuItem("&Connect", false),new ExpectedTextMenuItem("Dis&connect", false),new ExpectedTextMenuItem("Reconnec&t As...", false),new ExpectedSeparator(),new ExpectedTextMenuItem("C&onnect All", false), new ExpectedTextMenuItem("Di&sconnect All", true)} ),
new ExpectedTextMenuItem("Add to &Pool", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Back Up...", false, false ),
new ExpectedTextMenuItem("Restore From Back&up...", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Enter &Maintenance Mode...", false, false ),
new ExpectedTextMenuItem("Remove Crash &Dump Files", false, false ),
new ExpectedTextMenuItem("Pass&word", false, false, new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&Change...", false, false ),
new ExpectedTextMenuItem("&Forget", false, false )}),
new ExpectedSeparator(),
new ExpectedTextMenuItem("D&estroy", false, false ),
new ExpectedTextMenuItem("Remo&ve from XenCenter", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("P&roperties", false, false )
};
ExpectedMenuItem[] VMToolStripMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&New VM...", false, false ),
new ExpectedTextMenuItem("&Start/Shut down", false, false),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Assign to VM Protection Polic&y", false, false ),
new ExpectedTextMenuItem("Assign to vA&pp", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Copy VM...", false, false ),
new ExpectedTextMenuItem("&Move VM...", false, false ),
new ExpectedTextMenuItem("Ta&ke a Snapshot...", false, false ),
new ExpectedTextMenuItem("Convert to &Template...", false, false ),
new ExpectedTextMenuItem("&Export...", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Install &XenServer Tools...", false, false ),
new ExpectedTextMenuItem("Send Ctrl+&Alt+Del", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Delete VM...", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("P&roperties", false, false )
};
ExpectedMenuItem[] StorageToolStripMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&New SR...", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Re&pair...", false, false ),
new ExpectedTextMenuItem("Set as Defaul&t", false, false ),
new ExpectedTextMenuItem("&Share", false, false ),
new ExpectedTextMenuItem("&Upgrade", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Virtual Disks", false, false),
//new ExpectedTextMenuItem("Storage&Link", false, false, new ExpectedMenuItem[]{new ExpectedTextMenuItem("&Change Server Password...", false),new ExpectedTextMenuItem("&Remove Servers...", false), new ExpectedSeparator(), new ExpectedTextMenuItem("&Add Storage System...", false), new ExpectedTextMenuItem("R&emove Storage System...", false), new ExpectedSeparator(), new ExpectedTextMenuItem("&Destroy Storage Volume...", false)} ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Detach...", false, false ),
new ExpectedTextMenuItem("R&eattach...", false, false ),
new ExpectedTextMenuItem("&Forget", false, false ),
new ExpectedTextMenuItem("Destr&oy...", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("P&roperties", false, false )
};
ExpectedMenuItem[] templatesToolStripMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("Create &VM From Selection", false, false, new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&New VM wizard...", false, false ),
new ExpectedTextMenuItem("&Quick Create", false, false )} ),
//.........这里部分代码省略.........
示例10: AssertToolStripItems
private void AssertToolStripItems(string ixmoString, ExpectedMenuItem[] expectedItems, ToolStripItemCollection items, bool checkMnemonics)
{
List<ToolStripItem> itemsList = GetVisibleToolStripItems(items);
// some menu items take time before they become their final value.
MWWaitFor(() => ToolStripItemsEqual(expectedItems, itemsList));
Assert.AreEqual(expectedItems.Length, itemsList.Count,
string.Format("Wrong number of items in the menu for {0}: {1} != {2}", ixmoString, GetNames(expectedItems), GetNames(itemsList)));
List<char> usedMnemonics = new List<char>();
for (int i = 0; i < expectedItems.Length; ++i)
{
ToolStripItem item = itemsList[i];
if (expectedItems[i] is ExpectedSeparator)
{
Assert.IsTrue(item is ToolStripSeparator, "At position " + i + " for " + ixmoString + ", expected separator, found " + item.Text);
}
else
{
ToolStripMenuItem menuItem = item as ToolStripMenuItem;
ExpectedTextMenuItem expected = expectedItems[i] as ExpectedTextMenuItem;
Assert.AreEqual(expected.text, item.Text.TrimEnd(), "Wrong item at position " + i + " for " + ixmoString);
Assert.AreEqual(expected.enabled, item.Enabled, "Wrong enablement for item " + item.Text + " at position " + i + " for " + ixmoString);
if (checkMnemonics && item.Text.TrimEnd() != "(empty)" && !expected.skipMnemonicCheck)
{
char c = ExtractMnemonic(item.Text.TrimEnd());
if (usedMnemonics.Contains(c))
Assert.Fail(string.Format("Item '{0}' duplicates mnemnonic '{1}'", item.Text, c));
}
if (menuItem != null && menuItem.DropDownItems.Count > 0 && menuItem.Enabled)
{
MW(menuItem.ShowDropDown);
AssertToolStripItems(ixmoString, expected.DropDownItems, menuItem.DropDownItems, checkMnemonics);
}
if (expected.chcked.HasValue)
{
ToolStripButton buttonItem = item as ToolStripButton;
if (menuItem != null)
{
Assert.AreEqual(expected.chcked.Value, menuItem.Checked, "Wrong checked state for item " + item.Text + " at position " + i + " for " + ixmoString);
}
else if (buttonItem != null)
{
Assert.AreEqual(expected.chcked.Value, buttonItem.Checked, "Wrong checked state for item " + item.Text + " at position " + i + " for " + ixmoString);
}
}
}
}
}
示例11: ToolBar_UserTemplate
public void ToolBar_UserTemplate()
{
EnsureChecked(MainWindowWrapper.ViewMenuItems.TemplatesToolStripMenuItem);
ExpectedMenuItem[] buttons = new ExpectedMenuItem[]{
new ExpectedSeparator(),
new ExpectedTextMenuItem("Add New Server", true ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("New Pool", true ),
new ExpectedTextMenuItem("New Storage", true ),
new ExpectedTextMenuItem("New VM", true ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Shut Down", false ),
new ExpectedTextMenuItem("Reboot", false ),
new ExpectedTextMenuItem("Suspend", false ),
};
foreach (VM vm in GetAllXenObjects<VM>(v => v.is_a_template && !v.DefaultTemplate && !v.is_a_snapshot))
{
VerifyToolbar(vm, buttons);
}
}
示例12: VerifyToolbar
/// <summary>
/// Verifies the toolbar for the currently selected item.
/// </summary>
protected void VerifyToolbar(ExpectedMenuItem[] expectedItems)
{
List<ToolStripItem> items = new List<ToolStripItem>();
// skip out forward, back and system alert buttons
for (int i = 2; i < MainWindowWrapper.MainToolStrip.Items.Count - 1; i++)
{
items.Add(MainWindowWrapper.MainToolStrip.Items[i]);
}
AssertToolStripItems(MainWindowWrapper.TreeView.SelectedNode.Text, expectedItems, new ToolStripItemCollection(MainWindowWrapper.MainToolStrip, items.ToArray()), false);
}
示例13: ToolStripItemsEqual
private static bool ToolStripItemsEqual(ExpectedMenuItem[] expectedItems, List<ToolStripItem> itemsList)
{
if (expectedItems.Length != itemsList.Count)
{
return false;
}
for (int i = 0; i < expectedItems.Length; i++)
{
if (expectedItems[i] is ExpectedSeparator && itemsList[i] is ToolStripSeparator)
{
continue;
}
else if (expectedItems[i] is ExpectedSeparator && !(itemsList[i] is ToolStripSeparator))
{
return false;
}
else if (!(expectedItems[i] is ExpectedSeparator) && itemsList[i] is ToolStripSeparator)
{
return false;
}
else if (((ExpectedTextMenuItem)expectedItems[i]).text != itemsList[i].Text.TrimEnd())
{
return false;
}
}
return true;
}
示例14: VerifyMainMenu
protected void VerifyMainMenu(object ixmo, ExpectedMenuItem[] poolMenu, ExpectedMenuItem[] serverMenu, ExpectedMenuItem[] vmMenu, ExpectedMenuItem[] storageMenu, ExpectedMenuItem[] templatesMenu)
{
string ixmoString = (ixmo == null ? "XenCenter node" : ixmo.ToString());
// Select the ixmo in the tree
Assert.IsTrue(SelectInTree(ixmo), "Couldn't find a node for " + ixmoString + " in the tree");
Thread.Sleep(300);
MW(MainWindowWrapper.PoolMenu.Select);
MW(MainWindowWrapper.PoolMenu.ShowDropDown);
Thread.Sleep(100);
AssertToolStripItems(ixmoString, poolMenu, MainWindowWrapper.PoolMenu.DropDownItems, true);
MW(MainWindowWrapper.PoolMenu.HideDropDown);
MW(MainWindowWrapper.HostMenu.Select);
MW(MainWindowWrapper.HostMenu.ShowDropDown);
Thread.Sleep(100);
AssertToolStripItems(ixmoString, serverMenu, MainWindowWrapper.HostMenu.DropDownItems, true);
MW(MainWindowWrapper.HostMenu.HideDropDown);
MW(MainWindowWrapper.VMMenu.Select);
MW(MainWindowWrapper.VMMenu.ShowDropDown);
Thread.Sleep(100);
AssertToolStripItems(ixmoString, vmMenu, MainWindowWrapper.VMMenu.DropDownItems, true);
MW(MainWindowWrapper.VMMenu.HideDropDown);
MW(MainWindowWrapper.StorageMenu.Select);
MW(MainWindowWrapper.StorageMenu.ShowDropDown);
Thread.Sleep(100);
AssertToolStripItems(ixmoString, storageMenu, MainWindowWrapper.StorageMenu.DropDownItems, true);
MW(MainWindowWrapper.StorageMenu.HideDropDown);
MW(MainWindowWrapper.TemplatesMenu.Select);
MW(MainWindowWrapper.TemplatesMenu.ShowDropDown);
Thread.Sleep(100);
AssertToolStripItems(ixmoString, templatesMenu, MainWindowWrapper.TemplatesMenu.DropDownItems, true);
MW(MainWindowWrapper.TemplatesMenu.HideDropDown);
}
示例15: MainMenu_Pool
public void MainMenu_Pool()
{
ExpectedMenuItem[] poolToolStripMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&New Pool...", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Add Server", true, false, new ExpectedMenuItem[]{ new ExpectedTextMenuItem("&Add New Server...", true)} ),
new ExpectedTextMenuItem("Re&move Server", false, false ),
new ExpectedTextMenuItem("Reconnec&t As...", true, false ),
new ExpectedTextMenuItem("Dis&connect", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Manage &vApps...", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&High Availability...", true, false ),
new ExpectedTextMenuItem("Di&saster Recovery", true, false, new ExpectedMenuItem[]{ new ExpectedTextMenuItem("&Configure...", true), new ExpectedTextMenuItem("&Disaster Recovery Wizard...", true)}),
new ExpectedTextMenuItem("VM &Protection Policies...", true, false ),
new ExpectedTextMenuItem("E&xport Resource Data...", false, false ),
new ExpectedTextMenuItem("View Wor&kload Reports...", false, false ),
new ExpectedTextMenuItem("Disconnect Workload &Balancing Server", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Change Server Pass&word...", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Mak&e into standalone server", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("P&roperties", true, false )
};
ExpectedMenuItem[] HostMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&Add...", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Reb&oot", false, false ),
new ExpectedTextMenuItem("Power O&n", false, false ),
new ExpectedTextMenuItem("S&hut Down", false, false ),
new ExpectedTextMenuItem("Restart Toolstac&k", false, false),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Connect/Disconnect", true, false, new ExpectedMenuItem[]{new ExpectedTextMenuItem("&Connect", false),new ExpectedTextMenuItem("Dis&connect", false),new ExpectedTextMenuItem("Reconnec&t As...", false),new ExpectedSeparator(),new ExpectedTextMenuItem("C&onnect All", false), new ExpectedTextMenuItem("Di&sconnect All", true)} ),
new ExpectedTextMenuItem("Add to &Pool", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Back Up...", false, false ),
new ExpectedTextMenuItem("Restore From Back&up...", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Enter &Maintenance Mode...", false, false ),
new ExpectedTextMenuItem("Control &Domain Memory...", false, false ),
new ExpectedTextMenuItem("Remove Crash Dump &Files", false, false ),
new ExpectedTextMenuItem("Pass&word", true, false, new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&Change...", true, false ),
new ExpectedTextMenuItem("&Forget Password", false, false )}),
new ExpectedSeparator(),
new ExpectedTextMenuItem("D&estroy", false, false ),
new ExpectedTextMenuItem("Remo&ve from " + Branding.BRAND_CONSOLE, false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("P&roperties", false, false )
};
ExpectedMenuItem[] VMToolStripMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&New VM...", true, false ),
new ExpectedTextMenuItem("&Start/Shut down", false, false, new ExpectedMenuItem[]{new ExpectedTextMenuItem("&Start", false),new ExpectedTextMenuItem("S&uspend", false),new ExpectedTextMenuItem("Reb&oot", false),new ExpectedTextMenuItem("Start in Reco&very Mode", false),new ExpectedSeparator(),new ExpectedTextMenuItem("Force Shut&down", false),new ExpectedTextMenuItem("Force Re&boot", false )}),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Assign to VM Protection Polic&y", false, false ),
new ExpectedTextMenuItem("Assign to vA&pp", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Copy VM...", false, false ),
new ExpectedTextMenuItem("&Move VM...", false, false ),
new ExpectedTextMenuItem("Ta&ke a Snapshot...", false, false ),
new ExpectedTextMenuItem("Convert to &Template...", false, false ),
new ExpectedTextMenuItem("&Export...", true, false ),
new ExpectedTextMenuItem("Ena&ble PVS-Accelerator...", false, false ),
new ExpectedTextMenuItem("Disable P&VS-Accelerator", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Inst&all " + Branding.PRODUCT_BRAND + " Tools...", false, false ),
new ExpectedTextMenuItem("Send Ctrl+&Alt+Del", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Delete VM...", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("P&roperties", false, false )
};
ExpectedMenuItem[] StorageToolStripMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&New SR...", true, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("Re&pair...", false, false ),
new ExpectedTextMenuItem("Set as Defaul&t", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Virtual Disks", false, false, new ExpectedMenuItem[]{new ExpectedTextMenuItem("New &Virtual Disk...", false),new ExpectedTextMenuItem("&Attach Virtual Disk...", false)} ),
//new ExpectedTextMenuItem("Storage&Link", false, false, new ExpectedMenuItem[]{new ExpectedTextMenuItem("&Change Server Password...", false),new ExpectedTextMenuItem("&Remove Servers...", false), new ExpectedSeparator(), new ExpectedTextMenuItem("&Add Storage System...", false), new ExpectedTextMenuItem("R&emove Storage System...", false), new ExpectedSeparator(), new ExpectedTextMenuItem("&Destroy Storage Volume...", false)} ),
new ExpectedTextMenuItem("Re&claim freed space", false, false ),
new ExpectedSeparator(),
new ExpectedTextMenuItem("&Detach...", false, false ),
new ExpectedTextMenuItem("R&eattach...", false, false ),
new ExpectedTextMenuItem("&Forget", false, false ),
new ExpectedTextMenuItem("Destr&oy...", false, false ),
/* REMOVED THIN PROVISIONING new ExpectedTextMenuItem("&Convert SR...", false, false ), */
new ExpectedSeparator(),
new ExpectedTextMenuItem("P&roperties", false, false )
};
ExpectedMenuItem[] templatesToolStripMenuItem = new ExpectedMenuItem[]{
new ExpectedTextMenuItem("Create &VM From Selection", false, false, new ExpectedMenuItem[]{
new ExpectedTextMenuItem("&New VM wizard...", false, false ),
new ExpectedTextMenuItem("&Quick Create", false, false )} ),
new ExpectedSeparator(),
//.........这里部分代码省略.........