示例#1
0
        private void button_beginTest_Click(object sender, EventArgs e)
        {
            if (this.comboBox_allTests.SelectedIndex >= 0)
            {
                if (this.tests.AllTests[this.selectedTestName] == true)
                {
                    string filePath = string.Empty;
                    using (OpenFileDialog openFileDialog = new OpenFileDialog())
                    {
                        openFileDialog.ShowDialog();
                        filePath = openFileDialog.FileName;
                    }

                    if (filePath != string.Empty)
                    {
                        if (this.comboBox_allTests.SelectedIndex == 0)
                        {
                            HATestUnit hATestUnit = new HATestUnit();
                            if (!XmlManager.Load <HATestUnit>(filePath, out hATestUnit))
                            {
                                filePath = string.Empty;
                            }
                            else
                            {
                                this.button_beginTest.Enabled = false;
                                this.tests.Begin(this.comboBox_allTests.SelectedIndex, this.listBox_testLogs, hATestUnit);
                            }
                        }
                        else if (this.comboBox_allTests.SelectedIndex == 1)
                        {
                            LagrangeInterpolationTestUnit liTestUnit = new LagrangeInterpolationTestUnit();
                            if (!XmlManager.Load <LagrangeInterpolationTestUnit>(filePath, out liTestUnit))
                            {
                                filePath = string.Empty;
                            }
                            else
                            {
                                this.button_beginTest.Enabled = false;
                                this.tests.Begin(this.comboBox_allTests.SelectedIndex, this.listBox_testLogs, liTestUnit);
                            }
                        }
                    }
                }
                else
                {
                    this.tests.Begin(this.comboBox_allTests.SelectedIndex, this.listBox_testLogs);
                }
            }
        }
示例#2
0
        private void BeginLagrangeInterpolationTest(LagrangeInterpolationTestUnit liTestUnit, ListBox logsBox)
        {
            LagrangeInterpolation lagrangeInterpolation = new LagrangeInterpolation();

            for (int i = 0; i < liTestUnit.FileToTest.Count; i++)
            {
                try
                {
                    if (!lagrangeInterpolation.LoadFile(liTestUnit.FileToTest[i].Path, liTestUnit.FileToTest[i].FileType))
                    {
                        logsBox.Items.Add("Error, File Load Fail");
                    }
                    else
                    {
                        logsBox.Items.Add("File Was Loaded");
                    }

                    if (!lagrangeInterpolation.GenerateFunctionExpression())
                    {
                        logsBox.Items.Add("Error, Function Fail");
                    }
                    else
                    {
                        logsBox.Items.Add("Function Pass:"******"Error");
                    }
                }
            }
        }