Moq.Analyzers 0.1.1

dotnet add package Moq.Analyzers --version 0.1.1
NuGet\Install-Package Moq.Analyzers -Version 0.1.1
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.Analyzers" Version="0.1.1">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Moq.Analyzers --version 0.1.1
#r "nuget: Moq.Analyzers, 0.1.1"
#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.
// Install Moq.Analyzers as a Cake Addin
#addin nuget:?package=Moq.Analyzers&version=0.1.1

// Install Moq.Analyzers as a Cake Tool
#tool nuget:?package=Moq.Analyzers&version=0.1.1

Moq.Analyzers

NuGet Version NuGet Downloads Main build Codacy Grade Badge Codacy Coverage Badge

Moq.Analyzers is a Roslyn analyzer that helps you to write unit tests using the popular Moq framework. Moq.Analyzers protects you from common mistakes and warns you if something is wrong with your Moq configuration.

Analyzer rules

  • Moq1000: Sealed classes cannot be mocked
  • Moq1001: Mocked interfaces cannot have constructor parameters
  • Moq1002: Parameters provided into mock do not match any existing constructors
  • Moq1100: Callback signature must match the signature of the mocked method
  • Moq1101: SetupGet/SetupSet should be used for properties, not for methods
  • Moq1200: Setup should be used only for overridable members
  • Moq1201: Setup of async methods should use .ReturnsAsync instance instead of .Result
  • Moq1300: Mock.As() should take interfaces

See docs/rules for full documentation.

Getting started

Moq.Analyzers is installed from NuGet. Run this command for your test project(s):

dotnet add package Moq.Analyzers

NOTE: You must use a supported version of the .NET SDK (i.e. 6.0 or later).

Contributions welcome

Moq.Analyzers continues to evolve and add new features. Any help will be appreciated. You can report issues, develop new features, improve the documentation, or do other cool stuff. See CONTRIBUTING.md.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Moq.Analyzers:

Package Downloads
EncompassApi.xUnit

A xUnit library

Reo.Core.Testing.31

Package Description

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Moq.Analyzers:

Repository Stars
microsoft/semantic-kernel
Integrate cutting-edge LLM technology quickly and easily into your apps
Version Downloads Last updated
0.1.1 101 6/28/2024
0.1.0 9,699 6/4/2024
0.1.0-beta 59 6/4/2024
0.0.9 721,851 1/11/2022
0.0.8 702,053 8/11/2019
0.0.7 5,194 7/28/2019
0.0.6 976 7/28/2019
0.0.4.43043 53,670 11/26/2017
0.0.4.41458 2,806 11/26/2017
0.0.3.40797 2,760 11/26/2017
0.0.1.22865 3,117 11/26/2017