.NET 6.0 .NET Standard 2.0 .NET Framework 4.6.2
dotnet add package Moq --version 4.18.2
NuGet\Install-Package Moq -Version 4.18.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<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
#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

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 net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.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 (698)

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

Moq.AutoMock

An auto-mocking container that generates mocks using Moq

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.

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 (1.0K)

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.
jellyfin/jellyfin
The Free Software Media System
dotnet/roslyn
The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
Version Downloads Last updated
4.18.2 9,141,109 8/2/2022
4.18.1 9,964,126 5/16/2022
4.18.0 443,010 5/11/2022
4.17.2 10,522,562 3/6/2022
4.17.1 1,212,172 2/26/2022
4.16.1 60,842,916 2/23/2021
4.16.0 10,608,533 1/16/2021
4.15.2 9,279,160 11/26/2020
4.15.1 5,236,313 11/10/2020
4.14.7 6,021,172 10/14/2020
4.14.6 2,752,566 9/30/2020
4.14.5 18,145,206 7/1/2020
4.14.4 1,494,489 6/24/2020
4.14.3 1,294,740 6/18/2020
4.14.2 854,089 6/16/2020
4.14.1 10,949,427 4/28/2020
4.14.0 995,229 4/24/2020
4.13.1 37,809,108 10/19/2019
4.13.0 8,748,378 8/31/2019
4.12.0 11,596,451 6/20/2019
4.11.0 4,001,391 5/27/2019
4.11.0-rc2 4,818 5/27/2019
4.11.0-rc1 184,732 4/19/2019
4.10.1 27,001,922 12/3/2018
4.10.0 12,170,674 9/8/2018
4.9.0 8,050,935 7/13/2018
4.8.3 4,759,917 6/9/2018
4.8.2 11,335,325 2/23/2018
4.8.1 4,613,046 1/8/2018
4.8.0 2,139,728 12/24/2017
4.8.0-rc1 45,752 12/8/2017
4.7.145 6,390,897 11/6/2017
4.7.142 2,489,633 10/10/2017
4.7.137 1,092,698 10/3/2017
4.7.127 774,959 9/25/2017
4.7.99 5,611,989 7/17/2017
4.7.63 1,587,887 6/21/2017
4.7.58 70,308 6/20/2017
4.7.49 360,160 6/18/2017
4.7.46 63,577 6/18/2017
4.7.25 1,234,847 6/2/2017
4.7.12 247,127 5/30/2017
4.7.11 5,076 5/30/2017
4.7.10 1,097,131 5/6/2017
4.7.9 391,941 4/29/2017
4.7.8 1,654,892 3/26/2017
4.7.7 26,152 3/25/2017
4.7.1 1,463,586 2/28/2017
4.7.0 6,653,365 2/22/2017
4.6.62-alpha 5,482 2/21/2017
4.6.39-alpha 12,754 2/18/2017
4.6.38-alpha 714,336 8/20/2016
4.6.36-alpha 202,829 7/20/2016
4.6.25-alpha 104,552 6/6/2016
4.5.30 3,341,390 1/9/2017
4.5.29 1,068,102 12/10/2016
4.5.28 1,685,165 11/10/2016
4.5.23 1,061,026 10/11/2016
4.5.22 729,628 9/20/2016
4.5.21 1,457,999 8/12/2016
4.5.20 9,648 8/12/2016
4.5.19 84,657 8/10/2016
4.5.18 6,549 8/10/2016
4.5.16 754,710 7/18/2016
4.5.13 177,360 7/11/2016
4.5.10 561,202 6/21/2016
4.5.9 574,986 6/9/2016
4.5.9-alpha 9,781 5/22/2016
4.5.8 667,273 5/26/2016
4.5.7 8,391 5/26/2016
4.5.7-alpha 3,910 5/22/2016
4.5.6-alpha 4,100 5/22/2016
4.5.3 830,459 5/25/2016
4.5.0 235,240 5/24/2016
4.2.1510.2205 7,072,716 10/22/2015
4.2.1507.118 2,585,728 7/1/2015
4.2.1506.2515 136,611 6/25/2015
4.2.1506.2016 64,237 6/20/2015
4.2.1502.911 2,748,815 2/9/2015
4.2.1409.1722 2,004,045 9/17/2014
4.2.1408.717 840,701 8/7/2014
4.2.1408.619 25,703 8/6/2014
4.2.1402.2112 2,144,559 2/21/2014
4.2.1312.1622 844,060 12/17/2013
4.2.1312.1621 5,665 12/16/2013
4.2.1312.1615 6,240 12/16/2013
4.2.1312.1416 19,044 12/14/2013
4.2.1312.1323 6,748 12/14/2013
4.2.1312.1319 42,564 12/13/2013
4.1.1311.615 335,548 11/18/2013
4.1.1309.1617 590,163 9/16/2013
4.1.1309.919 274,320 9/9/2013
4.1.1309.801 12,744 9/8/2013
4.1.1309.800 5,872 9/8/2013
4.1.1308.2321 848,698 8/23/2013
4.1.1308.2316 8,327 8/23/2013
4.1.1308.2120 1,004,840 8/21/2013
4.0.10827 4,210,556 2/9/2011
3.1.416.3 295,104 2/9/2011