示例#1
0
        private void removedLinkButton_Click(object sender, EventArgs e)
        {
            if (testListDropdown.SelectedIndex > -1)
            {
                string currentlySelectedTest = testListDropdown.GetItemText(testListDropdown.SelectedItem);

                if (testNameAndBuildableDictionary.ContainsKey(currentlySelectedTest))
                {
                    DialogResult result = MessageBox.Show("Are you sure, you would like to detach"
                                                          + Environment.NewLine + $"'{currentlySelectedTest}' from" + Environment.NewLine
                                                          + $"'{testNameAndBuildableDictionary[ currentlySelectedTest ]}'?", "Remove linked buildable", MessageBoxButtons.YesNo);

                    if (result == DialogResult.Yes)
                    {
                        string buildablePathToRemove = testNameAndBuildableDictionary[currentlySelectedTest];
                        testNameAndBuildableDictionary.Remove(currentlySelectedTest);
                        LinkTestListBuildable serializationLinkBuildables = new LinkTestListBuildable(testNameAndBuildableDictionary);
                        serializationLinkBuildables.SerializeTestDictionary( );
                        testBuildableSuccessfulLinkedMessage.Text = $"Successfully removed" + Environment.NewLine + $"'{buildablePathToRemove}'"
                                                                    + Environment.NewLine + $"from '{currentlySelectedTest}' test";
                    }
                }
                else
                {
                    MessageBox.Show("You cannot remove link to a buildable, because that test doesn't contains one");
                }
            }
            else
            {
                MessageBox.Show("Please select a test first");
            }
        }
示例#2
0
        public LinkBuildableForm( )
        {
            testNameAndBuildableDictionary = new Dictionary <string, string>( );

            LinkTestListBuildable serializationLinkBuildables = new LinkTestListBuildable( );

            serializationLinkBuildables.DeserializeTestDictionary( );

            if (serializationLinkBuildables.testNameBuildableDictionary != null)
            {
                testNameAndBuildableDictionary = serializationLinkBuildables.testNameBuildableDictionary;
            }

            DataLoadHandlers loadDataHandler = new DataLoadHandlers( );
            ButtonControl    buttonControls  = new ButtonControl( );

            InitializeComponent( );

            selectBuildablePathButton.MouseEnter += buttonControls.controlButtons_MouseEnter;
            selectBuildablePathButton.MouseLeave += buttonControls.controlButtons_MouseLeave;
            saveBuildableLinkedButton.MouseEnter += buttonControls.controlButtons_MouseEnter;
            saveBuildableLinkedButton.MouseLeave += buttonControls.controlButtons_MouseLeave;

            testListDropdown.DrawItem += testListDropdown_DrawItem;

            testBuildableSuccessfulLinkedMessage.Text = string.Empty;

            loadDataHandler.LoadInTestListToDropdown(testListDropdown, TestRunnerGUI.testDictionary);
        }
示例#3
0
        private void saveBuildableLinkedButton_Click(object sender, EventArgs e)
        {
            string currentSelectedBuildablePath = pathToBuildableTextBox.Text;

            if (testListDropdown.SelectedIndex > -1 && !string.IsNullOrEmpty(currentSelectedBuildablePath))
            {
                string currentSelectedTestName = testListDropdown.GetItemText(testListDropdown.SelectedItem);

                DialogResult linkTestWithBuildable =
                    MessageBox.Show($"Are You sure, you want to link: '{currentSelectedTestName}'" +
                                    Environment.NewLine + $"with this test buildable: '{currentSelectedBuildablePath}'?",
                                    "Link Test with Buildable", MessageBoxButtons.OKCancel);

                if (linkTestWithBuildable == DialogResult.OK)
                {
                    DictionaryManipulators handleDictionary = new DictionaryManipulators( );

                    bool successfullyAddedToDictionary = handleDictionary.AddLinkedTestWithBuildableDictionary(
                        currentSelectedTestName, currentSelectedBuildablePath, testNameAndBuildableDictionary);

                    string message;

                    if (successfullyAddedToDictionary)
                    {
                        LinkTestListBuildable serializationLinkBuildables = new LinkTestListBuildable(testNameAndBuildableDictionary);

                        serializationLinkBuildables.SerializeTestDictionary( );

                        message = $"You are successfully linked '{currentSelectedTestName}' test with"
                                  + Environment.NewLine + currentSelectedBuildablePath + Environment.NewLine + "buildable.";
                    }
                    else
                    {
                        message = $"Something went wrong, when tried to link '{currentSelectedTestName}' test with"
                                  + Environment.NewLine + currentSelectedBuildablePath + Environment.NewLine +
                                  "buildable. Please try again, and if the issue still exist, contact TestSharp team.";
                    }

                    testBuildableSuccessfulLinkedMessage.Text = message;
                }

                testListDropdown.SelectedIndex = -1;
                pathToBuildableTextBox.Clear( );
            }
        }
示例#4
0
        private void removeDropdownButton_Click(object sender, EventArgs e)
        {
            if (testListDropdown.SelectedIndex > -1)
            {
                string selectedTest = testListDropdown.GetItemText(testListDropdown.SelectedItem);

                DialogResult popupResult = MessageBox.Show($"Are you sure, that you would like to remove '{selectedTest}' from the list?", "Remove test", MessageBoxButtons.YesNo);

                if (popupResult == DialogResult.Yes)
                {
                    TestRunnerGUI.testDictionary.Remove(selectedTest);

                    Dictionary <string, string> linkTestListBuildableDictionary = new Dictionary <string, string>( );

                    LinkTestListBuildable linkTestListBuildable = new LinkTestListBuildable( );

                    linkTestListBuildable.DeserializeTestDictionary( );

                    if (linkTestListBuildable.testNameBuildableDictionary != null)
                    {
                        linkTestListBuildableDictionary = linkTestListBuildable.testNameBuildableDictionary;
                    }

                    if (linkTestListBuildableDictionary.ContainsKey(selectedTest))
                    {
                        linkTestListBuildableDictionary.Remove(selectedTest);
                        linkTestListBuildable.testNameBuildableDictionary = linkTestListBuildableDictionary;
                        linkTestListBuildable.DeserializeTestDictionary( );
                    }

                    loadDataHandler.LoadInTestListToDropdown(testListDropdown, TestRunnerGUI.testDictionary);

                    testListDropdown.SelectedIndex = -1;

                    successfullRemovalLabel.Text = $"'{selectedTest}' successfully removed from the list!";
                }
            }
            else
            {
                MessageBox.Show("Please select the item from the dropdown, you would like to remove");
            }
        }
示例#5
0
        public TestRunnerGUI( )
        {
            loadDataHandler = new DataLoadHandlers( );
            ButtonControl buttonControls = new ButtonControl();
            FormControl   formControls   = new FormControl();

            InitializeComponent( );

            testSelectorDropdown.DrawItem += testSelectorDropdown_DrawItem;

            editDropdownButton.MouseEnter   += buttonControls.controlButtons_MouseEnter;
            editDropdownButton.MouseLeave   += buttonControls.controlButtons_MouseLeave;
            editRunOptionsButton.MouseEnter += buttonControls.controlButtons_MouseEnter;
            editRunOptionsButton.MouseLeave += buttonControls.controlButtons_MouseLeave;
            setCurrentTest.MouseEnter       += buttonControls.controlButtons_MouseEnter;
            setCurrentTest.MouseLeave       += buttonControls.controlButtons_MouseLeave;
            selectTestExecutableFromFileExplorer.MouseEnter += buttonControls.controlButtons_MouseEnter;
            selectTestExecutableFromFileExplorer.MouseLeave += buttonControls.controlButtons_MouseLeave;
            runTestButton.MouseEnter  += buttonControls.controlButtons_MouseEnter;
            runTestButton.MouseLeave  += buttonControls.controlButtons_MouseLeave;
            closeButton.MouseEnter    += buttonControls.controlButtons_MouseEnter;
            closeButton.MouseLeave    += buttonControls.controlButtons_MouseLeave;
            minimizeButton.MouseEnter += buttonControls.controlButtons_MouseEnter;
            minimizeButton.MouseLeave += buttonControls.controlButtons_MouseLeave;
            helpButton.MouseEnter     += buttonControls.controlButtons_MouseEnter;
            helpButton.MouseLeave     += buttonControls.controlButtons_MouseLeave;

            this.MouseDown += formControls.form_MouseDown;
            this.MouseMove += formControls.form_MouseMove;
            this.MouseUp   += formControls.form_MouseUp;

            testList = new TestList(testListNamePath);

            testList.DeserializeTestDictionary( );

            foreach (KeyValuePair <string, string> currentDictionaryItem in testList.testListNamePath)
            {
                testListNamePath.Add(currentDictionaryItem.Key, currentDictionaryItem.Value);
            }

            loadDataHandler.LoadInTestListToDropdown(testSelectorDropdown, testListNamePath);

            runOptions = new RunOptions( );

            runOptions.DeserializeRunOptions( );

            testRunnerRunOptionsDictionary = runOptions.runOptionsDictionary;

            runOptions.DeserializeRunOptionsBrowserList( );

            testRunnerBrowserList = runOptions.browserList;

            if (testRunnerBrowserList != null)
            {
                loadDataHandler.PopulateBrowserDropdowns(new List <ComboBox>( )
                {
                    runBrowserSelector
                }, testRunnerBrowserList);
            }

            if (testRunnerRunOptionsDictionary != null)
            {
                loadDataHandler.SetDefaultBrowser(runBrowserSelector, testRunnerRunOptionsDictionary);
                loadDataHandler.SetMaxAndDefaultValueForWorkerInput(workersNumberSetterInput, testRunnerRunOptionsDictionary);
            }

            LinkTestListBuildable linkTestListBuildable = new LinkTestListBuildable( );

            linkTestListBuildable.DeserializeTestDictionary( );

            testLinkedToBuildableDictionary = linkTestListBuildable.testNameBuildableDictionary;
        }