Using Code Coverage to Determine How Much Code Is Being Tested
To determine what proportion of your project's code is actually being tested using unit tests, you can use the code coverage feature of Visual Studio Application Lifecycle Management. To do this, first edit the run configuration to indicate the assembly that contains the code whose coverage you want to measure. Then run tests on that code. Detailed code coverage statistics appear in a window, and you can also see, line-by-line, which code has been tested.
Configure code coverage: You can change certain aspects of the way code coverage data is gathered and displayed.
You can also configure code coverage for automated tests using test settings.
Determine your unit test code coverage results: After you configure code coverage for your project and run the unit tests on it, detailed code coverage statistics will appear in the Code Coverage Results window.