RaiseAssertionsNotRaised Method (SmartAssertPlaceHolder, String)
Creates an Assertion
that ensure an standard event is not raised in the Act part of your test.
SmartTests (in SmartTests.dll) Version: 1.10.0
public static Assertion NotRaised(
this SmartAssertPlaceHolder this,
Public Shared Function NotRaised (
this As SmartAssertPlaceHolder,
eventName As String
) As Assertion
static Assertion^ NotRaised(
static member NotRaised :
this : SmartAssertPlaceHolder *
eventName : string -> Assertion
- Type: SmartTestsSmartAssertPlaceHolder
The dummy place holder for all Smart Assertions.
- Type: SystemString
The name of the event that should not raise.
The newly created Assertion
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)
- Before the Act -
The eventName exists in the type of the involved instance of the Act;
otherwise a BadTestException is thrown.
- After the Act -
If the event was raised, a SmartTestException is thrown.
In this example, the Smart Assertion verifies that the MyEvent
event is not raised for mc
public void MyMethodTest()
var mc = new MyClass();
() => mc.MyMethod(),
SmartAssert.NotRaised( "MyEvent" ) );