Click or drag to resize

WaitAssertionsSetHandle Method

Sets the implicit wait handle of the ActContext.

Namespace:  SmartTests.Assertions
Assembly:  SmartTests (in SmartTests.dll) Version: 1.7.0
public static void SetHandle(
	this ActContext context


Type: SmartTestsActContext
The ActContext for which to set the implicit wait handle

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ActContext. 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).
BadTestException If the Wait assertion is not waiting the implicit wait handle ( WaitContextHandle(SmartAssertPlaceHolder, TimeSpan) nor WaitContextHandle(SmartAssertPlaceHolder, Double) is called).

In this example, the SetHandle set the implicit wait handle expected by the WaitContextHandle(SmartAssertPlaceHolder, Double) Smart Assertion call.

public void MyMethodTest()
  var mc = new MyClass(300);

  RunTest( AnyValue.IsValid,
           ctx => mc.Method( ctx.SetHandle ),
           SmartAssert.Within( 100 ),
           SmartAssert.WaitContextHandle( 1000 ) );

  Assert.IsTrue( mc.Done ); // The method runs the parallel code (ctx.SetHandle) to its end.
  Assert.IsNull( mc.Exception ); // There was no exception in the parallel code thread.
See Also