<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AutoTest.TestRunners.CmdArguments;
using System.IO;
using AutoTest.TestRunners.Results;
using AutoTest.TestRunners.Shared;
using AutoTest.TestRunners.Shared.Plugins;

namespace AutoTest.TestRunners
{
    class Program
    {
        static void Main(string[] args)
        {
            //args = new string[] { "testrun.xml", "testoutput.xml" };
            if (args.Length != 2)
            {
                printUseage();
                return;
            }
            var parser = new OptionsParser(args[0]);
            parser.Parse();
            if (!parser.IsValid)
                return;

            var result = run(parser);

            var writer = new ResultsXmlWriter(result);
            writer.Write(args[1]);
        }

        private static void printUseage()
        {
            Console.WriteLine("AutoTest.TestRunner is a plugin based generic test runner. ");
        }

        private static IEnumerable<TestResult> run(OptionsParser parser)
        {
            var results = new List<TestResult>();
            foreach (var runner in getRunners(parser))
            {
                foreach (var testRun in parser.Options.TestRuns)
                {
                    if (runner.Handles(testRun.ID))
                        results.AddRange(runner.Run(testRun));<commit_msg>Added console help<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AutoTest.TestRunners.CmdArguments;
using System.IO;
using AutoTest.TestRunners.Results;
using AutoTest.TestRunners.Shared;
using AutoTest.TestRunners.Shared.Plugins;

namespace AutoTest.TestRunners
{
    class Program
    {
        static void Main(string[] args)
        {
            //args = new string[] { "testrun.xml", "testoutput.xml" };
            if (args.Length != 2)
            {
                printUseage();
                return;
            }
            var parser = new OptionsParser(args[0]);
            parser.Parse();
            if (!parser.IsValid)
                return;

            var result = run(parser);

            var writer = new ResultsXmlWriter(result);
            writer.Write(args[1]);
        }

        private static void printUseage()
        {
            Console.WriteLine("AutoTest.TestRunner v0.1");
            Console.WriteLine("Author - <NAME>");
            Console.WriteLine("AutoTest.TestRunner is a plugin based generic test runner. ");
            Console.WriteLine("");
            Console.WriteLine("Syntax: AutoTest.TestRunner.exe OPTIONS_FILE RESULT_FILE");
            Console.WriteLine("");
            Console.WriteLine("Options format");
            Console.WriteLine("<=====================================================>");
            Console.WriteLine("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
            Console.WriteLine("<run>");
            Console.WriteLine("\t<!--It can contain 0-n plugins. If 0 the runner will load all available plugins-->");
            Console.WriteLine("\t<plugin type=\"Plugin.IAutoTestNetTestRunner.Implementation\">C:\\Some\\Path\\PluginAssembly.dll</plugin>");
            Console.WriteLine("\t<!--It can contain 0-n runners. The id is what determines which runner will handle that run-->");
            Console.WriteLine("\t<runner id=\"NUnit\">");
            Console.WriteLine("\t\t<!--It can contain 0-n categories to ignore-->");
            Console.WriteLine("\t\t<categories>");
            Console.WriteLine("\t\t\t<ignore_category>IgnoreCategory</ignore_category>");
            Console.WriteLine("\t\t</categories>");
            Console.WriteLine("\t\t<!--It can contain 1-n assemblies to test. Framework is optional-->");
            Console.WriteLine("\t\t<test_assembly name=\"C:\\my\\testassembly.dll\" framework=\"3.5\">");
            Console.WriteLine("\t\t\t<!--It can contain 0-n tests-->");
            Console.WriteLine("\t\t\t<tests>");
            Console.WriteLine("\t\t\t\t<test>testassembly.class.test1</test>");
            Console.WriteLine("\t\t\t</tests>");
            Console.WriteLine("\t\t\t<!--It can contain 0-n members-->");
            Console.WriteLine("\t\t\t<members>");
            Console.WriteLine("\t\t\t\t<member>testassembly.class2</member>");
            Console.WriteLine("\t\t\t</members>");
            Console.WriteLine("\t\t\t<!--It can contain 0-n namespaces-->");
            Console.WriteLine("\t\t\t<namespaces>");
            Console.WriteLine("\t\t\t\t<namespace>testassembly.somenamespace1</namespace>");
            Console.WriteLine("\t\t\t</namespaces>");
            Console.WriteLine("\t\t</test_assembly>");
            Console.WriteLine("\t</runner>");
            Console.WriteLine("</run>");
        }

        private static IEnumerable<TestResult> run(OptionsParser parser)
        {
            var results = new List<TestResult>();
            foreach (var runner in getRunners(parser))
            {
                foreach (var testRun in parser.Options.TestRuns)
                {
                    if (runner.Handles(testRun.ID))
                        results.AddRange(runner.Run(testRun));
{'fraction_non_alphanumeric': 0.14843152257077277, 'fraction_numerical': 0.0045906656465187455, 'mean_word_length': 2.063268892794376, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 1, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 5}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5709378', 'n_tokens_mistral': 1386, 'n_tokens_neox': 1350, 'n_words': 274}