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