Code coverage is a feature that allows you to see which parts of the code are covered by the tests and which ones are not. This is very useful to see if the tests that have been written cover all the required cases. Indeed, it's sometimes hard to figure out all the branches that should be tested.
So let's see how to enable this feature in Visual Studio 2010. Of course, you have to create a test project (I assume everyone knows how to do it). Then you must edit the test configuration file (local.testsettings). To do this, simply double-click on it.
Then go to the Data and Diagnostics category:
Select Code Coverage:
Now after running your tests, you can see the result of the Coverage Code either in the result window or directly in the code. Visual Studio highlights the tested lines in green, the untested lines in red and the partially tested lines in orange.