protected override ActionRecord StartRecordCore()
 {
     CurrentRecord = new TestRecord(m_host.Numbers);
     return CurrentRecord;
 }
 protected override void CutRecordCore()
 {
     CurrentRecord = null;
 }
 protected override void EndRecordCore()
 {
     CurrentRecord.End();
     CurrentRecord = null;
 }
Пример #4
0
        private void GenTest_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (int.TryParse(TestCountTB.Text, out testCount))
                {
                    testRec = new TestRecord[testCount, collection.Count];
                    Random rnd = new Random();

                    for (int w = 0; w < testCount; w++)
                    {
                        if (shownThisRun) return;
                        StreamWriter outp = new StreamWriter(exportPath + "\\" + testFileName.Substring(0, testFileName.IndexOf('$')) + Convert.ToString(w) + testFileName.Substring(testFileName.IndexOf('$') + 1));
                        for (int q = 0; q < collection.Count; q++)
                        {
                            int sizeX = 0, sizeY = 0;
                            int minVal = GetValFrom(collection[q].minValue, w), maxVal = GetValFrom(collection[q].maxValue, w) + 1;
                            if (collection[q].type == "single")
                            {
                                sizeX = 1;
                                sizeY = 1;
                            }
                            else if (collection[q].type == "array")
                            {
                                sizeX = GetValFrom(collection[q].sizeX, w);
                                sizeY = 1;
                            }
                            else if (collection[q].type == "chart")
                            {
                                sizeX = GetValFrom(collection[q].sizeX, w);
                                sizeY = GetValFrom(collection[q].sizeY, w);
                            }
                            testRec[w, q] = new TestRecord();
                            testRec[w, q].num = new int[sizeY, sizeX];
                            testRec[w, q].str = new string[sizeY, sizeX];
                            for (int y = 0; y < sizeY; y++)
                            {
                                if (shownThisRun) return;
                                for (int x = 0; x < sizeX; x++)
                                {
                                    if (shownThisRun) return;
                                    if (collection[q].dataType == "integer")
                                    {
                                        testRec[w, q].num[y, x] = rnd.Next(minVal, maxVal);
                                        outp.Write(testRec[w, q].num[y, x] + " ");
                                    }
                                    else if (collection[q].dataType == "string")
                                    {
                                        string str = "";
                                        for (int z = 0; z < GetValFrom(collection[q].length, w); z++)
                                        {
                                            str += collection[q].chars[rnd.Next(0, collection[q].chars.Length)];
                                        }
                                        testRec[w, q].str[y, x] = str;
                                        outp.Write(testRec[w, q].str[y, x] + " ");
                                    }
                                }
                                outp.WriteLine();
                            }
                            outp.Flush();
                        }
                        outp.Close();
                    }
                }
            }
            catch (Exception exc)
            {
                ShowExceptionMessage();
            }
            shownThisRun = false;
        }