Koolitus
Moodul
C# testing in Visual Studio - Training
Start testing your C# apps by using the testing tools in Visual Studio. Learn to write tests, use Test Explorer, create test suites, and apply the red, green, refactor pattern to write code.
Seda brauserit enam ei toetata.
Uusimate funktsioonide, turbevärskenduste ja tehnilise toe kasutamiseks võtke kasutusele Microsoft Edge.
Unit tests often mirror the structure of the code under test. For example, a unit test project would be created for each code project in the product. The test project can be in the same solution as the production code, or it can be in a separate solution. You can have multiple unit test projects in a solution.
Märkus
The location of unit tests for native code and the test project structure can be different than the structure that's described in this article. For more information, see Writing unit tests for C/C++.
On the File menu, select New > Project, or press Ctrl+Shift+N.
On the Create a new project page, type unit test into the search box. Select the project template for the test framework that you want to use, for example MSTest Test Project or NUnit Test Project, and then select Next.
On the Configure your new project page, enter a name for your project, and then select Create.
In your unit test project, add a reference to the code under test. To add a reference to a code project in the same solution:
Select the test project in Solution Explorer.
On the Project menu, select Add Reference.
In Reference Manager, select the Solution node under Projects. Select the code project you want to test, and then select OK.
If the code that you want to test is in another location, see Managing references in a project for information about adding a reference.
Koolitus
Moodul
C# testing in Visual Studio - Training
Start testing your C# apps by using the testing tools in Visual Studio. Learn to write tests, use Test Explorer, create test suites, and apply the red, green, refactor pattern to write code.
Dokumentatsioon
Run unit tests by using Test Explorer - Visual Studio (Windows)
Learn how Visual Studio Test Explorer provides a flexible and efficient way to run your unit tests and view their results.
Get started with unit testing - Visual Studio (Windows)
Use Visual Studio to define and run unit tests to maintain code health, and to find errors and faults before your customers do.
Run Unit Tests with Test Explorer - Visual Studio (Windows)
Run tests by using Test Explorer in Visual Studio, enable automatic tests after build, view results, group and filter the test list, create playlists, and use shortcuts.