public void TestRbacGeorge() { foreach (Pool pool in RunTest(GetAnyPool)) { MW(delegate { Command.Execute(); AddServerDialogWrapper addServerDialogWrapper = new AddServerDialogWrapper(WaitForWindowToAppear("Add New Server")); Thread.Sleep(500); Assert.IsNotNull(addServerDialogWrapper, "AddServerDialogWrapper was null"); Assert.IsNotNull(addServerDialogWrapper.ServerNameComboBox, "ServerNameComboBox was null"); Assert.IsNotNull(addServerDialogWrapper.AddButton, "AddButton was null"); addServerDialogWrapper.ServerNameComboBox.Text = GetTestResource(CommandTestsDatabase.SingleHost); addServerDialogWrapper.AddButton.PerformClick(); }); Func<bool> finished = delegate { VirtualTreeView.VirtualTreeNodeCollection poolNodes = MainWindowWrapper.TreeView.Nodes[0].Nodes[0].Nodes; return poolNodes.Count > 2 && poolNodes[0].Text == "inflames" && poolNodes[1].Text == "incubus" && poolNodes[2].Text == "krakout"; }; // wait until command finished. MWWaitFor(finished, "AddNewHostToPoolCommandTest.TestRbacGeorge() didn't finish."); } }
public void TestRbacGeorge() { foreach (Pool pool in RunTest(GetAnyPool)) { MW(delegate { Command.Execute(); AddServerDialogWrapper addServerDialogWrapper = new AddServerDialogWrapper(WaitForWindowToAppear("Add New Server")); Thread.Sleep(500); Assert.IsNotNull(addServerDialogWrapper, "AddServerDialogWrapper was null"); Assert.IsNotNull(addServerDialogWrapper.ServerNameComboBox, "ServerNameComboBox was null"); Assert.IsNotNull(addServerDialogWrapper.AddButton, "AddButton was null"); addServerDialogWrapper.ServerNameComboBox.Text = GetTestResource(CommandTestsDatabase.SingleHost); addServerDialogWrapper.AddButton.PerformClick(); }); Func <bool> finished = delegate { VirtualTreeView.VirtualTreeNodeCollection poolNodes = MainWindowWrapper.TreeView.Nodes[0].Nodes[0].Nodes; return(poolNodes.Count > 2 && poolNodes[0].Text == "inflames" && poolNodes[1].Text == "incubus" && poolNodes[2].Text == "krakout"); }; // wait until command finished. MWWaitFor(finished, "AddNewHostToPoolCommandTest.TestRbacGeorge() didn't finish."); } }
public void Test() { foreach (SelectedItemCollection selection in RunTest(() => (IXenObject)null)) { MW(delegate { Command.Execute(); AddServerDialogWrapper addServerDialogWrapper = new AddServerDialogWrapper(WaitForWindowToAppear("Add New Server")); Thread.Sleep(500); Assert.IsNotNull(addServerDialogWrapper, "AddServerDialogWrapper was null"); Assert.IsNotNull(addServerDialogWrapper.ServerNameComboBox, "ServerNameComboBox was null"); Assert.IsNotNull(addServerDialogWrapper.AddButton, "AddButton was null"); addServerDialogWrapper.ServerNameComboBox.Text = GetTestResource(CommandTestsDatabase.SingleHost); Thread.Sleep(200); addServerDialogWrapper.AddButton.PerformClick(); Thread.Sleep(200); }); Func <bool> finished = delegate { Assert.IsNotNull(MainWindowWrapper.TreeView, "Tree view is null"); Assert.IsNotNull(MainWindowWrapper.TreeView.Nodes, "Tree view nodes are null"); bool nodeCount = MainWindowWrapper.TreeView.Nodes.Count > 0; bool subnodeCount = MainWindowWrapper.TreeView.Nodes[0].Nodes.Count > 1; return(nodeCount & subnodeCount); }; bool treeHasNodes = MWWaitFor(finished); Thread.Sleep(1000); MW(delegate { Assert.IsTrue(treeHasNodes, "Waiting for tree to have nodes has failed"); Assert.IsNotNull(MainWindowWrapper.TreeView.Nodes[0], "Node 0 is null"); Assert.IsNotNull(MainWindowWrapper.TreeView.Nodes[0].Nodes[1], "Subnode 1 is null"); //Test name is correct string subnodeOneText = MainWindowWrapper.TreeView.Nodes[0].Nodes[1].Text; Assert.IsNotNullOrEmpty(subnodeOneText, "Subnode 1's text is null or empty: The host may not have been added"); Assert.AreEqual("krakout", subnodeOneText, "Subnode1's text containing the host name was incorrect"); //Test the node is expanded bool subnodeOneIsExpanded = MainWindowWrapper.TreeView.Nodes[0].Nodes[1].IsExpanded; Assert.IsTrue(subnodeOneIsExpanded, "Subnode 1 wasn't expanded."); }); } }
public void Test() { foreach (SelectedItemCollection selection in RunTest(() => (IXenObject)null)) { MW(delegate { Command.Execute(); AddServerDialogWrapper addServerDialogWrapper = new AddServerDialogWrapper(WaitForWindowToAppear("Add New Server")); Thread.Sleep(500); Assert.IsNotNull(addServerDialogWrapper, "AddServerDialogWrapper was null"); Assert.IsNotNull(addServerDialogWrapper.ServerNameComboBox, "ServerNameComboBox was null"); Assert.IsNotNull(addServerDialogWrapper.AddButton, "AddButton was null"); addServerDialogWrapper.ServerNameComboBox.Text = GetTestResource(CommandTestsDatabase.SingleHost); Thread.Sleep(200); addServerDialogWrapper.AddButton.PerformClick(); Thread.Sleep(200); }); Func<bool> finished = delegate { Assert.IsNotNull(MainWindowWrapper.TreeView, "Tree view is null"); Assert.IsNotNull(MainWindowWrapper.TreeView.Nodes, "Tree view nodes are null"); bool nodeCount = MainWindowWrapper.TreeView.Nodes.Count > 0; bool subnodeCount = MainWindowWrapper.TreeView.Nodes[0].Nodes.Count > 1; return nodeCount & subnodeCount; }; bool treeHasNodes = MWWaitFor(finished); Thread.Sleep(1000); MW(delegate { Assert.IsTrue(treeHasNodes, "Waiting for tree to have nodes has failed"); Assert.IsNotNull(MainWindowWrapper.TreeView.Nodes[0], "Node 0 is null"); Assert.IsNotNull(MainWindowWrapper.TreeView.Nodes[0].Nodes[1], "Subnode 1 is null"); //Test name is correct string subnodeOneText = MainWindowWrapper.TreeView.Nodes[0].Nodes[1].Text; Assert.IsNotNullOrEmpty(subnodeOneText, "Subnode 1's text is null or empty: The host may not have been added"); Assert.AreEqual("krakout", subnodeOneText, "Subnode1's text containing the host name was incorrect"); //Test the node is expanded bool subnodeOneIsExpanded = MainWindowWrapper.TreeView.Nodes[0].Nodes[1].IsExpanded; Assert.IsTrue(subnodeOneIsExpanded, "Subnode 1 wasn't expanded."); }); } }