Table of Contents

Class TestFilter

Namespace
NUnit.Framework.Internal
Assembly
nunit.framework.dll

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
Inheritance
TestFilter
Implements
Derived
Inherited Members

Constructors

TestFilter()

protected TestFilter()

Fields

Empty

Unique Empty filter.

public static readonly TestFilter Empty

Field Value

TestFilter

Properties

IsEmpty

Indicates whether this is the EmptyFilter

public bool IsEmpty { get; }

Property Value

bool

Methods

FromXml(string)

Create a TestFilter instance from an xml representation.

public static TestFilter FromXml(string xmlText)

Parameters

xmlText string

Returns

TestFilter

Match(ITest)

Determine whether the test itself matches the filter criteria, without examining either parents or descendants.

public abstract bool Match(ITest test)

Parameters

test ITest

The 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 ITest

The 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

protected virtual bool MatchParent(ITest test)

Parameters

test ITest

The 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 ITest

The test to which the filter is applied

Returns

bool

True if the test passes the filter, otherwise false