VOOZH about

URL: https://www.nuget.org/packages/Moq/

โ‡ฑ NuGet Gallery | Moq 4.20.72


๏ปฟ
dotnet add package Moq --version 4.20.72
 
 
NuGet\Install-Package Moq -Version 4.20.72
 
 
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.20.72" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Moq" Version="4.20.72" />
 
Directory.Packages.props
<PackageReference Include="Moq" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Moq --version 4.20.72
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Moq, 4.20.72"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Moq@4.20.72
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Moq&version=4.20.72
 
Install as a Cake Addin
#tool nuget:?package=Moq&version=4.20.72
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

The most popular and friendly mocking library for .NET

 var mock = new Mock<ILoveThisLibrary>();

 // WOW! No record/replay weirdness?! :)
 mock.Setup(library => library.DownloadExists("2.0.0.0"))
 .Returns(true);

 // Use the Object property on the mock to get a reference to the object
 // implementing ILoveThisLibrary, and then exercise it by calling
 // methods on it
 ILoveThisLibrary lovable = mock.Object;
 bool download = lovable.DownloadExists("2.0.0.0");

 // Verify that the given method was indeed called with the expected value at most once
 mock.Verify(library => library.DownloadExists("2.0.0.0"), Times.AtMostOnce());

Moq also is the first and only library so far to provide Linq to Mocks, so that the same behavior above can be achieved much more succinctly:

 ILoveThisLibrary lovable = Mock.Of<ILoveThisLibrary>(l =>
 l.DownloadExists("2.0.0.0") == true);

 // Exercise the instance returned by Mock.Of by calling methods on it...
 bool download = lovable.DownloadExists("2.0.0.0");

 // Simply assert the returned state:
 Assert.True(download);
 
 // If you want to go beyond state testing and want to 
 // verify the mock interaction instead...
 Mock.Get(lovable).Verify(library => library.DownloadExists("2.0.0.0"));

You can think of Linq to Mocks as "from the universe of mocks, give me one whose behavior matches this expression".

Check out the Quickstart for more examples!

Sponsors

๐Ÿ‘ Clarius Org
๐Ÿ‘ Kirill Osenkov
๐Ÿ‘ MFB Technologies, Inc.
๐Ÿ‘ Stephen Shaw
๐Ÿ‘ Torutek
๐Ÿ‘ DRIVE.NET, Inc.
๐Ÿ‘ Ashley Medway
๐Ÿ‘ Keith Pickford
๐Ÿ‘ Thomas Bolon
๐Ÿ‘ Kori Francis
๐Ÿ‘ Toni Wenzel
๐Ÿ‘ Giorgi Dalakishvili
๐Ÿ‘ Uno Platform
๐Ÿ‘ Dan Siegel
๐Ÿ‘ Reuben Swartz
๐Ÿ‘ Jacob Foshee
๐Ÿ‘ alternate text is missing from this package README image
๐Ÿ‘ Eric Johnson
๐Ÿ‘ Ix Technologies B.V.
๐Ÿ‘ David JENNI
๐Ÿ‘ Jonathan
๐Ÿ‘ Oleg Kyrylchuk
๐Ÿ‘ Charley Wu
๐Ÿ‘ Jakob Tikjรธb Andersen
๐Ÿ‘ Seann Alexander
๐Ÿ‘ Tino Hager
๐Ÿ‘ Mark Seemann
๐Ÿ‘ Ken Bonny
๐Ÿ‘ Simon Cropp
๐Ÿ‘ agileworks-eu
๐Ÿ‘ sorahex
๐Ÿ‘ Zheyu Shen
๐Ÿ‘ Vezel
๐Ÿ‘ ChilliCream
๐Ÿ‘ 4OTC
๐Ÿ‘ Vincent Limo
๐Ÿ‘ Brooke Hamilton

๐Ÿ‘ Sponsor this project
 

Learn more about GitHub Sponsors

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

NuGet packages (953)

Showing the top 5 NuGet packages that depend on Moq:

Package Downloads
AutoFixture.AutoMoq

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

MockQueryable.Moq

Core package for MockQueryable extensions for mocking 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.AutoMock

An auto-mocking container that generates mocks using Moq

Autofac.Extras.Moq

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

Moq.EntityFrameworkCore

Library that provides methods that will help you with mocking Entity Framework Core. Easily mock DbSet and DbContext for unit testing with Moq.

GitHub repositories (1.4K)

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

Repository Stars
jellyfin/jellyfin
The Free Software Media System - Server Backend & API
DevToys-app/DevToys
A Swiss Army knife for developers.
AvaloniaUI/Avalonia
Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The future of .NET UI
microsoft/semantic-kernel
Integrate cutting-edge LLM technology quickly and easily into your apps
BeyondDimension/SteamTools
๐Ÿ› ใ€ŒWatt Toolkitใ€ๆ˜ฏไธ€ไธชๅผ€ๆบ่ทจๅนณๅฐ็š„ๅคšๅŠŸ่ƒฝ Steam ๅทฅๅ…ท็ฎฑใ€‚
dotnet/roslyn
The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
jasontaylordev/CleanArchitecture
Clean Architecture Solution Template for ASP.NET Core
QuantConnect/Lean
Lean Algorithmic Trading Engine by QuantConnect (Python, C#)
ppy/osu
rhythm is just a *click* away!
dotnet/runtime
.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
Flow-Launcher/Flow.Launcher
:mag: Quick file search & app launcher for Windows with community-made plugins
Sonarr/Sonarr
Smart PVR for newsgroup and bittorrent users.
Radarr/Radarr
Movie organizer/manager for usenet and torrent users.
JosefNemec/Playnite
Video game library manager with support for wide range of 3rd party libraries and game emulation support, providing one unified interface for your games.
dotnet/AspNetCore.Docs
Documentation for ASP.NET Core
chocolatey/choco
Chocolatey - the package manager for Windows
JamesNK/Newtonsoft.Json
Json.NET is a popular high-performance JSON framework for .NET
memstechtips/Winhance
Application designed to optimize, customize and enhance your Windows experience.
gui-cs/Terminal.Gui
Cross Platform Terminal UI toolkit for .NET
MathewSachin/Captura
Capture Screen, Audio, Cursor, Mouse Clicks and Keystrokes
Version Downloads Last Updated
4.20.72 187,108,670 9/7/2024
4.20.70 107,679,740 11/28/2023
4.20.69 29,474,720 8/11/2023
4.18.4 117,688,552 12/30/2022
4.18.3 10,148,799 12/5/2022
4.18.2 52,226,293 8/2/2022
4.18.1 34,045,950 5/16/2022
4.18.0 2,223,463 5/11/2022
4.17.2 31,370,099 3/6/2022
4.17.1 2,779,014 2/26/2022
4.16.1 129,404,649 2/23/2021
4.16.0 20,852,554 1/16/2021
4.15.2 15,808,344 11/26/2020
Loading failed