Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

PexChoose Class

 

Static class which supplies auxiliary input values to a test, which can be used to implement Parameterized Mocks.

The PexChoose class does not help in determining whether a test passes for particular input values, or fails.
PexChoose simply provides input values, which we also call choices. It is still up to the user to restrict the input values, and to write assertions to define when a test passes or fails.)

Namespace:   Microsoft.Pex.Framework
Assembly:  Microsoft.Pex.Framework (in Microsoft.Pex.Framework.dll)

System::Object
  Microsoft.Pex.Framework::PexChoose

[__InstrumentAttribute]
public ref class PexChoose abstract sealed 

The PexChoose class can operate in two modes:

  • While Pex is performing a symbolic analysis of the test and the tested code during Input Generation, the chooser returns arbitrary values, and Pex tracks how the value is used in the test and the tested code. Pex will generate relevant values to trigger different execution paths in the test and the tested code.

  • The generated code for particular test cases sets up the choice provider in a specific way, so that the reexecution of such a test case will make particular choices to trigger a particular execution path.

  • Simple call PexChoose.Value<T> to a new value from Pex.

    public int Foo() {
        return PexChoose.Value<int>("foo");
    }
    
    

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

Return to top
Show: