Search code examples
pex

How do I run Pex against a single class?


I have an existing assembly that contains hundreds of classes. I'd like to run Pex against one class at a time but I can't figure out a way to do so. Any help in this regard would be greatly appreciated...


Solution

  • I tend to use the Unit Test Wizard that is built into the visual studio test tools to create a test for me for a particular class and methods when i want to do this. (Tests->New Test -> choose unit test wizard)

    All a test class is is a class that has the [TestClass] attribute ... if you want a pex class just add the [PexClass] attribute.

    Then you add your parameterized unit tests using the [PexMethod] attribute, it will generate tests wit the [TestMethod] attribute for you.