Table of Contents

Class ResultState

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

The ResultState class represents the outcome of running a test. It contains two pieces of information. The Status of the test is an enum indicating whether the test passed, failed, was skipped or was inconclusive. The Label provides a more detailed breakdown for use by client runners.

public class ResultState
Inheritance
ResultState
Inherited Members

Constructors

ResultState(TestStatus)

Initializes a new instance of the ResultState class.

public ResultState(TestStatus status)

Parameters

status TestStatus

The TestStatus.

ResultState(TestStatus, FailureSite)

Initializes a new instance of the ResultState class.

public ResultState(TestStatus status, FailureSite site)

Parameters

status TestStatus

The TestStatus.

site FailureSite

The stage at which the result was produced

ResultState(TestStatus, string)

Initializes a new instance of the ResultState class.

public ResultState(TestStatus status, string label)

Parameters

status TestStatus

The TestStatus.

label string

The label.

ResultState(TestStatus, string, FailureSite)

Initializes a new instance of the ResultState class.

public ResultState(TestStatus status, string label, FailureSite site)

Parameters

status TestStatus

The TestStatus.

label string

The label.

site FailureSite

The stage at which the result was produced

Fields

Cancelled

The test was cancelled by the user

public static readonly ResultState Cancelled

Field Value

ResultState

ChildFailure

A suite failed because one or more child tests failed or had errors

public static readonly ResultState ChildFailure

Field Value

ResultState

Error

The test encountered an unexpected exception

public static readonly ResultState Error

Field Value

ResultState

Explicit

The test was skipped because it is explicit

public static readonly ResultState Explicit

Field Value

ResultState

Failure

The test failed

public static readonly ResultState Failure

Field Value

ResultState

Ignored

The test has been ignored.

public static readonly ResultState Ignored

Field Value

ResultState

Inconclusive

The result is inconclusive

public static readonly ResultState Inconclusive

Field Value

ResultState

NotRunnable

The test was not runnable.

public static readonly ResultState NotRunnable

Field Value

ResultState

SetUpError

A suite had an unexpected exception in its OneTimeSetUp

public static readonly ResultState SetUpError

Field Value

ResultState

SetUpFailure

A suite failed in its OneTimeSetUp

public static readonly ResultState SetUpFailure

Field Value

ResultState

Skipped

The test has been skipped.

public static readonly ResultState Skipped

Field Value

ResultState

Success

The test succeeded

public static readonly ResultState Success

Field Value

ResultState

TearDownError

A suite had an unexpected exception in its OneTimeDown

public static readonly ResultState TearDownError

Field Value

ResultState

Properties

Label

Gets the label under which this test result is categorized, if any.

public string Label { get; }

Property Value

string

Site

Gets the stage of test execution in which the failure or other result took place.

public FailureSite Site { get; }

Property Value

FailureSite

Status

Gets the TestStatus for the test.

public TestStatus Status { get; }

Property Value

TestStatus

The status.

Methods

Equals(object)

Determines whether the specified object, is equal to this instance.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with this instance.

Returns

bool

true if the specified object is equal to this instance; otherwise, false.

GetHashCode()

Returns a hash code for this instance.

public override int GetHashCode()

Returns

int

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

ToString()

Returns a string that represents this instance.

public override string ToString()

Returns

string

A string that represents this instance.

WithSite(FailureSite)

Get a new ResultState, which is the same as the current one but with the FailureSite set to the specified value.

public ResultState WithSite(FailureSite site)

Parameters

site FailureSite

The FailureSite to use

Returns

ResultState

A new ResultState