Choice Class

Models non-determinism, and allows a rule to generate more than one step from a state.


Namespace: Microsoft.Modeling
Assembly: Microsoft.Xrt.Runtime (in Microsoft.Xrt.Runtime.dll)

'Usage

The following example uses the Some(Generic Predicate) method to model an action that returns a random integer from min through max.

[Rule(Action = "Rand(min,max)/result")]
public static int Rand(int min, int max)
{
    Condition.IsTrue(min <= max);
    return Choice.Some<int>(x => (x >= min && x <= max));
}

Non-determinism occurs when the system under test (SUT) can generate more than one correct response. The model can predict all acceptable responses but cannot predict which response the SUT will exhibit.

To identify the possible return values of a non-deterministic action, use the Some method to generate the return value of the associated rule. For more information about using the Choice class in a rule, see the Non-Determinism section in Actions.


System.Object
  Microsoft.Modeling.Choice

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Microsoft Windows 7, Microsoft Windows Vista, Microsoft Windows XP SP2 or later, Microsoft Windows Server 2008, Microsoft Windows Server 2003

 



Community Additions

ADD
Show: