Steven Giesel 8/12/2023

Creating Your Own Fakes Instead of Using Mocking Libraries

Read Original

This technical article discusses unit testing in C#/.NET, advocating for writing custom fake objects (stubs/mocks) instead of using libraries like Moq or NSubstitute. It covers the benefits (no 3rd-party dependencies, transparency, flexibility), explains key terminology (fake, stub, mock, shim), and provides practical code examples for creating and using a fake service in a test scenario.

Creating Your Own Fakes Instead of Using Mocking Libraries

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week