public static IList <TestPackage> Select(this TestPackage package, TestPackageSelectorDelegate selector) { var selection = new List <TestPackage>(); AccumulatePackages(package, selection, selector); return(selection); }
private static void AccumulatePackages(TestPackage package, IList <TestPackage> selection, TestPackageSelectorDelegate selector) { if (selector(package)) { selection.Add(package); } foreach (var subPackage in package.SubPackages) { AccumulatePackages(subPackage, selection, selector); } }