MSTest - unit testing framework in

Microsoft visual studio provides the unit testing project template. You can easily create unit testing project in visual studio. Namespace "Microsoft.VisualStudio.TestTools.UnitTesting" provides the classes, attributes and namespaces required for unit testing framework. Assert class provides methods for assertions. Some of the most popular methods from Assert class are AreEqual, AreSame, IsNull, IsTrue, IsFalse, IsNotNull, AreNotEqual etc You can run the tests from within studio or you can also run from command line as well Instead of using old msbuild, mstest commands, Micorosoft has introduced new CLI tools that work on all platforms like windows, mac, linux etc. You can find more info at For example - if you want to build the solution, you can use below command

dotnet build

If you want to execute the tests, you can use below command

dotnet test

To filter the tests, you can use below command

dotnet test --filter TestCategory~sanity

You can also use logical & and | operators to filter the tests

dotnet test --filter "(Name~TestMethod1 | Name~TestMethod2)"

If you are using MSTest, you can use FullyQualifiedName, Name, ClassName, Priority and TestCategory to filter the tests. If you are using NUnit, you can use FullyQualifiedName, DisplayName and Traits to filter the tests
Complex problems, Simple Solutions