Instantiating Existing Classes

What is the problem?

Pex monitors the executed instructions when it runs a test and the program-under-test. In particular, it monitors all field accesses. It then uses a constraint solver to determine new test inputs -- including objects and their field values -- such that the test and the program-under-test will behave in other interesting ways.

Thus, Pex needs to create objects of certain types set their field values.If the class is visible and has a visible default constructor, Pex can create an instance of the class.If all the fields of the class are visible, Pex can set the fields automatically.

If the type is not visible, or the fields are not visible, Pex needs help to create objects and bring them into interesting states to achieve maximal code coverage. (Pex could use reflection to create and initialize instances in arbitrary ways, but this is usually not desirable, since it might bring the object into a state which can never occur during a regular program execution. Instead, Pex relies on hints from the user to proceed.)