SmartTestRunTestT Method (Criteria, ExpressionFuncActContext, T, Assertion) |
Namespace: SmartTests
public static T RunTest<T>( Criteria cases, Expression<Func<ActContext, T>> act, params Assertion[] assertions )
Exception | Condition |
---|---|
SmartTestException | In case a Smart Assertion fails after the act. |
BadTestException | In case a Smart Assertion fails before the act. |
In this example, the WaitContextHandle(SmartAssertPlaceHolder, Double) 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( 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. }