Skip to content

ActionAssertions Class ​

Definition ​

Provides assertions for actions, such as verifying that exceptions are thrown.

c#
public sealed class ActionAssertions

View source

Constructors ​

NameDescription
ActionAssertions(Action)Provides assertions for actions, such as verifying that exceptions are thrown.

Methods ​

NameDescription
NotThrow()Asserts that the action does not throw any exception.
Throw<TException>()Asserts that the action throws an exception of the specified type.
Throw<TException>(String)Asserts that the action throws an exception of the specified type with the specified message.
Throw<TException>(String, Exception)Asserts that the action throws an exception of the specified type with the specified message and inner exception.
Throw<TException>(TException)Asserts that the action throws the exact specified exception instance.
ThrowArgumentException(String, String)Asserts that the action throws an ArgumentException with the specified message and parameter name.
ThrowArgumentOutOfRangeException(String, String, Object)Asserts that the action throws an ArgumentOutOfRangeException with the specified message, parameter name and actual value.