Let's analyze code coverage in the DynamicViewModel project.
I currently work with Visual Studio 2010 Premium. This product comes with Code Coverage so I thought I should give it a try with, the unit testing tool I use, xUnit.net.
First of all, if you do a lot of unit testing, I suggest using the TestDriven.Net add-in for Visual Studio because it is fully integrated with xUnit.net (and many other unit testing tools).
Right-Click on the project under test, select Test With > Coverage:
The Code Coverage Results tab shows the % of Not Covered/Covered Blocks:
Using the object explorer we navigate to the methods that are not fully covered:
Right-Click on any method > Go to source code. This will navigates us to the target method:
In the target method we can now see the portion of the code that is not covered.
Here we can see that there are no unit tests covering the case for invalid property names when binding in the view model:
Let's add a unit test for that:
Again, Right-Click on the project under test, select Test With > Coverage:
That's it! Visual Studio 2010 Cove Coverage feature (on Premium and Ultimate products) plays nicely with TestDriven.Net and xUnit.net!