Summary
The Moq framework, when used together with the xUnit.net framework, can deliver a smooth unit testing experience and make the overall TDD process worthwhile. Moq provides powerful features that, when used effectively, can simplify the creation of dependencies mocking for unit tests.
Mock objects created with Moq can allow you to substitute the concrete dependencies in your unit tests for the created mocks created by you in order to isolate different units in your code for testing and subsequent refactoring, which can facilitate crafting elegant production-ready code. Also, you can use mock objects to experiment and test features available in dependencies that otherwise might not be easily done by using the live dependencies.
In this ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access