Table of Contents

Class ResultAssertionsAsyncExtensions

Namespace
Trellis.Testing
Assembly
Trellis.Testing.dll

Extension methods to enable FluentAssertions on async Result types (Task and ValueTask).

public static class ResultAssertionsAsyncExtensions
Inheritance
ResultAssertionsAsyncExtensions
Inherited Members

Methods

BeFailureAsync<TValue>(Task<Result<TValue>>, string, params object[])

Asserts that the async result is a failure.

public static Task<AndWhichConstraint<ResultAssertions<TValue>, Error>> BeFailureAsync<TValue>(this Task<Result<TValue>> resultTask, string because = "", params object[] becauseArgs)

Parameters

resultTask Task<Result<TValue>>

The task containing the result.

because string

A formatted phrase explaining why the assertion is needed.

becauseArgs object[]

Zero or more objects to format using the placeholders.

Returns

Task<AndWhichConstraint<ResultAssertions<TValue>, Error>>

An AndWhich constraint for method chaining with the error.

Type Parameters

TValue

The type of the result value.

BeFailureAsync<TValue>(ValueTask<Result<TValue>>, string, params object[])

Asserts that the async ValueTask result is a failure.

public static ValueTask<AndWhichConstraint<ResultAssertions<TValue>, Error>> BeFailureAsync<TValue>(this ValueTask<Result<TValue>> resultTask, string because = "", params object[] becauseArgs)

Parameters

resultTask ValueTask<Result<TValue>>

The ValueTask containing the result.

because string

A formatted phrase explaining why the assertion is needed.

becauseArgs object[]

Zero or more objects to format using the placeholders.

Returns

ValueTask<AndWhichConstraint<ResultAssertions<TValue>, Error>>

An AndWhich constraint for method chaining with the error.

Type Parameters

TValue

The type of the result value.

BeFailureOfTypeAsync<TValue, TError>(Task<Result<TValue>>, string, params object[])

Asserts that the async result is a failure of a specific error type.

public static Task<AndWhichConstraint<ResultAssertions<TValue>, TError>> BeFailureOfTypeAsync<TValue, TError>(this Task<Result<TValue>> resultTask, string because = "", params object[] becauseArgs) where TError : Error

Parameters

resultTask Task<Result<TValue>>

The task containing the result.

because string

A formatted phrase explaining why the assertion is needed.

becauseArgs object[]

Zero or more objects to format using the placeholders.

Returns

Task<AndWhichConstraint<ResultAssertions<TValue>, TError>>

An AndWhich constraint for method chaining with the typed error.

Type Parameters

TValue

The type of the result value.

TError

The expected error type.

BeFailureOfTypeAsync<TValue, TError>(ValueTask<Result<TValue>>, string, params object[])

Asserts that the async ValueTask result is a failure of a specific error type.

public static ValueTask<AndWhichConstraint<ResultAssertions<TValue>, TError>> BeFailureOfTypeAsync<TValue, TError>(this ValueTask<Result<TValue>> resultTask, string because = "", params object[] becauseArgs) where TError : Error

Parameters

resultTask ValueTask<Result<TValue>>

The ValueTask containing the result.

because string

A formatted phrase explaining why the assertion is needed.

becauseArgs object[]

Zero or more objects to format using the placeholders.

Returns

ValueTask<AndWhichConstraint<ResultAssertions<TValue>, TError>>

An AndWhich constraint for method chaining with the typed error.

Type Parameters

TValue

The type of the result value.

TError

The expected error type.

BeSuccessAsync<TValue>(Task<Result<TValue>>, string, params object[])

Asserts that the async result is a success.

public static Task<AndWhichConstraint<ResultAssertions<TValue>, TValue>> BeSuccessAsync<TValue>(this Task<Result<TValue>> resultTask, string because = "", params object[] becauseArgs)

Parameters

resultTask Task<Result<TValue>>

The task containing the result.

because string

A formatted phrase explaining why the assertion is needed.

becauseArgs object[]

Zero or more objects to format using the placeholders.

Returns

Task<AndWhichConstraint<ResultAssertions<TValue>, TValue>>

An AndWhich constraint for method chaining with the success value.

Type Parameters

TValue

The type of the result value.

BeSuccessAsync<TValue>(ValueTask<Result<TValue>>, string, params object[])

Asserts that the async ValueTask result is a success.

public static ValueTask<AndWhichConstraint<ResultAssertions<TValue>, TValue>> BeSuccessAsync<TValue>(this ValueTask<Result<TValue>> resultTask, string because = "", params object[] becauseArgs)

Parameters

resultTask ValueTask<Result<TValue>>

The ValueTask containing the result.

because string

A formatted phrase explaining why the assertion is needed.

becauseArgs object[]

Zero or more objects to format using the placeholders.

Returns

ValueTask<AndWhichConstraint<ResultAssertions<TValue>, TValue>>

An AndWhich constraint for method chaining with the success value.

Type Parameters

TValue

The type of the result value.