Verifies that a block of code does not throw an exception of any type.
Namespace:
MbUnit.FrameworkAssembly: MbUnit (in MbUnit.dll) Version: 3.2.0.0 (3.2.581.0)
Syntax
| C# |
|---|
public static void DoesNotThrow( Action action ) |
| Visual Basic (Declaration) |
|---|
Public Shared Sub DoesNotThrow ( _ action As Action _ ) |
Parameters
- action
- Type: Gallio.Common..::.Action
The action delegate to evaluate.
Remarks
The purpose of this assertion is to improve the readability of tests that only verify that an exception was not thrown. Using this assertion makes a positive and explicit statement that not throwing an exception is itself the primary behavior that is being verified.
Exceptions
| Exception | Condition |
|---|---|
| System..::.ArgumentNullException | Thrown if action is null. |
| Gallio.Framework.Assertions..::.AssertionException | Thrown if the verification failed unless the current AssertionFailureBehavior indicates otherwise. |
