Some more on Pex
I had a look at the ListDictionaryFixture in the Prism.Tests project. And I set my eyes on these three TestMethods and decided to see how Pex could work here.
So first I referenced the Microsoft.Pex.Framework Assembly. Then I created a parameterized PexMethod.
And then I ran Pex.
My first result was not quite what I expected:
I would have expected at least three tests to be run by Pex, so first I check the Uninstrumented Method.
If you right-click and select Instrument assembly Pex goes and adds a PexAssemblyInfo.cs file to your project
and places the following inside the file:
Right, so let's run Pex again. After Pex has run it shows me the following result:
This is what I expected. Now I want to fix the failed Run 1 and 2. If you look at the generated test you see that it does not say what the ExpectedException should be:
To get Pex to generate the tests correctly you need to either Fix It or Allow It by right clicking on the row:
I chose to Allow It and then it adds another entry into the PexAssemblyInfo.cs file.
And then I reran Pex, and there you go I replaced three Unit Tests with one PexMethod.