| RaiseAssertionsNotRaised Method (SmartAssertPlaceHolder, Object, String) |
Creates an
Assertion that ensure an standard event is not raised in the Act part of your test.
Namespace:
SmartTests.Assertions
Assembly:
SmartTests (in SmartTests.dll) Version: 1.12.0
Syntax public static Assertion NotRaised(
this SmartAssertPlaceHolder _,
Object instance,
string eventName
)
<ExtensionAttribute>
Public Shared Function NotRaised (
_ As SmartAssertPlaceHolder,
instance As Object,
eventName As String
) As Assertion
public:
[ExtensionAttribute]
static Assertion^ NotRaised(
SmartAssertPlaceHolder^ _,
Object^ instance,
String^ eventName
)
[<ExtensionAttribute>]
static member NotRaised :
_ : SmartAssertPlaceHolder *
instance : Object *
eventName : string -> Assertion
Parameters
- _
- Type: SmartTestsSmartAssertPlaceHolder
The dummy place holder for all Smart Assertions. - instance
- Type: SystemObject
The instance for which the event should not raise. - eventName
- Type: SystemString
The name of the event that should not raise.
Return Value
Type:
AssertionThe newly created
Assertion.
Usage Note
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).
Exceptions Remarks Examples
In this example, the Smart Assertion verifies that the
MyEvent event is not raised for
mc.
[Test]
public void MyMethodTest()
{
var mc = new MyClass();
RunTest( ValidValue.IsValid,
() => mc.MyMethod(),
SmartAssert.NotRaised( mc.InnerObject, "MyEvent" ) );
}
See Also