Esempio n. 1
0
        /// <nodoc />
        public Args(IReadOnlyCollection <string> args)
            : base(args)
        {
            foreach (Option opt in Options)
            {
                if (opt.Name.Equals("OutputFolder", StringComparison.OrdinalIgnoreCase) || opt.Name.Equals("o", StringComparison.OrdinalIgnoreCase))
                {
                    OutputFolder = ParsePathOption(opt);
                }
                else if (opt.Name.Equals("TestFile", StringComparison.OrdinalIgnoreCase) || opt.Name.Equals("t", StringComparison.OrdinalIgnoreCase))
                {
                    var testFile = ParsePathOption(opt);
                    TestFiles.Add(testFile);
                }
                else if (opt.Name.Equals("SdkToTest", StringComparison.OrdinalIgnoreCase) || opt.Name.Equals("s", StringComparison.OrdinalIgnoreCase))
                {
                    var sdkFolder = ParsePathOption(opt);
                    SdksToTest.Add(sdkFolder);
                }
                else if (opt.Name.Equals("LkgFile", StringComparison.OrdinalIgnoreCase) || opt.Name.Equals("l", StringComparison.OrdinalIgnoreCase))
                {
                    var    lkgFile = ParsePathOption(opt);
                    var    lkgKey  = ComputeLkgKey(lkgFile);
                    string existingFile;
                    if (LkgFiles.TryGetValue(lkgKey, out existingFile))
                    {
                        throw Error(C($"Duplicate LkgFile defined: '{lkgFile}' and '{existingFile}' "));
                    }

                    LkgFiles.Add(lkgKey, lkgFile);
                }
                else if (s_helpStrings.Any(s => opt.Name.Equals(s, StringComparison.OrdinalIgnoreCase)))
                {
                    WriteHelp();
                    return;
                }
            }

            if (string.IsNullOrWhiteSpace(OutputFolder))
            {
                throw Error("OutputFolder parameter is required");
            }

            if (TestFiles.Count == 0)
            {
                throw Error("At least one TestFile is required");
            }
        }
Esempio n. 2
0
        public void AddTestFileFilters(string[] testFilters)
        {
            if (testFilters == null)
            {
                return;
            }

            foreach (var testFilter in testFilters.Where(x => x != null))
            {
                var filter = testFilter;
                if (!RegExFilters)
                {
                    filter = filter.ValidateAndEscape(@"[]").WrapWithAnchors();
                }

                TestFiles.Add(new Lazy <Regex>(() => new Regex(filter)));
            }
        }