| 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
<ExtensionAttribute>
Public Shared Function Throw(Of T As ArgumentException) (
_ As SmartAssertPlaceHolder,
parameterName As String,
Optional verify As Action(Of T) = Nothing
) As Assertion
public:
[ExtensionAttribute]
generic<typename T>
where T : ArgumentException
static Assertion^ Throw(
SmartAssertPlaceHolder^ _,
String^ parameterName,
Action<T>^ verify = nullptr
)
[<ExtensionAttribute>]
static member Throw :
_ : SmartAssertPlaceHolder *
parameterName : string *
?verify : Action<'T>
(* Defaults:
let _verify = defaultArg verify null
*)
-> Assertion when '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:
AssertionThe 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