Table of Contents

Class ErrorExceptionFluentAssertions

Namespace
OneImlx.Test.FluentAssertions
Assembly
OneImlx.Test.dll

Extension methods for asserting expected properties on ErrorException instances.

public static class ErrorExceptionFluentAssertions
Inheritance
ErrorExceptionFluentAssertions
Inherited Members

Methods

WithErrorCode<TException>(ExceptionAssertions<TException>, string, string, params object[])

Asserts that a thrown ErrorException contains a specific error code.

public static ExceptionAssertions<TException> WithErrorCode<TException>(this ExceptionAssertions<TException> assertions, string expectedErrorCode, string because = "", params object[] becauseArgs) where TException : Exception

Parameters

assertions ExceptionAssertions<TException>

The Fluent Assertions object which holds the exception.

expectedErrorCode string

The expected error code that the exception should contain.

because string

A formatted phrase as a reason for the expected error code. This parameter can be used to provide a more detailed explanation of the assertion, improving the readability and maintainability of test code.

becauseArgs object[]

An array of objects to format the because phrase. This allows for dynamic messages in the assertion failure output, making it clearer why the assertion failed.

Returns

ExceptionAssertions<TException>

The original ExceptionAssertions<TException> object, allowing for method chaining with other assertions.

Type Parameters

TException

The type of the exception that is expected to be thrown. This must be ErrorException or a derived class.

WithErrorCode<TException>(Task<ExceptionAssertions<TException>>, string, string, params object[])

Asserts that a thrown ErrorException has a specific error code. This method should be used after an asynchronous operation that is expected to throw an exception.

public static Task<ExceptionAssertions<TException>> WithErrorCode<TException>(this Task<ExceptionAssertions<TException>> task, string expectedErrorCode, string because = "", params object[] becauseArgs) where TException : ErrorException

Parameters

task Task<ExceptionAssertions<TException>>

The task resulting from the asynchronous operation.

expectedErrorCode string

The expected error code.

because string

A formatted phrase explaining why the assertion should be satisfied.

becauseArgs object[]

Zero or more values to use for filling in any gaps in the because phrase.

Returns

Task<ExceptionAssertions<TException>>

A continuation object for method chaining.

Type Parameters

TException

WithErrorDescription<TException>(ExceptionAssertions<TException>, string, string, params object[])

Asserts that a thrown ErrorException contains a specific error description.

public static ExceptionAssertions<TException> WithErrorDescription<TException>(this ExceptionAssertions<TException> assertions, string expectedErrorDescription, string because = "", params object[] becauseArgs) where TException : ErrorException

Parameters

assertions ExceptionAssertions<TException>

The Fluent Assertions object which holds the exception.

expectedErrorDescription string

The expected error code that the exception should contain.

because string

A formatted phrase as a reason for the expected error code. This parameter can be used to provide a more detailed explanation of the assertion, improving the readability and maintainability of test code.

becauseArgs object[]

An array of objects to format the because phrase. This allows for dynamic messages in the assertion failure output, making it clearer why the assertion failed.

Returns

ExceptionAssertions<TException>

The original ExceptionAssertions<TException> object, allowing for method chaining with other assertions.

Type Parameters

TException

The type of the exception that is expected to be thrown. This must be ErrorException or a derived class.

WithErrorDescription<TException>(Task<ExceptionAssertions<TException>>, string, string, params object[])

Asserts that a thrown ErrorException has a specific error description. This method should be used after an asynchronous operation that is expected to throw an exception.

public static Task<ExceptionAssertions<TException>> WithErrorDescription<TException>(this Task<ExceptionAssertions<TException>> task, string expectedErrorDescription, string because = "", params object[] becauseArgs) where TException : ErrorException

Parameters

task Task<ExceptionAssertions<TException>>

The task resulting from the asynchronous operation.

expectedErrorDescription string

The expected error description.

because string

A formatted phrase explaining why the assertion should be satisfied.

becauseArgs object[]

Zero or more values to use for filling in any gaps in the because phrase.

Returns

Task<ExceptionAssertions<TException>>

A continuation object for method chaining.

Type Parameters

TException

WithError<TException>(ExceptionAssertions<TException>, Error, string, params object[])

Asserts that a thrown ErrorException has a specific error description. This method should be used after an asynchronous operation that is expected to throw an exception.

public static ExceptionAssertions<TException> WithError<TException>(this ExceptionAssertions<TException> exceptionAssertions, Error expectedError, string because = "", params object[] becauseArgs) where TException : ErrorException

Parameters

exceptionAssertions ExceptionAssertions<TException>

The task operation.

expectedError Error

The expected error.

because string

A formatted phrase explaining why the assertion should be satisfied.

becauseArgs object[]

Zero or more values to use for filling in any gaps in the because phrase.

Returns

ExceptionAssertions<TException>

A continuation object for method chaining.

Type Parameters

TException

WithError<TException>(Task<ExceptionAssertions<TException>>, Error, string, params object[])

Asserts that a thrown ErrorException has a specific error description. This method should be used after an asynchronous operation that is expected to throw an exception.

public static Task<ExceptionAssertions<TException>> WithError<TException>(this Task<ExceptionAssertions<TException>> task, Error expectedError, string because = "", params object[] becauseArgs) where TException : ErrorException

Parameters

task Task<ExceptionAssertions<TException>>

The task resulting from the asynchronous operation.

expectedError Error

The expected error.

because string

A formatted phrase explaining why the assertion should be satisfied.

becauseArgs object[]

Zero or more values to use for filling in any gaps in the because phrase.

Returns

Task<ExceptionAssertions<TException>>

A continuation object for method chaining.

Type Parameters

TException