Click or drag to resize

ThrowAssertionsThrowT Method (SmartAssertPlaceHolder, String, ActionT)

Creates an Assertion that ensure the provided exception type is thrown for the parameterName parameter.

Namespace:  SmartTests.Assertions
Assembly:  SmartTests (in SmartTests.dll) Version: 1.12.0
Syntax
public static Assertion Throw<T>(
	this SmartAssertPlaceHolder _,
	string parameterName,
	Action<T> verify = null
)
where T : ArgumentException

Parameters

_
Type: SmartTestsSmartAssertPlaceHolder
The dummy place holder for all Smart Assertions.
parameterName
Type: SystemString
The name of the parameter for which the exception is thrown.
verify (Optional)
Type: SystemActionT
Code to add verifications on the exception.

Type Parameters

T
The expected exception type

Return Value

Type: Assertion
The newly created Assertion.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type SmartAssertPlaceHolder. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
Should be the first assertion.
See Also