Class IResultAssertions
Contains assertion methods for the non-generic IResult interface. Mirrors the failure-side surface of ResultAssertions<TValue> (no success-value assertions exist because IResult carries no typed value).
public class IResultAssertions : ReferenceTypeAssertions<IResult, IResultAssertions>
- Inheritance
-
IResultAssertions
- Inherited Members
- Extension Methods
Constructors
IResultAssertions(IResult?)
Initializes a new instance of the IResultAssertions class.
public IResultAssertions(IResult? result)
Parameters
resultIResult
Properties
Identifier
Returns the type of the subject the assertion applies on. It should be a user-friendly name as it is included in the failure message.
protected override string Identifier { get; }
Property Value
Methods
BeFailure(string, params object[])
Asserts that the result is a failure.
public AndWhichConstraint<IResultAssertions, Error> BeFailure(string because = "", params object[] becauseArgs)
Parameters
Returns
BeFailureOfType<TError>(string, params object[])
Asserts that the result is a failure with a specific error type.
public AndWhichConstraint<IResultAssertions, TError> BeFailureOfType<TError>(string because = "", params object[] becauseArgs) where TError : Error
Parameters
Returns
- AndWhichConstraint<IResultAssertions, TError>
Type Parameters
TErrorThe expected error type.
Remarks
Wrong-type behavior mirrors BeFailureOfType<TError>(string, params object[]):
without an active AssertionScope the assertion throws immediately;
with an active scope it records the failure and returns default(TError)! so
the scope's eventual Dispose surfaces the recorded assertion rather than a
chained NullReferenceException.
BeSuccess(string, params object[])
Asserts that the result is a success.
public AndConstraint<IResultAssertions> BeSuccess(string because = "", params object[] becauseArgs)
Parameters
Returns
HaveErrorCode(string, string, params object[])
Asserts that the failure has a specific error code.
public AndConstraint<IResultAssertions> HaveErrorCode(string expectedCode, string because = "", params object[] becauseArgs)
Parameters
Returns
HaveErrorDetail(string, string, params object[])
Asserts that the failure has a specific error detail.
public AndConstraint<IResultAssertions> HaveErrorDetail(string expectedDetail, string because = "", params object[] becauseArgs)
Parameters
Returns
HaveErrorDetailContaining(string, string, params object[])
Asserts that the failure error detail contains the specified substring.
public AndConstraint<IResultAssertions> HaveErrorDetailContaining(string substring, string because = "", params object[] becauseArgs)