[This is preliminary documentation and is subject to change.]
Specifies the exception to throw when the method is invoked.
Namespace:
MoqAssembly: Moq (in Moq)
Version: 1.5.2951.38938 (1.5.0.0)
Syntax
| C# |
|---|
void Throws( Exception exception ) |
Parameters
- exception
- Type: System..::.Exception
Exception instance to throw.
Examples
This example shows how to throw an exception when the method is
invoked with an empty string argument:
CopyC#
mock.Expect(x => x.Execute("")).Throws(new ArgumentException());