コード例 #1
0
        public void Run(TestRunArguments arguments)
        {
            PrintVersion();

            try
            {
                var testResult = _testExecutor.Run(arguments.ExePath, arguments.Exercise);
                PrintTestResult(testResult);
            }
            catch (SwpTestToolException e)
            {
                _logger.Fatal(e.Message, e);
            }
            catch (Exception e)
            {
                _logger.Fatal("uncaught exception", e);
            }

            System.Console.ReadKey();
        }
コード例 #2
0
        public bool TryParse(string[] args, out TestRunArguments testRunArguments)
        {
            string exePath = null;
            string exercise = null;

            var p = new OptionSet()
            {
                {"e|exercise=", "the name of the exercise. (ue1|ue2|ue3)", v => { exercise = v; }},
                {"p|path=", "the path to the executable.", v => exePath = v}
            };
            
            p.Parse(args);
            
            if (exercise == null || exePath == null)
            {
                PrintUsage(p);

                testRunArguments = new TestRunArguments(null, null);
                return false;
            }

            testRunArguments = new TestRunArguments(exercise.ToLower(), exePath);
            return true;
        }