Beispiel #1
0
        private void runTestsToolStripMenuItem_Click(object sender, EventArgs eventArgs)
        {
            FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();

            if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                folderBrowserDialog.Dispose();
                string     path       = Path.Combine(folderBrowserDialog.SelectedPath, "EditSF_test.txt");
                FileTester fileTester = new FileTester();
                using (TextWriter textWriter = File.CreateText(path))
                {
                    foreach (string item in Directory.EnumerateFiles(folderBrowserDialog.SelectedPath))
                    {
                        if (!item.EndsWith("EditSF_test.txt"))
                        {
                            string value = fileTester.RunTest(item, _progressBar, _statusLabel);
                            textWriter.WriteLine(value);
                            textWriter.Flush();
                        }
                    }
                }

                MessageBox.Show($"Test successes {fileTester.TestSuccesses}/{fileTester.TestsRun}", "Tests finished");
            }
        }
        private void runTestsToolStripMenuItem_Click(object sender, EventArgs eventArgs)
        {
            FolderBrowserDialog dialog = new FolderBrowserDialog();

            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                dialog.Dispose();
                string     logFileName = Path.Combine(dialog.SelectedPath, "EditSF_test.txt");
                FileTester tester      = new FileTester();
                using (TextWriter logWriter = File.CreateText(logFileName)) {
                    foreach (string file in Directory.EnumerateFiles(dialog.SelectedPath))
                    {
                        if (file.EndsWith("EditSF_test.txt"))
                        {
                            continue;
                        }
                        string testResult = tester.RunTest(file, progressBar, statusLabel);
                        logWriter.WriteLine(testResult);
                        logWriter.Flush();
                    }
                }
                MessageBox.Show(string.Format("Test successes {0}/{1}", tester.TestSuccesses, tester.TestsRun),
                                "Tests finished");
            }
        }