コード例 #1
0
ファイル: Form1.cs プロジェクト: gxstv/Vivo45-BoardTest
        private void runTestWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            //Run through all tests (disabled tests will immediately return)
            int numTests = Enum.GetNames(typeof(TestNames)).Length;

            for (int i = 0; i < numTests; i++)
            {
                runTestWorker.ReportProgress(i);
                testSuite.RunTest(i);
                if (testSuite.getResultList().Count > 0)
                {
                    TestRes.Invoke(new MethodInvoker(delegate
                    {
                        TestName.Text = testSuite.getResultList().Last().getName();
                        TestRes.Text  = testSuite.getResultList().Last().getStatus();
                    }));
                }

                //Stop running tests if user cancels
                if (runTestWorker.CancellationPending)
                {
                    e.Cancel = true;
                    runTestWorker.ReportProgress(-1);
                    return;
                }
            }
        }