Click or drag to resize

SmartTestCaseTParam, T Method (ExpressionFuncTParam, INumericTypeT, T, T)

Creates an instance of Case class for a specific parameter path.

Namespace:  SmartTests
Assembly:  SmartTests (in SmartTests.dll) Version: 1.12.0
public static Case Case<TParam, T>(
	Expression<Func<TParam, INumericType<T>>> path,
	out T value,
	params T[] avoidedValues
where T : Object, IComparable<T>


Type: System.Linq.ExpressionsExpressionFuncTParam, INumericTypeT
An Expression of the path and the criteria for the parameter of the method to test.
Type: T
One random value from the provided values in the equivalence class.
Type: T
A value to avoid in the range. For example, when testing a property setter with a different value, you do not want the value to be the current value, even if it is within the tested range.

Type Parameters

The type of the parameter of the method to test.
The type of the parameter

Return Value

Type: Case
The newly created Case.

Warning: Not all lambda can be used.

It has to have 2 constraints:

  1. Valid Parameter Name -
  2. Valid Parameter Type -
  3. Valid Path -
static class IntHelper
    public static double Inverse(int n) => 1 / n;


public void IntTest()
    var result = RunTest( Case( (int n) => n.Below( 0 ).Above( 0 ), out var value ),
                          () => IntHelper.Inverse( value ) );

    Assert.AreEqual( 1 / value, result );
See Also