Class TestFilter
Interface to be implemented by filters applied to tests. The filter applies when running the test, after it has been loaded, since this is the only time an ITest exists.
public abstract class TestFilter : ITestFilter, IXmlNodeBuilder
- Inheritance
-
TestFilter
- Implements
- Inherited Members
Constructors
TestFilter()
protected TestFilter()
Fields
Empty
Unique Empty filter.
public static readonly TestFilter Empty
Field Value
Properties
IsEmpty
Indicates whether this is the EmptyFilter
public bool IsEmpty { get; }
Property Value
Methods
AddToXml(TNode, bool)
Adds an XML node
public abstract TNode AddToXml(TNode parentNode, bool recursive)
Parameters
Returns
- TNode
The added XML node
FromXml(TNode?)
Create a TestFilter from its TNode representation
public static TestFilter FromXml(TNode? node)
Parameters
node
TNode
Returns
FromXml(string?)
Create a TestFilter instance from an XML representation.
public static TestFilter FromXml(string? xmlText)
Parameters
xmlText
string
Returns
IsExplicitMatch(ITest)
Determine if a test matches the filter explicitly. That is, it must be a direct match of the test itself or one of its children.
public virtual bool IsExplicitMatch(ITest test)
Parameters
test
ITestThe test to which the filter is applied
Returns
- bool
True if the test matches the filter explicitly, otherwise false
Match(ITest)
Determine whether the test itself matches the filter criteria, without examining either parents or descendants. This is overridden by each different type of filter to perform the necessary tests.
public abstract bool Match(ITest test)
Parameters
test
ITestThe test to which the filter is applied
Returns
- bool
True if the filter matches the any parent of the test
MatchDescendant(ITest)
Determine whether any descendant of the test matches the filter criteria.
protected virtual bool MatchDescendant(ITest test)
Parameters
test
ITestThe test to be matched
Returns
- bool
True if at least one descendant matches the filter criteria
MatchParent(ITest)
Determine whether any ancestor of the test matches the filter criteria
public bool MatchParent(ITest test)
Parameters
test
ITestThe test to which the filter is applied
Returns
- bool
True if the filter matches the an ancestor of the test
Pass(ITest)
Determine if a particular test passes the filter criteria. The default implementation checks the test itself, its parents and any descendants.
Derived classes may override this method or any of the Match methods to change the behavior of the filter.
public virtual bool Pass(ITest test)
Parameters
test
ITestThe test to which the filter is applied
Returns
- bool
True if the test passes the filter, otherwise false
Pass(ITest, bool)
Determine if a particular test passes the filter criteria. The default implementation checks the test itself, its parents and any descendants.
Derived classes may override this method or any of the Match methods to change the behavior of the filter.
public virtual bool Pass(ITest test, bool negated)
Parameters
test
ITestThe test to which the filter is applied
negated
boolIf set to true we are carrying a negation through
Returns
- bool
True if the test passes the filter, otherwise false
ToXml(bool)
Adds an XML node
public TNode ToXml(bool recursive)
Parameters
recursive
boolTrue if recursive
Returns
- TNode
The added XML node