private static DirectTestSuite directize(TestSuite suite, string filter) { var result = new DirectTestSuite(suite); // replace all TestSuite's with DirectTestSuite's recursively... ugh... Queue <Test> tests = new Queue <Test>(); tests.Enqueue(result); while (tests.Count > 0) { var test = tests.Dequeue(); if (test.Tests == null) { continue; } var subtests = test.Tests.Cast <Test>().ToList(); test.Tests.Clear(); foreach (var subtest in subtests) { if (subtest is TestSuite) { var replacement = new DirectTestSuite((TestSuite)subtest); test.Tests.Add(replacement); tests.Enqueue(replacement); } else if (subtest is TestMethod) { if (filter == null || Regex.IsMatch(subtest.TestName.FullName, filter)) { var replacement = new DirectTestMethod((TestMethod)subtest); test.Tests.Add(replacement); tests.Enqueue(replacement); } } else { test.Tests.Add(subtest); tests.Enqueue(subtest); } } } return(result); }
private static DirectTestSuite directize(TestSuite suite, string filter) { var result = new DirectTestSuite(suite); // replace all TestSuite's with DirectTestSuite's recursively... ugh... Queue<Test> tests = new Queue<Test>(); tests.Enqueue(result); while (tests.Count > 0) { var test = tests.Dequeue(); if (test.Tests == null) continue; var subtests = test.Tests.Cast<Test>().ToList(); test.Tests.Clear(); foreach (var subtest in subtests) { if (subtest is TestSuite) { var replacement = new DirectTestSuite((TestSuite) subtest); test.Tests.Add(replacement); tests.Enqueue(replacement); } else if (subtest is TestMethod) { if (filter == null || Regex.IsMatch(subtest.TestName.FullName, filter)) { var replacement = new DirectTestMethod((TestMethod) subtest); test.Tests.Add(replacement); tests.Enqueue(replacement); } } else { test.Tests.Add(subtest); tests.Enqueue(subtest); } } } return result; }