Esempio n. 1
0
 private void SetDefaults()
 {
     LoggingLevel    = LogLevel.Detailed;
     ApplicationName = "dat";
     LogPath         = Path.Combine(Environment.CurrentDirectory, $"{ApplicationName}.log");
     TestRunConfig   = null;
 }
Esempio n. 2
0
        private void ConfigureOptions()
        {
            HasOption("-p|--perf", param => PerformanceProfile = true, "Performance profile queries.");

            HasOption("-c|--compare", param => DataCompare = true, "Compare output from two queries to validate changes made still produce the same output.");

            HasOption("-v|--verbosity", param =>
            {
                if (Enum.TryParse(param, true, out LogLevel result))
                {
                    LoggingLevel = result;
                }
                else
                {
                    if (param.Equals("q", StringComparison.OrdinalIgnoreCase))
                    {
                        LoggingLevel = LogLevel.Quiet;
                    }
                    else if (param.Equals("m", StringComparison.OrdinalIgnoreCase))
                    {
                        LoggingLevel = LogLevel.Minimal;
                    }
                    else if (param.Equals("d", StringComparison.OrdinalIgnoreCase))
                    {
                        LoggingLevel = LogLevel.Detailed;
                    }
                    else if (param.Equals("diag", StringComparison.OrdinalIgnoreCase))
                    {
                        LoggingLevel = LogLevel.Diagnostic;
                    }
                }
            }, "Specifies the amount of information to display in the log.  You can specify the following verbosity levels: q[uiet], m[inimal], d[etailed], diag[nostic]");

            HasOption("-l|--logPath", param => LogPath = param, $"The path to log based on the specified verbosity, default is the current directory {ApplicationName}.log");

            HasOption("-d|--datFile", param =>
            {
                var filePath = param;
                if (!File.Exists(filePath))
                {
                    throw new Exception("datfile does not exist.");
                }

                var configFileContents = File.ReadAllText(filePath);

                TestRunConfig = JsonConvert.DeserializeObject <DATTestConfig>(configFileContents);
            }, "Specifies the configuration file to execute");
        }