/// <summary>
 /// Filter the list of active test methods to those matching the tag
 /// expression.
 /// </summary>
 /// <param name="groups">The test groups.</param>
 public override void Filter(IList<TestGroup> groups)
 {
     string tagExpression = this.Settings.TagExpression;
     if (!string.IsNullOrEmpty(tagExpression))
     {
         this.Settings.TestRunStatusMessage += " - Tag Expression '" + tagExpression + "'";
         foreach (TestGroup group in groups)
         {
             List<TestMethod> activeMethods =
                 new TagManager(group).EvaluateExpression(tagExpression).ToList();
             Remove(group.Methods, m => !activeMethods.Contains(m));                    
         }
         Remove(groups, g => g.Methods.Count == 0);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Evaluate a tag expression.
 /// </summary>
 /// <param name="owner">The owner object.</param>
 /// <param name="tagExpression">Tag expression.</param>
 /// <returns>Test methods associated with the tag expression.</returns>
 public static IEnumerable <TestMethod> Evaluate(TagManager owner, string tagExpression)
 {
     return(new ExpressionEvaluator(owner, tagExpression).Evaluate());
 }
 /// <summary>
 /// Evaluate a tag expression.
 /// </summary>
 /// <param name="owner">The owner object.</param>
 /// <param name="tagExpression">Tag expression.</param>
 /// <returns>Test methods associated with the tag expression.</returns>
 public static IEnumerable<TestMethod> Evaluate(TagManager owner, string tagExpression)
 {
     return new ExpressionEvaluator(owner, tagExpression).Evaluate();
 }
 /// <summary>
 /// Create an expression evaluator.
 /// </summary>
 /// <param name="owner">The owner object.</param>
 /// <param name="tagExpression">Expression object.</param>
 private ExpressionEvaluator(TagManager owner, string tagExpression)
 {
     if (tagExpression == null)
     {
         throw new ArgumentNullException("tagExpression");
     }
     else if (tagExpression.Length == 0)
     {
         throw new ArgumentOutOfRangeException("tagExpression");
     }
     _owner = owner;
     _tagExpression = tagExpression;
 }