Create and run unit tests
Create unit tests and run them frequently to make sure your code is working properly.
Create a unit test
Create a unit test project.
Name the project.
The project has now been added to your solution.
In the unit test project, add a reference to the project you want to test.
Select the project that contains the code you'll test.
Code your unit test.
Run unit tests
Open the test explorer.
Run unit tests.
You can see the unit tests that passed or failed in the test explorer.
Q&A
Q:Can I run unit tests in Visual Studio if I use a different unit test framework?
A:Yes. Use the plug-in for that framework so that Visual Studio's test runner can work with that framework. Here are the unit testing framework plug-ins for Visual Studio that are available right now.
Use Visual Studio's extension manager to download your plug-in.
Download your plug-in from the Visual Studio Gallery under Tools/Testing, or search for it if you know the name.
Create a class library project.
Add the project to your solution.
In the class library project, run NuGet to install the plug-in.
NuGet is an extension of Visual Studio that you can use to add and update libraries and tools for your projects.
Install your plug-in. If you know the name, you can search for it online.
The framework is referenced in your project.
In the class library project, add a reference to the project you want to test.
Select the project that contains the code you'll test.
Code your unit test.
Try this next
False