Exemplo n.º 1
0
        public void ContextMenu_XenCenterNode_PoolOpen()
        {
            VirtualTreeNode rootNode = FindInTree(null);

            MW(delegate
            {
                rootNode.Collapse();
                rootNode.Expand();
            });
            VirtualTreeNode poolNode = FindInTree(GetAnyPool());

            MW(delegate
            {
                poolNode.Expand();
            });

            VerifyContextMenu(null, new ExpectedMenuItem[] {
                new ExpectedTextMenuItem("&Add...", true),
                new ExpectedTextMenuItem("&New Pool...", true),
                new ExpectedTextMenuItem("C&onnect All", false),
                new ExpectedTextMenuItem("Di&sconnect All", true),
                new ExpectedTextMenuItem("E&xpand All", true),
                new ExpectedTextMenuItem("&Collapse Children", true)
            });
        }
Exemplo n.º 2
0
        public void TestPersistenceBetweenServerAndOrgView()
        {
            PutInNavigationMode(NavigationPane.NavigationMode.Infrastructure);
            ClearTreeSelections();

            // collapse all nodes in server view.
            MW(MainWindowWrapper.TreeView.CollapseAll);

            // wait for all nodes to become collapsed.
            CheckExpandedNodes(n => false, "Couldn't collapse all nodes.");

            // expand root node and pool node.
            MW(() =>
            {
                VirtualTreeNode poolNode = MainWindowWrapper.TreeView.Nodes[0].Nodes[0];
                Assert.AreEqual("Hottub", poolNode.Text);
                MainWindowWrapper.TreeView.Nodes[0].Expand();
                poolNode.Expand();
            });

            // wait for those nodes to become expanded
            CheckExpandedNodes(n => n == MainWindowWrapper.TreeView.Nodes[0].Nodes[0] || n.Tag == null, "Could expand nodes.");

            // expand host nodes in server view.
            MW(() =>
            {
                VirtualTreeNode poolNode = MainWindowWrapper.TreeView.Nodes[0].Nodes[0];
                poolNode.Nodes[0].Expand();
                poolNode.Nodes[1].Expand();
            });

            // check hosts nodes got expanded.
            CheckExpandedNodes(n =>
            {
                VirtualTreeNode poolNode = MainWindowWrapper.TreeView.Nodes[0].Nodes[0];
                return(n.Tag == null || n == poolNode || n == poolNode.Nodes[0] || n == poolNode.Nodes[1]);
            }, "Couldn't expand host nodes.");

            // now go into objects view.
            PutInNavigationMode(NavigationPane.NavigationMode.Objects);

            // collapse all nodes
            MW(MainWindowWrapper.TreeView.CollapseAll);

            // wait for all nodes to become collapsed.
            CheckExpandedNodes(n => false, "Couldn't collapse all nodes.");

            // expand root node and snapshots nodes in folder view.
            MW(() =>
            {
                MainWindowWrapper.TreeView.Nodes[0].Expand();
                MainWindowWrapper.TreeView.Nodes[0].Nodes[3].Expand();
                VirtualTreeNode typesNode = MainWindowWrapper.TreeView.Nodes[0].Nodes[3];
                Assert.AreEqual("Snapshots", typesNode.Text);
                typesNode.Expand();
            });

            // wait for those nodes to become expanded.
            CheckExpandedNodes(n => n == MainWindowWrapper.TreeView.Nodes[0] ||
                               n == MainWindowWrapper.TreeView.Nodes[0].Nodes[3], "Couldn't expand nodes.");

            PutInNavigationMode(NavigationPane.NavigationMode.Infrastructure);

            if (!CheckExpandedNodes(n => n.Tag == null || n.Tag is Pool || n.Tag is Host))
            {
                var expandedNodes = MW(() => GetAllTreeNodes().FindAll(n => n.IsExpanded).ConvertAll(n => n.Text));
                Assert.Fail("Nodes not correctly persisted in infrastructure view. Expanded nodes were: " + string.Join(", ", expandedNodes.ToArray()) + ". They should have only been XenCenter, Hottub, inflames, incubus.");
            }

            PutInNavigationMode(NavigationPane.NavigationMode.Objects);

            if (!CheckExpandedNodes(n => n.Parent == null || n.Text == "Objects by Type" || n.Text == "Snapshots"))
            {
                var expandedNodes = MW(() => GetAllTreeNodes().FindAll(n => n.IsExpanded).ConvertAll(n => n.Text));
                Assert.Fail("Nodes not correctly persisted in organization view. Expanded nodes were: " + string.Join(", ", expandedNodes.ToArray()) + ". They should have only been Objects, Types.");
            }
        }