-
Course
- Core Tech
Mocking with Moq 4 and NUnit
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 is a mocking library for .NET that makes it easy to create mock objects and make writing unit tests easier.
What you'll learn
Writing effective unit tests can be tricky when dependencies between classes make it hard to separate what's being tested from the rest of the system. In this course, Mocking with Moq 4 and NUnit, you will gain the ability to easily isolate parts of your codebase for testing purposes. First, you will learn how to substitute real dependencies for mock objects. Next, you will discover how to configure mocked methods, properties, exceptions, and events. Finally, you will explore how to create behavior-based tests and also how to create partial mocks from existing classes. When you’re finished with this course, you will have the skills and knowledge of mocking with Moq needed to create automated tests that use mock objects.
Table of contents
- Version Check | 15s
- Introduction | 3m 15s
- Demo Code Overview | 3m 55s
- Writing a Test without Mocks | 3m 39s
- Installing Moq and Creating Your First Mock Object | 3m 22s
- Creating a Second Test | 2m 49s
- An Overview of Mocking | 1m 7s
- Why Mock? | 2m 42s
- What Is a Unit? | 1m 14s
- Fakes, Dummies, Stubs, and Mocks | 2m 26s
- An Overview of Moq | 46s
- Summary | 1m 47s
About the author
With over 15 years experience, Jason Roberts is a Microsoft .NET MVP, freelance developer, and author.
More Courses by Jason