# Moq

> The most popular and friendly mocking framework for .NET

Source: https://talira.ai/catalog/moq-mayja8qv
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [developer tools / testing / mocking](https://talira.ai/categories/developer-tools/testing/mocking)
- Licence: BSD-3-Clause[^1][^3]
- Pricing: Free and open source[^1][^2]
- Pricing notes: Free and open source: Moq 4.x under BSD-3-Clause; the upcoming Moq 5 on the main branch under MIT.
- Free tier: yes[^1][^2]
- Backed by: [Devlooped](https://talira.ai/orgs/devlooped.md)

Moq is a mocking library for .NET tests. It creates mock objects of interfaces and classes, sets up what their methods and properties return or throw, and verifies which calls were made and how often, using LINQ expression syntax, with Mock.Of for quick stubs. The stable 4.x releases on NuGet are BSD-3-Clause; the main branch holds the upcoming Moq 5, MIT-licensed, which compiles mocks into the test project as source and generates typed setups for C# 14.

## Links

- GitHub: https://github.com/devlooped/moq

## Problems it solves

- mock a dependency in my .NET unit tests without writing a fake class by hand
- check that my C# code called a service with the right arguments
- make a mocked interface return a value or throw an exception in an xUnit or NUnit test
- stub out a repository so my service tests don't hit the database

## Features

- mocks of interfaces and classes
- setups for return values, exceptions and callbacks
- call verification with counts
- LINQ to Mocks with Mock.Of
- argument matchers
- events and ref/out parameters
- Moq 5 typed setups generated as source (C# 14)

## Trust

Overall: 0.53 out of 1.
Signals: maintenance 0.71, adoption 0.76, momentum 0.47, community 0.38, backing 0.30, extensibility 0.00.

- last commit 40 days ago
- 39 commits in the last 90 days
- latest release v4.21.0 2 months ago
- 6.4k GitHub stars
- 8 contributors
- accepts sponsorship (Github)
- backed by Devlooped

## Sources

[^1]: https://github.com/devlooped/moq/blob/v4/License.txt (checked 24 Nov 2026)
[^2]: https://github.com/devlooped/moq/blob/main/license.txt (checked 24 Nov 2026)
[^3]: https://www.nuget.org/packages/Moq (checked 24 Nov 2026)
