TestFilterResult Struct

Definition

The decision returned by an ITestFilter for a single test.

public readonly struct TestFilterResult : IEquatable<Microsoft.VisualStudio.TestTools.UnitTesting.TestFilterResult>
[System.Diagnostics.CodeAnalysis.Experimental("MSTESTEXP", UrlFormat="https://aka.ms/mstest/diagnostics#{0}")]
[System.Runtime.CompilerServices.IsReadOnly]
[System.Runtime.CompilerServices.Nullable(0)]
public readonly struct TestFilterResult : IEquatable<Microsoft.VisualStudio.TestTools.UnitTesting.TestFilterResult>
type TestFilterResult = struct
[<System.Diagnostics.CodeAnalysis.Experimental("MSTESTEXP", UrlFormat="https://aka.ms/mstest/diagnostics#{0}")>]
[<System.Runtime.CompilerServices.IsReadOnly>]
[<System.Runtime.CompilerServices.Nullable(0)>]
type TestFilterResult = struct
Public Structure TestFilterResult
Implements IEquatable(Of TestFilterResult)
Inheritance
TestFilterResult
Attributes
Implements

Remarks

Designed as a readonlystruct so the filter hot path stays allocation-free. Use the static Run / Drop properties (one shared value each) or the parameterized Skip(String) factory to create explicit results. The default value also represents Run.

Properties

Name Description
Action

Gets the action MSTest should apply for the test that produced this result.

Drop

Gets the result indicating that the test should be silently dropped. Matches the semantics of the command-line --filter option: no test result is emitted and the test is not counted.

Run

Gets the result indicating that the test should run normally.

SkipReason

Gets the reason supplied to Skip(String). Non-null only when Action is Skip.

Methods

Name Description
Equals(Object)

Indicates whether this instance and a specified object are equal.

Equals(TestFilterResult)

Indicates whether the current object is equal to another object of the same type.

GetHashCode()

Returns the hash code for this instance.

Skip(String)

Creates a result indicating that the test should be reported as Skipped with the given reason.

Operators

Name Description
Equality(TestFilterResult, TestFilterResult)

Equality operator.

Inequality(TestFilterResult, TestFilterResult)

Inequality operator.

Applies to