/// <summary> /// Create the test filter for this run - public for testing /// </summary> /// <param name="options"></param> /// <returns></returns> public static TestFilter CreateTestFilter(NUnitLiteOptions options) { var filter = TestFilter.Empty; if (options.TestList.Count > 0) { var testFilters = new List<TestFilter>(); foreach (var test in options.TestList) testFilters.Add(new FullNameFilter(test)); filter = testFilters.Count > 1 ? new OrFilter(testFilters.ToArray()) : testFilters[0]; } if (options.WhereClauseSpecified) { string xmlText = new TestSelectionParser().Parse(options.WhereClause); var whereFilter = TestFilter.FromXml(TNode.FromXml(xmlText)); filter = filter.IsEmpty ? whereFilter : new AndFilter(filter, whereFilter); } return filter; }
/// <summary> /// Create the test filter for this run - public for testing /// </summary> /// <param name="options"></param> /// <returns></returns> public static TestFilter CreateTestFilter(NUnitLiteOptions options) { var filters = new List<TestFilter>(); foreach (var test in options.TestList) filters.Add(new FullNameFilter(test)); if (options.WhereClauseSpecified) { string xmlText = new TestSelectionParser().Parse(options.WhereClause); filters.Add(TestFilter.FromXml(TNode.FromXml(xmlText))); } switch (filters.Count) { case 0: return TestFilter.Empty; case 1: return filters[0]; default: return new AndFilter(filters.ToArray()); } }