private static bool Exceeds(ExecutionGroupingLevel?executionGroupingLevel, ExecutionGroupingLevel minGroupingLevel) { return(executionGroupingLevel.HasValue && executionGroupingLevel.Value >= minGroupingLevel); }
/// <summary> /// Bucketizes tests into execution groups, and creates separate buckets for tests which do not satisfy the minimum execution grouping level. /// </summary> public static IEnumerable <List <TestRecord> > Bucketize(ICollection <TestRecord> tests, ExecutionGroupingLevel minGroupingLevel, Func <TestRecord, object> hashMethod) { List <TestRecord> groupableTests = new List <TestRecord>(tests.Where(test => Exceeds(test.TestInfo.ExecutionGroupingLevel, minGroupingLevel))); List <TestRecord> isolatedTests = new List <TestRecord>(tests.Where(test => !Exceeds(test.TestInfo.ExecutionGroupingLevel, minGroupingLevel))); Dictionary <object, List <TestRecord> > bucketizedTests = ExecutionGrouper.HashTests(groupableTests, hashMethod); IEnumerable <List <TestRecord> > testGroups = Unify(bucketizedTests, isolatedTests); return(testGroups); }