Implementing C# 10 Unit Testing Using Visual Studio 2022 and .NET 6
This course will teach you how to get started creating unit tests using C# and Visual Studio 2022 to improve the quality of your applications.
What you'll learn
Every developer needs to test code, or have it tested by someone. This is where unit testing can help. In this course, Implementing C# 10 Unit Testing Using Visual Studio 2022 and .NET 6 you’ll learn to create unit tests using MSTest and Visual Studio. First, you’ll explore why unit testing is an important part of the software development process. Next, you’ll discover how to build your first unit tests and run them using Visual Studio. Next, you'll apply best practices to avoid hard-coding, initialize and clean up, and to organize unit tests. Then, you'll explore the various Assert classes for working with different data sets. After that, you’ll see how to consolidate tests by making them data-driven. Finally, you’ll learn how to automate your tests by running them from a command line. When you’re finished with this course, you’ll have the skills and knowledge to create unit tests that will improve the quality of your code and make testing quicker.
Table of contents
- Use a Constants Class Instead of Hard-Coding 3m
- Output Messages Using the TestContext Property 4m
- Create a .runsettings File to Hold Test Parameters 3m
- Using the .runsettings File in Unit Test Classes 3m
- Create and Delete a File to Test 3m
- Log Test Results into TRX and HTML Files 4m
- Create a TestBase Class for Common Functionality 5m
- Add an OutputMessage Property to TestBase 3m
- Adding Your Own Failure Message 3m
- Using AreEqual() and AreNotEqual() 3m
- Adding Person, Employee and Supervisor Classes 2m
- Checking Object Types with AreSame() and AreNotSame() 2m
- Using IsInstanceTypeOf(), IsNull() and IsNotNull() 3m
- Using the StringAssert Class Methods 3m
- Using the CollectionAssert Class AreEqual() and AreNotEqual() Methods 4m
- Using the AreEquivalent() and AreEqual() with a Comparer Method 4m
- Using the AllItemsAreInstanceOfType() Method 1m