public void Test_populateComboBoxWithO2FindingsScriptLibrary()
        {
            string titleOfDefaultScript = "Default o2Findings Linq Script";
            var    scriptComboBox       = new ComboBox();

            OzasmtLinq.populateComboBoxWithO2FindingsLinqScriptLibraryTitles(scriptComboBox);
            Assert.That(scriptComboBox.Items.Count > 0, "There were no O2JavaScript loaded into scriptComboBox");
            string defaultScript = scriptComboBox.Items[0].ToString();

            Assert.That(defaultScript == titleOfDefaultScript,
                        "scriptComboBox.Items[0] should be '" + titleOfDefaultScript + "' and was " +
                        scriptComboBox.Items[0] + "  -");
            Assert.That(OzasmtLinq.getO2FindingLinqScript(defaultScript) != "",
                        "could not retrived the contents of defaultScript");
            Assert.That(OzasmtLinq.getO2FindingLinqScript("nothing here") == "",
                        "requesting for a non existent script should return an empty string");
        }
示例#2
0
 private void runNLinkQuery()
 {
     nLinqQueryResults.DataSource = null;
     if (loadedO2Findings.Count > 0)
     {
         try
         {
             var timer   = new O2Timer();
             var results =
                 (List <object>)O2NLinkQuery.runQuery(tbNLinqQuery.Text, "o2Findings", loadedO2Findings);
             tryToExtractO2FindingsFromResultsForOzasmtSave(results);
             if (results == null || results.Count == 0)
             {
                 DI.log.debug("Query result was null");
                 lbNLinqQuery_NumberOfResults.Text = "..";
             }
             else
             {
                 lbNLinqQuery_NumberOfResults.Text = results.Count.ToString();
                 if (results.Count > maxNumberOfNLinqQueryRecordsToShow)
                 {
                     lbNLinqQuery_NumberOfResults.ForeColor = Color.Red;
                     lbNLinqQuery_NumberOfResults.Text     += string.Format(" Results (only showing {0} findings)",
                                                                            maxNumberOfNLinqQueryRecordsToShow);
                 }
                 else
                 {
                     lbNLinqQuery_NumberOfResults.ForeColor = Color.Black;
                     lbNLinqQuery_NumberOfResults.Text     += " Results ";
                 }
                 nLinqQueryResults.DataSource = OzasmtLinq.getDataTableFromO2FindingsLinqQuery(results,
                                                                                               maxNumberOfNLinqQueryRecordsToShow,
                                                                                               ref
                                                                                               mappingOfDataRowsToObjects);
                 //finding => new [] {results});
             }
             lbNLinqQuery_ExecutionTime.Text = timer.stop().ToString();
         }
         catch (Exception ex)
         {
             DI.log.ex(ex, " in executeNLinkQuery");
         }
     }
 }
示例#3
0
        private void onLoad()
        {
            if (runOnLoad && DesignMode == false)
            {
                OzasmtLinq.populateComboBoxWithO2FindingsLinqScriptLibraryTitles(cbScriptLibrary);
                if (cbScriptLibrary.Items.Count > 0)
                {
                    cbScriptLibrary.SelectedIndex = 0;
                }

                /*if (scriptLibrary != null && scriptLibrary.Count > 0)
                 * {
                 *  cbScriptLibrary.Items.AddRange(scriptLibrary.ToArray());
                 *  cbScriptLibrary.SelectedIndex = 0;
                 * }*/
                setViewMode(false); // Simple mode
                hideTaskHostControl();
                checkIfQueryIsValid();
                updateMaxRecordsToShow();
                updateCountOfLoadedFindings();
                cbScriptLibrary.Focus();
                runOnLoad = false;
            }
        }
 private void cbScriptLibrary_SelectedIndexChanged(object sender, EventArgs e)
 {
     tbNLinqQuery.Text = OzasmtLinq.getO2FindingLinqScript(cbScriptLibrary.Text);
     runNLinkQuery();
 }