private void cmdTest_Click(object sender, EventArgs e)
        {
            try
            {
                SSHCommandCollectorConfigEntry testEntry = new SSHCommandCollectorConfigEntry()
                {
                    SSHConnection = sshConnectionDetails
                };
                testEntry.CommandString   = txtCommandText.Text;
                testEntry.ValueReturnType = (SSHCommandValueReturnType)cboReturnType.SelectedIndex;

                testEntry.ReturnCheckSequence    = (CollectorAgentReturnValueCheckSequence)cboReturnCheckSequence.SelectedIndex;
                testEntry.GoodResultMatchType    = (CollectorAgentReturnValueCompareMatchType)cboSuccessMatchType.SelectedIndex;
                testEntry.GoodValue              = txtSuccess.Text;
                testEntry.WarningResultMatchType = (CollectorAgentReturnValueCompareMatchType)cboWarningMatchType.SelectedIndex;
                testEntry.WarningValue           = txtWarning.Text;
                testEntry.ErrorResultMatchType   = (CollectorAgentReturnValueCompareMatchType)cboErrorMatchType.SelectedIndex;
                testEntry.ErrorValue             = txtError.Text;
                testEntry.OutputValueUnit        = cboOutputValueUnit.Text;

                string         value        = testEntry.ExecuteCommand();
                CollectorState currentState = CollectorAgentReturnValueCompareEngine.GetState(testEntry.ReturnCheckSequence,
                                                                                              testEntry.GoodResultMatchType, testEntry.GoodValue,
                                                                                              testEntry.WarningResultMatchType, testEntry.WarningValue,
                                                                                              testEntry.ErrorResultMatchType, testEntry.ErrorValue, value);

                MessageBox.Show(string.Format("Returned state: {0}\r\nOutput: {1}", currentState, value), "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
        private void cmdTest_Click(object sender, EventArgs e)
        {
            try
            {
                string commandText      = ApplyConfigVarsOnField(txtCommandText.Text);
                string successText      = ApplyConfigVarsOnField(txtSuccess.Text);
                string warningText      = ApplyConfigVarsOnField(txtWarning.Text);
                string errorText        = ApplyConfigVarsOnField(txtError.Text);
                string connectionString = ApplyConfigVarsOnField(sshConnectionDetails.ConnectionString);
                SSHConnectionDetails sshConnection;
                if (connectionString.Length > 0)
                {
                    sshConnection = SSHConnectionDetails.FromConnectionString(connectionString);
                }
                else
                {
                    sshConnection = sshConnectionDetails.Clone();
                    sshConnection.ComputerName   = ApplyConfigVarsOnField(sshConnection.ComputerName);
                    sshConnection.UserName       = ApplyConfigVarsOnField(sshConnection.UserName);
                    sshConnection.Password       = ApplyConfigVarsOnField(sshConnection.Password);
                    sshConnection.PrivateKeyFile = ApplyConfigVarsOnField(sshConnection.PrivateKeyFile);
                    sshConnection.PassPhrase     = ApplyConfigVarsOnField(sshConnection.PassPhrase);
                    sshConnection.ConnectionName = ApplyConfigVarsOnField(sshConnection.ConnectionName);
                }

                SSHCommandCollectorConfigEntry testEntry = new SSHCommandCollectorConfigEntry()
                {
                    SSHConnection = sshConnection
                };

                testEntry.CommandString          = commandText;
                testEntry.ValueReturnType        = (SSHCommandValueReturnType)cboReturnType.SelectedIndex;
                testEntry.ReturnCheckSequence    = (CollectorAgentReturnValueCheckSequence)cboReturnCheckSequence.SelectedIndex;
                testEntry.GoodResultMatchType    = (CollectorAgentReturnValueCompareMatchType)cboSuccessMatchType.SelectedIndex;
                testEntry.GoodValue              = successText;
                testEntry.WarningResultMatchType = (CollectorAgentReturnValueCompareMatchType)cboWarningMatchType.SelectedIndex;
                testEntry.WarningValue           = warningText;
                testEntry.ErrorResultMatchType   = (CollectorAgentReturnValueCompareMatchType)cboErrorMatchType.SelectedIndex;
                testEntry.ErrorValue             = errorText;
                testEntry.OutputValueUnit        = cboOutputValueUnit.Text;

                string         value        = testEntry.ExecuteCommand();
                CollectorState currentState = CollectorAgentReturnValueCompareEngine.GetState(testEntry.ReturnCheckSequence,
                                                                                              testEntry.GoodResultMatchType, testEntry.GoodValue,
                                                                                              testEntry.WarningResultMatchType, testEntry.WarningValue,
                                                                                              testEntry.ErrorResultMatchType, testEntry.ErrorValue, value);

                MessageBox.Show(string.Format("Returned state: {0}\r\nOutput: {1}", currentState, value), "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }