From the course: Advanced ASP.NET Core: Unit Testing

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Understand the MSTest framework

Understand the MSTest framework - ASP.NET Core Tutorial

From the course: Advanced ASP.NET Core: Unit Testing

Start my 1-month free trial

Understand the MSTest framework

- [Instructor] MSTest is Microsoft's official unit testing framework, and it comes by default with Visual Studio 2005 and later. The main benefit of MSTest is that the unit tests written using this framework can be run directly from Visual Studio or by using the MSTest.exe from command line. But which are the main elements of MSTest? When you want to define a C# class as a unit testing class, you need to use the test class decorator. And inside this class you can have helper methods, which you don't want a unit test, for example, you want to return a list of data, and you can also have unit testing methods. To identify methods that contain unit testing code, you use the test method decorator. And inside this method, when you want to check for the result, you need to use the assert method. The assert method will test the condition or behavior against an expected result. The MSTest also offers initialization and cleanup…

Contents