
Learn how to write effective unit tests with MSTest, understand the importance of unit testing for beginners and developers, and prepare for interviews with practical techniques to test software automatically.
Run unit tests in Visual Studio, including single, selected, and all tests. Use Test Explorer and enable auto run after build.
Group unit tests in the Visual Studio Test Explorer using playlists and built-in traits like category, property, priority, owner; manage dot playlist XML files to run or remove tests.
Analyze code coverage to see how tests cover the divide method in the calculator library. Recognize that 100% coverage may not guarantee meaningful tests; exclude from code coverage attribute.
Learn how TestClass and TestMethod attributes enable Visual Studio to discover MSTest unit tests, and how duplicates or missing attributes cause compilation or discovery errors.
Discover how an ordered test acts as a container for unit tests to guarantee a specific execution order, and learn how to add, arrange, run, and handle failures.
Learn to implement data driven unit tests using a SQL Server data source, validating an employee's email with a regex, and accessing test data via test context.
drive an MSTest unit test from an XML data source by adding employees.xml, configuring the data source for XML, and ensuring valid email data.
Learn to use CollectionAssert.AreEqual with a custom IComparer to compare two customer objects by name, implementing a three-parameter overload and handling nulls in MSTest unit tests.
Explore how CollectionAssert.AreEquivalent differs from AreEqual by validating that two collections have the same elements regardless of order, with practical unit tests and customizable assertion messages.
Test-driven development (TDD) produces clean, simplified code by focusing on requirements and small single-purpose classes, increasing code coverage and confidence as failing tests flag breaking changes early and prevent bugs.
What is the course about : This course is all about writing effective unit tests using C# programming language and MSTest framework. Along the way we will learn the concepts related to unit testing. Most organisations these days expect it's employees to have unit testing skills, as unit testing is becoming more and more important for the quality of the software applications.
How long is the course : The course is around 4 hours. All are video lectures. You will be able to download all the slides and code samples used in the course.
What will we be covering : We will start with, what is a unit test and we will write our first unit test, followed by benefits of unit tests. and unit test naming conventions.
We will also cover running, debugging, auto generating unit tests, grouping unit tests in visual studio, unit test traits, filtering, playlists, code coverage in visual studio, unit testing exceptions, unit testing private methods, visual studio ordered test, visual studio generic test, unit testing assertions and running unit tests from command line
The following visual studio unit testing attributes are discussed with examples