Table of Contents

Class XunitFilters

Namespace
Xunit.Runner.Common
Assembly
xunit.v3.runner.common.dll

Represents the ability to track query filters or simple filters. Any attempt to add a mix of the two will result in an exception.

public class XunitFilters : ITestCaseFilter
Inheritance
XunitFilters
Implements
Inherited Members

Properties

Empty

Gets a flag indicating whether there are any active filters.

public bool Empty { get; }

Property Value

bool

Methods

AddExcludedClassFilter(string)

Adds a simple filter which excludes a fully qualified class name.

public void AddExcludedClassFilter(string query)

Parameters

query string

Remarks

The query may begin and/or end with * to add as a wildcard. No other wildcards are permitted in any other locations.

AddExcludedMethodFilter(string)

public void AddExcludedMethodFilter(string query)

Parameters

query string

AddExcludedNamespaceFilter(string)

public void AddExcludedNamespaceFilter(string query)

Parameters

query string

AddExcludedTraitFilter(string, string)

public void AddExcludedTraitFilter(string name, string value)

Parameters

name string
value string

AddIncludedClassFilter(string)

Adds a simple filter matching a fully qualified class name.

public void AddIncludedClassFilter(string query)

Parameters

query string

Remarks

The query may begin and/or end with * to add as a wildcard. No other wildcards are permitted in any other locations.

AddIncludedMethodFilter(string)

public void AddIncludedMethodFilter(string query)

Parameters

query string

AddIncludedNamespaceFilter(string)

public void AddIncludedNamespaceFilter(string query)

Parameters

query string

AddIncludedTraitFilter(string, string)

public void AddIncludedTraitFilter(string name, string value)

Parameters

name string
value string

AddQueryFilter(string)

Adds a query filter.

public void AddQueryFilter(string query)

Parameters

query string

Remarks

For more information on the query syntax, see https://xunit.net/docs/query-filter-language

Filter(string, ITestCaseMetadata)

Determines whether the given testCase passes the filter.

public bool Filter(string assemblyName, ITestCaseMetadata testCase)

Parameters

assemblyName string

The simple assembly name without file extension

testCase ITestCaseMetadata

The test case to be checked against the filter

Returns

bool

ToXunit3Arguments()

Gets the command-line arguments to pass to an xUnit.net v3 test assembly to perform the filtering contained within this filter.

public IReadOnlyCollection<string> ToXunit3Arguments()

Returns

IReadOnlyCollection<string>