Moq.Analyzers 0.0.9

.NET Standard 1.3
Install-Package Moq.Analyzers -Version 0.0.9
dotnet add package Moq.Analyzers --version 0.0.9
<PackageReference Include="Moq.Analyzers" Version="0.0.9">
  <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.0.9
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Moq.Analyzers, 0.0.9"
#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.Analyzers as a Cake Addin
#addin nuget:?package=Moq.Analyzers&version=0.0.9

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

Moq.Analyzers

Visual Studio extension and Roslyn analyzer that helps to write unit tests using Moq mocking library. Port of Resharper extension to Roslyn.

Note: If you are using Visual Studio 2017 then you can additionally install Moq.Autocomplete extension/package to get better autocomplete suggestions when writing code.

Detected issues

  • 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.

TODO

  • Setup() should be used for methods, not for properties
  • AdvancedMatcherAttribute should accept only IMatcher types
  • Checks for protected mocks when dynamically referencing their members
  • Setup() requires overridable members
  • Mock.Get() should not take literals

How to install

  • (Option 1) Install "Moq.Analyzers" NuGet package into test projects. Con: Extension will work for specific projects only. Pro: It will be available for all project developers automatically.
  • (Option 2) Install "Moq.Analyzers" extension into Visual Studio. Con: Every developer must install extension manually. Pro: It works for all your projects.
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 netcoreapp1.0 netcoreapp1.1 netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard1.3 netstandard1.4 netstandard1.5 netstandard1.6 netstandard2.0 netstandard2.1
.NET Framework net46 net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen30 tizen40 tizen60
Universal Windows Platform uap uap10.0
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.

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

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.9 57,390 1/11/2022
0.0.8 448,242 8/11/2019
0.0.7 4,271 7/28/2019
0.0.6 358 7/28/2019
0.0.4.43043 48,506 11/26/2017
0.0.4.41458 787 11/26/2017
0.0.3.40797 756 11/26/2017
0.0.1.22865 735 11/26/2017