| ThrowAssertionsThrowT Method (SmartAssertPlaceHolder, ActionT) |
Creates an
Assertion that ensure the provided exception type is thrown.
Namespace:
SmartTests.Assertions
Assembly:
SmartTests (in SmartTests.dll) Version: 1.12.0
Syntax public static Assertion Throw<T>(
this SmartAssertPlaceHolder _,
Action<T> verify = null
)
where T : Exception
<ExtensionAttribute>
Public Shared Function Throw(Of T As Exception) (
_ As SmartAssertPlaceHolder,
Optional verify As Action(Of T) = Nothing
) As Assertion
public:
[ExtensionAttribute]
generic<typename T>
where T : Exception
static Assertion^ Throw(
SmartAssertPlaceHolder^ _,
Action<T>^ verify = nullptr
)
[<ExtensionAttribute>]
static member Throw :
_ : SmartAssertPlaceHolder *
?verify : Action<'T>
(* Defaults:
let _verify = defaultArg verify null
*)
-> Assertion when 'T : Exception
Parameters
- _
- Type: SmartTestsSmartAssertPlaceHolder
The dummy place holder for all Smart Assertions. - 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