Search Results for

    Show / Hide Table of Contents

    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.

    Inheritance
    object
    ResultState
    Implements
    IEquatable<ResultState>
    Inherited Members
    object.GetType()
    object.MemberwiseClone()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    Namespace: NUnit.Framework.Interfaces
    Assembly: nunit.framework.dll
    Syntax
    public class ResultState : IEquatable<ResultState>

    Constructors

    View Source

    ResultState(TestStatus)

    Initializes a new instance of the ResultState class.

    Declaration
    public ResultState(TestStatus status)
    Parameters
    Type Name Description
    TestStatus status

    The TestStatus.

    View Source

    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

    View Source

    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.

    View Source

    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 Source

    Cancelled

    The test was cancelled by the user

    Declaration
    public static readonly ResultState Cancelled
    Field Value
    Type Description
    ResultState
    View Source

    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
    View Source

    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
    View Source

    ChildWarning

    A suite failed because one or more child tests had warnings

    Declaration
    public static readonly ResultState ChildWarning
    Field Value
    Type Description
    ResultState
    View Source

    Error

    The test encountered an unexpected exception

    Declaration
    public static readonly ResultState Error
    Field Value
    Type Description
    ResultState
    View Source

    Explicit

    The test was skipped because it is explicit

    Declaration
    public static readonly ResultState Explicit
    Field Value
    Type Description
    ResultState
    View Source

    Failure

    The test failed

    Declaration
    public static readonly ResultState Failure
    Field Value
    Type Description
    ResultState
    View Source

    Ignored

    The test has been ignored.

    Declaration
    public static readonly ResultState Ignored
    Field Value
    Type Description
    ResultState
    View Source

    Inconclusive

    The result is inconclusive

    Declaration
    public static readonly ResultState Inconclusive
    Field Value
    Type Description
    ResultState
    View Source

    NotRunnable

    The test was not runnable.

    Declaration
    public static readonly ResultState NotRunnable
    Field Value
    Type Description
    ResultState
    View Source

    SetUpError

    A suite had an unexpected exception in its OneTimeSetUp

    Declaration
    public static readonly ResultState SetUpError
    Field Value
    Type Description
    ResultState
    View Source

    SetUpFailure

    A suite failed in its OneTimeSetUp

    Declaration
    public static readonly ResultState SetUpFailure
    Field Value
    Type Description
    ResultState
    View Source

    Skipped

    The test has been skipped.

    Declaration
    public static readonly ResultState Skipped
    Field Value
    Type Description
    ResultState
    View Source

    Success

    The test succeeded

    Declaration
    public static readonly ResultState Success
    Field Value
    Type Description
    ResultState
    View Source

    TearDownError

    A suite had an unexpected exception in its OneTimeDown

    Declaration
    public static readonly ResultState TearDownError
    Field Value
    Type Description
    ResultState
    View Source

    Warning

    The test issued a warning

    Declaration
    public static readonly ResultState Warning
    Field Value
    Type Description
    ResultState

    Properties

    View Source

    Label

    Gets the label under which this test result is categorized, or Empty if none.

    Declaration
    public string Label { get; }
    Property Value
    Type Description
    string
    View Source

    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
    View Source

    Status

    Gets the TestStatus for the test.

    Declaration
    public TestStatus Status { get; }
    Property Value
    Type Description
    TestStatus

    The status.

    Methods

    View Source

    Equals(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
    View Source

    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
    object.Equals(object)
    View Source

    GetHashCode()

    Serves as the default hash function.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int
    Overrides
    object.GetHashCode()
    View Source

    Matches(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
    View Source

    ToString()

    Returns a string that represents this instance.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string that represents this instance.

    Overrides
    object.ToString()
    View Source

    WithSite(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 Source

    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
    View Source

    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

    Implements

    IEquatable<T>
    • View Source
    In this article
    Back to top Generated by DocFX | Copyright (c) 2018- The NUnit Project - Licensed under CC BY-NC-SA 4.0