| WaitAssertionsWait Method (SmartAssertPlaceHolder, WaitHandle, TimeSpan) |
Creates an
Assertion that ensure an asynchronous call from the Act is done before continuing Smart
Assertions validations.
Namespace:
SmartTests.Assertions
Assembly:
SmartTests (in SmartTests.dll) Version: 1.12.0
Syntax public static Assertion Wait(
this SmartAssertPlaceHolder _,
WaitHandle evt,
TimeSpan timeout
)
<ExtensionAttribute>
Public Shared Function Wait (
_ As SmartAssertPlaceHolder,
evt As WaitHandle,
timeout As TimeSpan
) As Assertion
public:
[ExtensionAttribute]
static Assertion^ Wait(
SmartAssertPlaceHolder^ _,
WaitHandle^ evt,
TimeSpan timeout
)
[<ExtensionAttribute>]
static member Wait :
_ : SmartAssertPlaceHolder *
evt : WaitHandle *
timeout : TimeSpan -> Assertion
Parameters
- _
- Type: SmartTestsSmartAssertPlaceHolder
The dummy place holder for all Smart Assertions. - evt
- Type: System.ThreadingWaitHandle
The WaitHandle to wait for before continuing Smart Assertions validations. - timeout
- Type: SystemTimeSpan
The maximum milliseconds to wait for the handle to be set.
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 Examples In this example, the Smart Assertion verifies that the MyMethod call launches a callback within 1s.
[Test]
public void MyMethodTest()
{
var mc = new MyClass();
var handle = new ManualResetEvent( false );
RunTest( ValidValue.IsValid,
() => mc.MyMethod( () => handle.set() ),
SmartAssert.Wait( handle, TimeSpan.FromSeconds( 1 ) ) );
}
See Also