

moq
Moq is the only mocking library for .NET developed from scratch to take full advantage of .NET Linq expression trees and lambda expressions, which makes it the most productive, type-safe and refactoring-friendly mocking library available.
Cost / License
- Free
- Open Source
Platforms
- Windows
- .NET Framework
- Microsoft Visual Studio
Features
Properties
- Minimalistic
Features
- Code Completion
- NET Framework
Visual Studio integration
Tags
- mocking
- mocking-library
moq News & Activities
Recent News
- Maoholguin published news article about moq
Moq's controversial integration of SponsorLink sparks privacy concerns in Open Source communityThe open source project, moq, has been criticized for including a contentious dependency, SponsorLi...
Recent activities
moq information
What is moq?
Moq is the only mocking library for .NET developed from scratch to take full advantage of .NET Linq expression trees and lambda expressions, which makes it the most productive, type-safe and refactoring-friendly mocking library available. And it supports mocking interfaces as well as classes. Its API is extremely simple and straightforward, and doesn't require any prior knowledge or experience with mocking concepts.
Moq offers the following features:
- Strong-typed: no strings for expectations, no object-typed return values or constraints
- Unsurpassed VS IntelliSense integration: everything supports full VS IntelliSense, from setting expectations, to - specifying method call arguments, return values, etc.
- No Record/Replay idioms to learn. Just construct your mock, set it up, use it and optionally verify calls to it (you may not verify mocks when they act as stubs only, or when you are doing more classic state-based testing by checking returned values from the object under test)
- VERY low learning curve as a consequence of the previous three points. For the most part, you don't even need to ever read the documentation.
- Granular control over mock behavior with a simple MockBehavior enumeration (no need to learn what's the theoretical difference between a mock, a stub, a fake, a dynamic mock, etc.)
- Mock both interfaces and classes
- Override expectations: can set default expectations in a fixture setup, and override as needed on tests
- Pass constructor arguments for mocked classes
- Intercept and raise events on mocks
- Intuitive support for out/ref arguments



Comments and Reviews
it shouldnt be trusted https://github.com/devlooped/moq/issues/1374