Verifies that a block of code does not throw an exception of any type.
Namespace:
MbUnit.FrameworkAssembly: MbUnit (in MbUnit.dll) Version: 3.3.0.0 (3.3.459.0)
Syntax
| C# |
|---|
public static void DoesNotThrow( Action action, string messageFormat, params Object[] messageArgs ) |
| Visual Basic (Declaration) |
|---|
Public Shared Sub DoesNotThrow ( _ action As Action, _ messageFormat As String, _ ParamArray messageArgs As Object() _ ) |
Parameters
- action
- Type: Gallio.Common..::.Action
The action delegate to evaluate.
- messageFormat
- Type: System..::.String
The custom assertion message format, or null if none.
- messageArgs
- Type: array<
System..::.Object
>[]()[]
The custom assertion message arguments, or null if none.
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. |
