.NET 6.0 .NET Standard 2.0 .NET Framework 4.6.2
Install-Package Moq -Version 4.18.2
dotnet add package Moq --version 4.18.2
<PackageReference Include="Moq" Version="4.18.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Moq --version 4.18.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Moq, 4.18.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Moq as a Cake Addin
#addin nuget:?package=Moq&version=4.18.2

// Install Moq as a Cake Tool
#tool nuget:?package=Moq&version=4.18.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Moq is the most popular and friendly mocking framework for .NET.

Built from https://github.com/moq/moq4/tree/c60833da6

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (666)

Showing the top 5 NuGet packages that depend on Moq:

Package Downloads
AutoFixture.AutoMoq The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

This extension turns AutoFixture into an Auto-Mocking Container. The mock instances are created by Moq. To use it, add the AutoMoqCustomization to your Fixture instance. Read more at http://blog.ploeh.dk/2010/08/19/AutoFixtureAsAnAutomockingContainer.aspx

Autofac.Extras.Moq The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Autofac extension for automocking and creation of mock objects in Moq.

Moq.AutoMock

An auto-mocking container that generates mocks using Moq

MockQueryable.Moq

Extension for mocking Entity Framework Core operations such ToListAsync, FirstOrDefaultAsync etc. When writing tests for your application it is often desirable to avoid hitting the database. The extension allows you to achieve this by creating a context – with behavior defined by your tests – that makes use of in-memory data.

Moq.Dapper

Moq extensions for Dapper methods.

GitHub repositories (999)

Showing the top 5 popular GitHub repositories that depend on Moq:

Repository Stars
microsoft/PowerToys
Windows system utilities to maximize productivity
Wox-launcher/Wox
Launcher for Windows, an alternative to Alfred and Launchy.
dotnet-architecture/eShopOnContainers
Cross-platform .NET sample microservices and container based application that runs on Linux Windows and macOS. Powered by .NET 6, Docker Containers and Azure Kubernetes Services. Supports Visual Studio, VS for Mac and CLI based environments with Docker CLI, dotnet CLI, VS Code or any other code editor.
dotnet/roslyn
The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
jellyfin/jellyfin
The Free Software Media System
Version Downloads Last updated
4.18.2 361,403 8/2/2022
4.18.1 4,722,459 5/16/2022
4.18.0 294,686 5/11/2022
4.17.2 7,042,382 3/6/2022
4.17.1 922,908 2/26/2022
4.16.1 50,739,675 2/23/2021
4.16.0 9,114,396 1/16/2021
4.15.2 8,431,113 11/26/2020
4.15.1 4,726,684 11/10/2020
4.14.7 5,534,666 10/14/2020
4.14.6 2,522,751 9/30/2020
4.14.5 16,837,289 7/1/2020
4.14.4 1,409,966 6/24/2020
4.14.3 1,219,174 6/18/2020
4.14.2 814,098 6/16/2020
4.14.1 10,250,428 4/28/2020
4.14.0 928,811 4/24/2020
4.13.1 35,569,557 10/19/2019
4.13.0 8,313,294 8/31/2019
4.12.0 11,072,156 6/20/2019
4.11.0 3,832,021 5/27/2019
4.11.0-rc2 4,778 5/27/2019
4.11.0-rc1 181,725 4/19/2019
4.10.1 25,924,971 12/3/2018
4.10.0 11,792,984 9/8/2018
4.9.0 7,713,983 7/13/2018
4.8.3 4,583,105 6/9/2018
4.8.2 10,889,020 2/23/2018
4.8.1 4,462,869 1/8/2018
4.8.0 1,849,748 12/24/2017
4.8.0-rc1 45,291 12/8/2017
4.7.145 6,153,274 11/6/2017
4.7.142 2,447,204 10/10/2017
4.7.137 1,000,289 10/3/2017
4.7.127 746,870 9/25/2017
4.7.99 5,391,218 7/17/2017
4.7.63 1,546,860 6/21/2017
4.7.58 69,696 6/20/2017
4.7.49 357,092 6/18/2017
4.7.46 60,070 6/18/2017
4.7.25 1,199,403 6/2/2017
4.7.12 238,366 5/30/2017
4.7.11 4,960 5/30/2017
4.7.10 1,069,196 5/6/2017
4.7.9 383,641 4/29/2017
4.7.8 1,608,759 3/26/2017
4.7.7 25,840 3/25/2017
4.7.1 1,435,255 2/28/2017
4.7.0 5,604,236 2/22/2017
4.6.62-alpha 5,440 2/21/2017
4.6.39-alpha 12,695 2/18/2017
4.6.38-alpha 706,862 8/20/2016
4.6.36-alpha 202,469 7/20/2016
4.6.25-alpha 103,309 6/6/2016
4.5.30 3,169,766 1/9/2017
4.5.29 1,051,480 12/10/2016
4.5.28 1,611,172 11/10/2016
4.5.23 1,033,249 10/11/2016
4.5.22 708,921 9/20/2016
4.5.21 1,426,117 8/12/2016
4.5.20 9,530 8/12/2016
4.5.19 83,059 8/10/2016
4.5.18 6,440 8/10/2016
4.5.16 733,024 7/18/2016
4.5.13 173,021 7/11/2016
4.5.10 548,774 6/21/2016
4.5.9 546,581 6/9/2016
4.5.9-alpha 9,728 5/22/2016
4.5.8 657,620 5/26/2016
4.5.7 8,177 5/26/2016
4.5.7-alpha 3,877 5/22/2016
4.5.6-alpha 4,065 5/22/2016
4.5.3 781,207 5/25/2016
4.5.0 225,137 5/24/2016
4.2.1510.2205 6,831,876 10/22/2015
4.2.1507.118 2,502,794 7/1/2015
4.2.1506.2515 132,297 6/25/2015
4.2.1506.2016 63,405 6/20/2015
4.2.1502.911 2,662,020 2/9/2015
4.2.1409.1722 1,929,713 9/17/2014
4.2.1408.717 821,520 8/7/2014
4.2.1408.619 25,384 8/6/2014
4.2.1402.2112 2,086,935 2/21/2014
4.2.1312.1622 819,381 12/17/2013
4.2.1312.1621 5,522 12/16/2013
4.2.1312.1615 6,088 12/16/2013
4.2.1312.1416 18,825 12/14/2013
4.2.1312.1323 6,410 12/14/2013
4.2.1312.1319 38,784 12/13/2013
4.1.1311.615 315,408 11/18/2013
4.1.1309.1617 571,246 9/16/2013
4.1.1309.919 270,072 9/9/2013
4.1.1309.801 12,208 9/8/2013
4.1.1309.800 5,553 9/8/2013
4.1.1308.2321 839,088 8/23/2013
4.1.1308.2316 8,070 8/23/2013
4.1.1308.2120 899,006 8/21/2013
4.0.10827 4,015,174 2/9/2011
3.1.416.3 251,698 2/9/2011