Skip to content

Commit

Permalink
Adding the conditions for the negative scenario in the AddOperator fo…
Browse files Browse the repository at this point in the history
…r FastFilter (#1252)
  • Loading branch information
singhsarab committed Oct 31, 2017
1 parent 71cbcd0 commit 30c4e02
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Microsoft.TestPlatform.Common/Filtering/FastFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ internal void AddOperator(Operator @operator)
{
operatorEncountered = true;
fastFilterOperator = @operator;
if ((fastFilterOperation == Operation.NotEqual && fastFilterOperator == Operator.Or)
|| (fastFilterOperation == Operation.Equal && fastFilterOperator == Operator.And))
{
containsValidFilter = false;
}
}
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public void AndOperatorAndEqualsOperationShouldNotCreateFastFilter()
var fastFilter = filterExpressionWrapper.fastFilter;

Assert.IsTrue(fastFilter == null);
Assert.IsTrue(string.IsNullOrEmpty(filterExpressionWrapper.ParseError));
}

[TestMethod]
Expand All @@ -63,6 +64,7 @@ public void OrOperatorAndNotEqualsOperationShouldNotCreateFastFilter()
var fastFilter = filterExpressionWrapper.fastFilter;

Assert.IsTrue(fastFilter == null);
Assert.IsTrue(string.IsNullOrEmpty(filterExpressionWrapper.ParseError));
}

[TestMethod]
Expand Down

0 comments on commit 30c4e02

Please sign in to comment.