| SmartTestRunTestT Method (Case, ExpressionFuncActContext, T, Assertion) |
Executes the Act part of the test, and its related Smart Assertions, that involves implicit declarations for
Assertions.
Namespace:
SmartTests
Assembly:
SmartTests (in SmartTests.dll) Version: 1.12.0
Syntax public static T RunTest<T>(
Case cases,
Expression<Func<ActContext, T>> act,
params Assertion[] assertions
)
Public Shared Function RunTest(Of T) (
cases As Case,
act As Expression(Of Func(Of ActContext, T)),
ParamArray assertions As Assertion()
) As T
public:
generic<typename T>
static T RunTest(
Case^ cases,
Expression<Func<ActContext^, T>^>^ act,
... array<Assertion^>^ assertions
)
static member RunTest :
cases : Case *
act : Expression<Func<ActContext, 'T>> *
assertions : Assertion[] -> 'T
Parameters
- cases
- Type: SmartTestsCase
The Criteria expression for the tested expression. - act
- Type: System.Linq.ExpressionsExpressionFuncActContext, T
A lambda expression representing the tested expression with an ActContext. - assertions
- Type: SmartTestsAssertion
The Smart Assertions for this act.
Type Parameters
- T
- The Type of the expression in the Act part of the test.
Return Value
Type:
TThe value of the expression of the
act.
Exceptions Remarks
If you need to specify
Criteria expressions for multiple parameters, you have to use
RunTestT(Case, ExpressionFuncActContext, T, Assertion) instead.
Examples
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 );
var result = RunTest( AnyValue.IsValid,
ctx => mc.Method( ctx.SetHandle ),
SmartAssert.Within( 100 ),
SmartAssert.WaitContextHandle( 1000 ) );
Assert.IsTrue( result );
Assert.IsTrue( mc.Done );
Assert.IsNull( mc.Exception );
}
See Also Reference
SmartTestRunTestT(Case, ExpressionFuncActContext, T, Assertion)