Featured resource
2026 Tech Forecast
2026 Tech Forecast

Stay ahead of what’s next in tech with predictions from 1,500+ business leaders, insiders, and Pluralsight Authors.

Get these insights
  • Course

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.

Intermediate
1h 53m
(106)

Created by Jason Roberts

Last Updated Mar 17, 2022

Course Thumbnail
  • Course

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.

Intermediate
1h 53m
(106)

Created by Jason Roberts

Last Updated Mar 17, 2022

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 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.

Mocking with Moq 4 and NUnit
Intermediate
1h 53m
(106)
Table of contents

About the author
Jason Roberts - Pluralsight course - Mocking with Moq 4 and NUnit
Jason Roberts
71 courses 4.4 author rating 10721 ratings

With over 15 years experience, Jason Roberts is a Microsoft .NET MVP, freelance developer, and author.

Get started with Pluralsight