private IEnumerable <Args> GetFinalCommandLines(string baseCommandLine) { List <Args> commandLines = new List <Args>(); string userParam = GetAdditionalUserParameter(); if (AllTestCasesOfExecutableAreRun()) { commandLines.Add(new Args(TestCasesToRun.ToList(), baseCommandLine + userParam)); return(commandLines); } List <string> suitesRunningAllTests = GetSuitesRunningAllTests(); string suitesFilter = GoogleTestConstants.FilterOption + GetFilterForSuitesRunningAllTests(suitesRunningAllTests); string baseCommandLineWithFilter = baseCommandLine + suitesFilter; List <TestCase> testCasesNotRunBySuite = GetTestCasesNotRunBySuite(suitesRunningAllTests); List <TestCase> testCasesRunBySuite = TestCasesToRun.Where(tc => !testCasesNotRunBySuite.Contains(tc)).ToList(); if (testCasesNotRunBySuite.Count == 0) { commandLines.Add(new Args(TestCasesToRun.ToList(), baseCommandLineWithFilter + userParam)); return(commandLines); } List <TestCase> includedTestCases; int remainingLength = MaxCommandLength - baseCommandLineWithFilter.Length - LengthOfExecutableString - userParam.Length - 1; string commandLine = baseCommandLineWithFilter + JoinTestsUpToMaxLength(testCasesNotRunBySuite, remainingLength, out includedTestCases); includedTestCases.AddRange(testCasesRunBySuite); commandLines.Add(new Args(includedTestCases, commandLine + userParam)); // only add suites to first command line baseCommandLineWithFilter = baseCommandLine + GoogleTestConstants.FilterOption; while (testCasesNotRunBySuite.Count > 0) { remainingLength = MaxCommandLength - baseCommandLineWithFilter.Length - LengthOfExecutableString - userParam.Length - 1; commandLine = baseCommandLineWithFilter + JoinTestsUpToMaxLength(testCasesNotRunBySuite, remainingLength, out includedTestCases); commandLines.Add(new Args(includedTestCases, commandLine + userParam)); } return(commandLines); }
private List <string> GetAllSuitesOfTestCasesToRun() { return(TestCasesToRun.Select(tc => tc.GetTestsuiteName_CommandLineGenerator()).Distinct().ToList()); }