- Course
Mocking with Moq 4 and xUnit
Writing unit tests is hard when dependencies between classes make it tough to separate what's being tested from the rest of the system. Moq, the most popular mocking library for .NET, makes it easy to create mock dependencies to make testing easier.
- Course
Mocking with Moq 4 and xUnit
Writing unit tests is hard when dependencies between classes make it tough to separate what's being tested from the rest of the system. Moq, the most popular mocking library for .NET, makes it easy to create mock dependencies to make testing easier.
Get started today
Access this course and other top-rated tech content with one of our business plans.
Try this course for free
Access this course and other top-rated tech content with one of our individual plans.
This course is included in the libraries shown below:
- Core Tech
What you'll learn
Writing unit tests can be difficult, time-consuming, and slow when you can't isolate the classes you want to test from the rest of the system. In this course,Mocking with Moq 4 and xUnit, you'll learn how to create mocks and use them as dependencies to the classes you want to test. First, you'll discover how to configure mocked methods and properties to return specific values. Next, you'll learn how to perform behavior/interaction testing to check your classes are interacting correctly with their dependencies. Finally, you'll explore how to setup mock exceptions, mock events, and use additional mocking techniques. When you're finished with this course, you'll have the necessary knowledge to use Moq to unit test your classes in isolation by creating and using mock objects.
Mocking with Moq 4 and xUnit
-
Version Check | 15s
-
Introduction | 2m 18s
-
An Overview of Mocking | 1m 9s
-
Why Use Mock Objects? | 2m 24s
-
What Is a Unit? | 2m 5s
-
Fakes, Dummies, Stubs, Mocks, and Test Doubles | 1m 51s
-
An Overview of Moq | 58s
-
Demo Code Overview | 2m 29s
-
Adding a Unit Test Project | 1m 39s
-
Writing Initial Tests | 2m 50s
-
Introducing a New Dependency | 3m 15s
-
Summary | 1m 19s