| SmartTestErrorCaseTParam, T Method (ExpressionFuncTParam, INumericTypeT, T) |
Creates an instance of
Case class for a specific parameter path.
Namespace:
SmartTests
Assembly:
SmartTests (in SmartTests.dll) Version: 1.12.0
Syntax public static Case ErrorCase<TParam, T>(
Expression<Func<TParam, INumericType<T>>> path,
out T value
)
where T : Object, IComparable<T>
Public Shared Function ErrorCase(Of TParam, T As {Object, IComparable(Of T)}) (
path As Expression(Of Func(Of TParam, INumericType(Of T))),
<OutAttribute> ByRef value As T
) As Case
public:
generic<typename TParam, typename T>
where T : Object, IComparable<T>
static Case^ ErrorCase(
Expression<Func<TParam, INumericType<T>^>^>^ path,
[OutAttribute] T% value
)
static member ErrorCase :
path : Expression<Func<'TParam, INumericType<'T>>> *
value : 'T byref -> Case when 'T : Object and IComparable<'T>
Parameters
- path
- Type: System.Linq.ExpressionsExpressionFuncTParam, INumericTypeT
An Expression of the path and the criteria for the parameter of the method to test. - value
- Type: T
One random value from the provided values in the equivalence class.
Type Parameters
- TParam
- The type of the parameter of the method to test.
- T
- The type of the parameter
Return Value
Type:
CaseThe newly created
Case.
Remarks Warning: Not all lambda can be used.
It has to have 2 constraints:
- Valid Parameter Name -
- Valid Parameter Type -
- Valid Path -
Examples static class IntHelper
{
public static double Inverse(int n) => 1 / n;
}
...
[Test]
public void IntTest()
{
Assert.Throws<DivideByZeroException>, () => RunTest( ErrorCase( (int n) => n.Value( 0 ), out var value ),
() => IntHelper.Inverse( value ) ));
}
See Also