Tutorial by Examples

Open the C# project Right-click on the solution -> Add -> New Project… (Figure 1) Go to Installed -> Visual C# -> Test Click on Unit Test Project Give it a name and click OK (Figure 2) The unit test project is added to the solution (Figure 3) Adding the referen...
Method 1 Go to your unit test class in the unit test project Write a unit test [Testclass] public class UnitTest1 { [TestMethod] public void TestMethod1() { //Arrange ApplicationToTest.Calc ClassCalc = new ApplicationToTest.Calc(); int expectedResul...
To see you unit tests go to Test -> Windows -> Test Explorer (Figure 1) This will open an overview of all the tests in the application (Figure 2) In the figure above you can see that the example has one unit test and it hasn’t been run yet You can double-click on a tes...
To see you unit tests go to Test -> Windows -> Code Coverage Results (Figure 1) It will open the following window (Figure 2) The window is now empty Go to the Test menu -> Analyze Code Coverage (Figure 3) The tests will now be run as well (See the results in the T...

Page 1 of 1