/// <summary> /// Build an array containing the list of records from the <c>TESTMESSAGES</c> table of the data dictionary for each unique test number. The array element /// is mapped to the <c>TESTID</c> field of the table. Note: Although the field is called <c>TESTID</c> in the data dictionary, the values correspond to /// the test number rather than test identifier. /// </summary> /// <param name="testMessagedDataTable">Reference to the <c>TESTMESSAGES</c> table of the data dictionary.</param> /// <returns>An array containing the list of records from the <c>TESTMESSAGES</c> table of the data dictionary for each unique test number, if the parameters /// are valid; otherwise, null.</returns> private List <TestMessage_t>[] BuildTestMessageLists(DataDictionary.TESTMESSAGESDataTable testMessagedDataTable) { // Local copy of the data table. List <TestMessage_t>[] records; if (testMessagedDataTable == null) { return(null); } try { // Determine the maximum value of the TESTID field in the data table, it cannot be assumed that the table is sorted by TESTID. int iDMax = 0; int iDCurrent = 0; for (int recordIndex = 0; recordIndex < testMessagedDataTable.Count; recordIndex++) { iDCurrent = testMessagedDataTable[recordIndex].TESTID; if (iDCurrent > iDMax) { iDMax = iDCurrent; } } // Instantiate the lookup array. records = new List <TestMessage_t> [iDMax + 1]; // Instantiate a generic list for each array element. for (int recordIndex = 0; recordIndex < iDMax + 1; recordIndex++) { records[recordIndex] = new List <TestMessage_t>(); } // Populate the lookup table; int identifier; DataDictionary.TESTMESSAGESRow row; for (int recordIndex = 0; recordIndex < testMessagedDataTable.Count; recordIndex++) { row = testMessagedDataTable[recordIndex]; identifier = row.TESTID; // Instantiate a new structure to contain the variable data and copy the data across. TestMessage_t record = new TestMessage_t(); record.TestCase = row.TESTCASE; record.TestNumber = row.TESTID; record.HelpIndex = row.HELPINDEX; // Add the record to the correct element of the array. records[identifier].Add(record); } } catch (Exception) { return(null); } return(records); }
/// <summary> /// Initialize a new instance of the class. /// </summary> /// <param name="dataTable">>Reference to the <c>SELFTEST</c> table of the data dictionary. This table contains the self test definitions.</param> /// <param name="selfTestIdentifiersDataTable">Reference to the <c>SELFTESTIDS</c> table of the data dictionary. This table defines which self test /// variables are associated with each self test.</param> /// <param name="testMessagesDataTable">Reference to the <c>TESTMESSAGES</c> table of the data dictionary. This table defines the help index of the /// test messages associated with the test case value for each test number.</param> public SelfTestTable(DataDictionary.SELFTESTDataTable dataTable, DataDictionary.SELFTESTIDSDataTable selfTestIdentifiersDataTable, DataDictionary.TESTMESSAGESDataTable testMessagesDataTable) : base(dataTable) { if (selfTestIdentifiersDataTable == null) { return; } m_SelfTestDataTable = dataTable; m_SelfTestIdentifierLists = BuildSelfTestIdentifierLists(selfTestIdentifiersDataTable); AddSelfTestVariableLists(); m_TestMessageLists = BuildTestMessageLists(testMessagesDataTable); }
/// <summary> /// Initialize a new instance of the class. /// </summary> /// <param name="dataTable">>Reference to the <c>SELFTEST</c> table of the data dictionary. This table contains the self test definitions.</param> /// <param name="selfTestIdentifiersDataTable">Reference to the <c>SELFTESTIDS</c> table of the data dictionary. This table defines which self test /// variables are associated with each self test.</param> /// <param name="testMessagesDataTable">Reference to the <c>TESTMESSAGES</c> table of the data dictionary. This table defines the help index of the /// test messages associated with the test case value for each test number.</param> public SelfTestTableBySelfTestNumber(DataDictionary.SELFTESTDataTable dataTable, DataDictionary.SELFTESTIDSDataTable selfTestIdentifiersDataTable, DataDictionary.TESTMESSAGESDataTable testMessagesDataTable) : base(dataTable, selfTestIdentifiersDataTable, testMessagesDataTable) { }