Usually more accustomed to do unit testing with NUnit, today found that vs comes with the actually very good, the following directly began to try hackers
1. Create Unit Test Project
Select the class, function, or classes you want to test as needed ...
As long as you click OK, vs will automatically generate a test class for you without having to hit the code yourself.
Here's what you need to test, modify the test function, the usual validation functions can refer to MSDN,
Http://msdn.microsoft.com/zh-cn/library/microsoft.visualstudio.testtools.unittesting.assert.aspx
2. Testing
Menus commonly used in: New, run Test, debug, editor, etc...
After the test function has been modified, you can execute the test, you can click "Test All" directly, or you can choose the function you want to test as well.
3. Test results
If the function does not pass the test, you can modify the function according to the error message
4, additional words
If you want to monitor the values of variables in the process like a debugger, you can also add a breakpoint to the test function and click Debug .... Test ";
If you have access to a configuration file or resource file in a function you are testing, you need to manually copy the configuration file to the test project.
Of course, there are many simple ways to implement the Internet, we can refer to the following
Http://www.cnblogs.com/kissazi2/archive/2013/03/15/2960661.html
Visual Studio 2010 comes with unit tests