Class ProtoTestResult
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
OutcomeProtoTraceOutcomeExceptionExceptionErrorProtoTraceError
Properties
Error
public ProtoTraceError? Error { get; init; }
Property Value
Exception
public Exception? Exception { get; init; }
Property Value
Outcome
public ProtoTraceOutcome Outcome { get; init; }
Property Value
Partial
public static ProtoTestResult Partial { get; }
Property Value
Passed
public static ProtoTestResult Passed { get; }
Property Value
Skipped
public static ProtoTestResult Skipped { get; }
Property Value
Unknown
public static ProtoTestResult Unknown { get; }
Property Value
Methods
Cancelled(Exception?)
public static ProtoTestResult Cancelled(Exception? exception = null)
Parameters
exceptionException
Returns
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
Returns
Failed(ProtoTraceError)
public static ProtoTestResult Failed(ProtoTraceError error)
Parameters
errorProtoTraceError
Returns
Failed(Exception)
public static ProtoTestResult Failed(Exception exception)
Parameters
exceptionException
Returns
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
Returns
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
exceptionException
Returns
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
exceptionTypeNamestring