| WaitAssertionsWaitContextHandle Method (SmartAssertPlaceHolder, 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 WaitContextHandle(
this SmartAssertPlaceHolder _,
TimeSpan timeout
)
<ExtensionAttribute>
Public Shared Function WaitContextHandle (
_ As SmartAssertPlaceHolder,
timeout As TimeSpan
) As Assertion
public:
[ExtensionAttribute]
static Assertion^ WaitContextHandle(
SmartAssertPlaceHolder^ _,
TimeSpan timeout
)
[<ExtensionAttribute>]
static member WaitContextHandle :
_ : SmartAssertPlaceHolder *
timeout : TimeSpan -> Assertion
Parameters
- _
- Type: SmartTestsSmartAssertPlaceHolder
The dummy place holder for all Smart Assertions. - 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 WaitContextHandle wait for the implicit wait handle set by
SetHandle(ActContext).
[Test]
public void MyMethodTest()
{
var mc = new MyClass(300);
RunTest( AnyValue.IsValid,
ctx => mc.Method( ctx.SetHandle ),
SmartAssert.Within( 100 ),
SmartAssert.WaitContextHandle( TimeSpan.FromSeconds( 1 ) ) );
Assert.IsTrue( mc.Done );
Assert.IsNull( mc.Exception );
}
See Also