Class ResultState
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.
Implements
Inherited Members
Namespace: NUnit.Framework.Interfaces
Assembly: nunit.framework.dll
Syntax
public class ResultState : IEquatable<ResultState>
Constructors
View SourceResultState(TestStatus)
Initializes a new instance of the ResultState class.
Declaration
public ResultState(TestStatus status)
Parameters
Type | Name | Description |
---|---|---|
TestStatus | status | The TestStatus. |
ResultState(TestStatus, FailureSite)
Initializes a new instance of the ResultState class.
Declaration
public ResultState(TestStatus status, FailureSite site)
Parameters
Type | Name | Description |
---|---|---|
TestStatus | status | The TestStatus. |
FailureSite | site | The stage at which the result was produced |
ResultState(TestStatus, string?)
Initializes a new instance of the ResultState class.
Declaration
public ResultState(TestStatus status, string? label)
Parameters
Type | Name | Description |
---|---|---|
TestStatus | status | The TestStatus. |
string | label | The label. |
ResultState(TestStatus, string?, FailureSite)
Initializes a new instance of the ResultState class.
Declaration
public ResultState(TestStatus status, string? label, FailureSite site)
Parameters
Type | Name | Description |
---|---|---|
TestStatus | status | The TestStatus. |
string | label | The label. |
FailureSite | site | The stage at which the result was produced |
Fields
View SourceCancelled
The test was cancelled by the user
Declaration
public static readonly ResultState Cancelled
Field Value
Type | Description |
---|---|
ResultState |
ChildFailure
A suite failed because one or more child tests failed or had errors
Declaration
public static readonly ResultState ChildFailure
Field Value
Type | Description |
---|---|
ResultState |
ChildIgnored
A suite is marked ignored because one or more child tests were ignored
Declaration
public static readonly ResultState ChildIgnored
Field Value
Type | Description |
---|---|
ResultState |
ChildWarning
A suite failed because one or more child tests had warnings
Declaration
public static readonly ResultState ChildWarning
Field Value
Type | Description |
---|---|
ResultState |
Error
The test encountered an unexpected exception
Declaration
public static readonly ResultState Error
Field Value
Type | Description |
---|---|
ResultState |
Explicit
The test was skipped because it is explicit
Declaration
public static readonly ResultState Explicit
Field Value
Type | Description |
---|---|
ResultState |
Failure
The test failed
Declaration
public static readonly ResultState Failure
Field Value
Type | Description |
---|---|
ResultState |
Ignored
The test has been ignored.
Declaration
public static readonly ResultState Ignored
Field Value
Type | Description |
---|---|
ResultState |
Inconclusive
The result is inconclusive
Declaration
public static readonly ResultState Inconclusive
Field Value
Type | Description |
---|---|
ResultState |
NotRunnable
The test was not runnable.
Declaration
public static readonly ResultState NotRunnable
Field Value
Type | Description |
---|---|
ResultState |
SetUpError
A suite had an unexpected exception in its OneTimeSetUp
Declaration
public static readonly ResultState SetUpError
Field Value
Type | Description |
---|---|
ResultState |
SetUpFailure
A suite failed in its OneTimeSetUp
Declaration
public static readonly ResultState SetUpFailure
Field Value
Type | Description |
---|---|
ResultState |
Skipped
The test has been skipped.
Declaration
public static readonly ResultState Skipped
Field Value
Type | Description |
---|---|
ResultState |
Success
The test succeeded
Declaration
public static readonly ResultState Success
Field Value
Type | Description |
---|---|
ResultState |
TearDownError
A suite had an unexpected exception in its OneTimeDown
Declaration
public static readonly ResultState TearDownError
Field Value
Type | Description |
---|---|
ResultState |
Warning
The test issued a warning
Declaration
public static readonly ResultState Warning
Field Value
Type | Description |
---|---|
ResultState |
Properties
View SourceLabel
Gets the label under which this test result is categorized, or Empty if none.
Declaration
public string Label { get; }
Property Value
Type | Description |
---|---|
string |
Site
Gets the stage of test execution in which the failure or other result took place.
Declaration
public FailureSite Site { get; }
Property Value
Type | Description |
---|---|
FailureSite |
Status
Gets the TestStatus for the test.
Declaration
public TestStatus Status { get; }
Property Value
Type | Description |
---|---|
TestStatus | The status. |
Methods
View SourceEquals(ResultState?)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(ResultState? other)
Parameters
Type | Name | Description |
---|---|---|
ResultState | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
bool |
Equals(object?)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
bool |
Overrides
View SourceGetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int |
Overrides
View SourceMatches(ResultState)
Test whether this ResultState has the same Status and Label as another one. In other words, the whether two are equal ignoring the Site.
Declaration
public bool Matches(ResultState other)
Parameters
Type | Name | Description |
---|---|---|
ResultState | other |
Returns
Type | Description |
---|---|
bool |
ToString()
Returns a string that represents this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents this instance. |
Overrides
View SourceWithSite(FailureSite)
Get a new ResultState, which is the same as the current one but with the FailureSite set to the specified value.
Declaration
public ResultState WithSite(FailureSite site)
Parameters
Type | Name | Description |
---|---|---|
FailureSite | site | The FailureSite to use |
Returns
Type | Description |
---|---|
ResultState | A new ResultState |
Operators
View Sourceoperator ==(ResultState?, ResultState?)
Overload == operator for ResultStates
Declaration
public static bool operator ==(ResultState? left, ResultState? right)
Parameters
Type | Name | Description |
---|---|---|
ResultState | left | |
ResultState | right |
Returns
Type | Description |
---|---|
bool |
operator !=(ResultState?, ResultState?)
Overload != operator for ResultStates
Declaration
public static bool operator !=(ResultState? left, ResultState? right)
Parameters
Type | Name | Description |
---|---|---|
ResultState | left | |
ResultState | right |
Returns
Type | Description |
---|---|
bool |