Example #1
0
        private void failedAssumptionsMenuItem_Click(object sender, System.EventArgs e)
        {
            TestSuiteTreeNode targetNode = explicitlySelectedNode != null ? explicitlySelectedNode : (TestSuiteTreeNode)SelectedNode;
            TestSuiteTreeNode theoryNode = targetNode != null?targetNode.GetTheoryNode() : null;

            if (theoryNode != null)
            {
                MenuItem item = (MenuItem)sender;

                BeginUpdate();
                item.Checked = !item.Checked;
                theoryNode.ShowFailedAssumptions = item.Checked;
                EndUpdate();
            }
        }
Example #2
0
        /// <summary>
        /// Build treeview context menu dynamically on popup
        /// </summary>
        private void ContextMenu_Popup(object sender, System.EventArgs e)
        {
            this.ContextMenu.MenuItems.Clear();

            TestSuiteTreeNode targetNode = explicitlySelectedNode != null ? explicitlySelectedNode : (TestSuiteTreeNode)SelectedNode;

            if (targetNode == null)
            {
                return;
            }

            if (RunCommandSupported)
            {
                // TODO: handle in Starting event
                if (loader.Running)
                {
                    runCommandEnabled = false;
                }

                MenuItem runMenuItem = new MenuItem("&Run", new EventHandler(runMenuItem_Click));
                runMenuItem.DefaultItem = runMenuItem.Enabled = runCommandEnabled && targetNode.Included &&
                                                                (targetNode.Test.RunState == RunState.Runnable || targetNode.Test.RunState == RunState.Explicit);

                this.ContextMenu.MenuItems.Add(runMenuItem);

                this.ContextMenu.MenuItems.Add("-");
            }

            TestSuiteTreeNode theoryNode = targetNode.GetTheoryNode();

            if (theoryNode != null)
            {
                MenuItem failedAssumptionsMenuItem = new MenuItem("Show Failed Assumptions", new EventHandler(failedAssumptionsMenuItem_Click));
                failedAssumptionsMenuItem.Checked = theoryNode.ShowFailedAssumptions;
                this.ContextMenu.MenuItems.Add(failedAssumptionsMenuItem);

                this.ContextMenu.MenuItems.Add("-");
            }


            MenuItem showCheckBoxesMenuItem = new MenuItem("Show CheckBoxes", new EventHandler(showCheckBoxesMenuItem_Click));

            showCheckBoxesMenuItem.Checked = this.CheckBoxes;
            this.ContextMenu.MenuItems.Add(showCheckBoxesMenuItem);
            this.ContextMenu.MenuItems.Add("-");

            MenuItem loadFixtureMenuItem = new MenuItem("Load Fixture", new EventHandler(loadFixtureMenuItem_Click));

            loadFixtureMenuItem.Enabled = targetNode.Test.IsSuite && targetNode != Nodes[0];
            this.ContextMenu.MenuItems.Add(loadFixtureMenuItem);

            MenuItem clearFixtureMenuItem = new MenuItem("Clear Fixture", new EventHandler(clearFixtureMenuItem_Click));

            clearFixtureMenuItem.Enabled = fixtureLoaded;
            this.ContextMenu.MenuItems.Add(clearFixtureMenuItem);
            this.ContextMenu.MenuItems.Add("-");

            MenuItem propertiesMenuItem = new MenuItem(
                "&Properties", new EventHandler(propertiesMenuItem_Click));

            this.ContextMenu.MenuItems.Add(propertiesMenuItem);
        }