コード例 #1
0
        static void runInConsole()
        {
            CaseRunner r = new CaseRunner();

            Console.WriteLine("running in console");
            r.runWithoutFile();
        }
コード例 #2
0
        static void runAllTests(string root)
        {
            if (!Directory.Exists(root))
            {
                Console.WriteLine("does not exist");
                Directory.CreateDirectory(root);
                createSubDirectory(root, "tests");
                createSubDirectory(root, "results");
                return;
            }

            if (!doesSubFolderExist(root, "results"))
            {
                createSubDirectory(root, "results");
            }
            if (!doesSubFolderExist(root, "tests"))
            {
                createSubDirectory(root, "tests");
                Console.WriteLine("test directory created, please populate it with tests: " + root + "\\tests");
                return;
            }

            string tests   = root + "\\tests";
            string results = root + "\\results";

            string[] files = Directory.GetFiles(tests);
            string[,] testList = new string[files.Length, 2];
            int x = 0;

            foreach (string s in files)
            {
                Console.WriteLine(s);
                string str = getNameFile(s);
                if (!doesSubFolderExist(results, str))
                {
                    Console.WriteLine("path does not exist");
                    createSubDirectory(results, str);
                }
                testList[x, 0] = s;
                testList[x, 1] = results + "\\" + str;
                //Console.WriteLine(str);
                x++;
            }

            for (int y = 0; y < testList.GetLength(0); y++)
            {
                CaseRunner r = new CaseRunner();
                Console.WriteLine(testList[y, 0] + " : " + testList[y, 1] + "\\" + DateTime.Now.ToString() + ".TXT");
                string output = DateTime.Now.ToString() + ".TXT";
                Console.WriteLine("proper output path: " + testList[y, 1] + "\\" + string.Join("_", output.Split(Path.GetInvalidFileNameChars())));
                r.runFromFile(testList[y, 0], testList[y, 1] + "\\" + string.Join("_", output.Split(Path.GetInvalidFileNameChars())));
            }
        }
コード例 #3
0
        static void runOneTest(string test, string output)
        {
            CaseRunner r = new CaseRunner();

            Console.WriteLine("test file : " + test + " exists: " + File.Exists(test));
            Console.WriteLine("output file : " + output + " exists: " + File.Exists(output));
            if (!File.Exists(output))
            {
                File.Create(output);
            }
            r.runFromFile(test, output);
        }