Class ProtoTestResult

Namespace
ProtoTest.Core
Assembly
ProtoTest.Core.dll

The final result reported by a test-framework adapter.

public sealed record ProtoTestResult : IEquatable<ProtoTestResult>
Inheritance
ProtoTestResult
Implements
Inherited Members
Extension Methods

Constructors

ProtoTestResult(ProtoTraceOutcome, Exception?, ProtoTraceError?)

The final result reported by a test-framework adapter.

public ProtoTestResult(ProtoTraceOutcome Outcome, Exception? Exception = null, ProtoTraceError? Error = null)

Parameters

Outcome ProtoTraceOutcome
Exception Exception
Error ProtoTraceError

Properties

Error

public ProtoTraceError? Error { get; init; }

Property Value

ProtoTraceError

Exception

public Exception? Exception { get; init; }

Property Value

Exception

Outcome

public ProtoTraceOutcome Outcome { get; init; }

Property Value

ProtoTraceOutcome

Partial

public static ProtoTestResult Partial { get; }

Property Value

ProtoTestResult

Passed

public static ProtoTestResult Passed { get; }

Property Value

ProtoTestResult

Skipped

public static ProtoTestResult Skipped { get; }

Property Value

ProtoTestResult

Unknown

public static ProtoTestResult Unknown { get; }

Property Value

ProtoTestResult

Methods

Cancelled(Exception?)

public static ProtoTestResult Cancelled(Exception? exception = null)

Parameters

exception Exception

Returns

ProtoTestResult

Cancelled(string, string, string, string?)

A run a runner reported as timed out or aborted. It did not finish, which is different from a failing assertion, so it records as cancelled - matching how adapters report cancellation.

public static ProtoTestResult Cancelled(string source, string state, string message, string? stackTrace = null)

Parameters

source string
state string
message string
stackTrace string

Returns

ProtoTestResult

Failed(ProtoTraceError)

public static ProtoTestResult Failed(ProtoTraceError error)

Parameters

error ProtoTraceError

Returns

ProtoTestResult

Failed(Exception)

public static ProtoTestResult Failed(Exception exception)

Parameters

exception Exception

Returns

ProtoTestResult

Failed(string, string, string, string?)

A failure a runner reported without an exception. The framework and its own state join into the error type - "NUnit.Failed", "MSTest.Error" - so runner-reported failures read alike in a trace.

public static ProtoTestResult Failed(string source, string state, string message, string? stackTrace = null)

Parameters

source string
state string
message string
stackTrace string

Returns

ProtoTestResult

FromException(Exception)

Classifies the exception a runner reported for a test body: an OperationCanceledException and its TaskCanceledException subclass are cancellation, anything else is a failure.

public static ProtoTestResult FromException(Exception exception)

Parameters

exception Exception

Returns

ProtoTestResult

IsCancellation(string?)

Whether a runner-reported exception type name is the shared cancellation signal - the name half of the one FromException(Exception) rule, for runners (xUnit v3) whose result state carries the type as a string.

public static bool IsCancellation(string? exceptionTypeName)

Parameters

exceptionTypeName string

Returns

bool