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
assertionsExceptionAssertions<TException>The Fluent Assertions object which holds the exception.
expectedErrorCodestringThe expected error code that the exception should contain.
becausestringA 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.
becauseArgsobject[]An array of objects to format the
becausephrase. 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
TExceptionThe 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
taskTask<ExceptionAssertions<TException>>The task resulting from the asynchronous operation.
expectedErrorCodestringThe expected error code.
becausestringA formatted phrase explaining why the assertion should be satisfied.
becauseArgsobject[]Zero or more values to use for filling in any gaps in the
becausephrase.
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
assertionsExceptionAssertions<TException>The Fluent Assertions object which holds the exception.
expectedErrorDescriptionstringThe expected error code that the exception should contain.
becausestringA 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.
becauseArgsobject[]An array of objects to format the
becausephrase. 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
TExceptionThe 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
taskTask<ExceptionAssertions<TException>>The task resulting from the asynchronous operation.
expectedErrorDescriptionstringThe expected error description.
becausestringA formatted phrase explaining why the assertion should be satisfied.
becauseArgsobject[]Zero or more values to use for filling in any gaps in the
becausephrase.
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
exceptionAssertionsExceptionAssertions<TException>The task operation.
expectedErrorErrorThe expected error.
becausestringA formatted phrase explaining why the assertion should be satisfied.
becauseArgsobject[]Zero or more values to use for filling in any gaps in the
becausephrase.
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
taskTask<ExceptionAssertions<TException>>The task resulting from the asynchronous operation.
expectedErrorErrorThe expected error.
becausestringA formatted phrase explaining why the assertion should be satisfied.
becauseArgsobject[]Zero or more values to use for filling in any gaps in the
becausephrase.
Returns
- Task<ExceptionAssertions<TException>>
A continuation object for method chaining.
Type Parameters
TException