![]() |
VOOZH | about |
dotnet add package Autofac.Extras.Moq --version 7.0.0
NuGet\Install-Package Autofac.Extras.Moq -Version 7.0.0
<PackageReference Include="Autofac.Extras.Moq" Version="7.0.0" />
<PackageVersion Include="Autofac.Extras.Moq" Version="7.0.0" />Directory.Packages.props
<PackageReference Include="Autofac.Extras.Moq" />Project file
paket add Autofac.Extras.Moq --version 7.0.0
#r "nuget: Autofac.Extras.Moq, 7.0.0"
#:package Autofac.Extras.Moq@7.0.0
#addin nuget:?package=Autofac.Extras.Moq&version=7.0.0Install as a Cake Addin
#tool nuget:?package=Autofac.Extras.Moq&version=7.0.0Install as a Cake Tool
Moq auto mocking integration for Autofac.
👁 Build status
👁 codecov
👁 NuGet
Please file issues and pull requests for this package in this repository rather than in the Autofac core repo.
⚠️ LOOKING FOR AN OWNER! This package is largely in maintenance mode - if you'd like to help the community out and pull it out of maintenance mode, come drop us a line!
Given you have a system under test and a dependency:
public class SystemUnderTest
{
public SystemUnderTest(IDependency dependency)
{
}
}
public interface IDependency
{
}
When writing your unit test, use the Autofac.Extras.Moq.AutoMock class to instantiate the system under test. Doing this will automatically inject a mock dependency into the constructor for you. At the time you create the AutoMock factory, you can specify default mock behavior:
AutoMock.GetLoose() - creates automatic mocks using loose mocking behavior.AutoMock.GetStrict() - creates automatic mocks using strict mocking behavior.AutoMock.GetFromRepository(repo) - creates mocks based on an existing configured repository.[Test]
public void Test()
{
using (var mock = AutoMock.GetLoose())
{
// The AutoMock class will inject a mock IDependency
// into the SystemUnderTest constructor
var sut = mock.Create<SystemUnderTest>();
}
}
Need help with Autofac? We have a documentation site as well as API documentation. We're ready to answer your questions on Stack Overflow or check out the discussion forum.
| 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 is compatible. 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 was computed. 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. |
Showing the top 5 NuGet packages that depend on Autofac.Extras.Moq:
| Package | Downloads |
|---|---|
|
given-fixture
Simple test fixture pattern |
|
|
Autofac.Extras.Moq.Xunit
A small wrapper over AutoMock to simplify writing tests for Xunit. |
|
|
FluentFixture
Simple test fixture pattern |
|
|
xunit.spec
Specification based testing with xunit |
|
|
JRevolt.Injection.Testing
Unit Testing Support for JRevolt.Injection |
Showing the top 14 popular GitHub repositories that depend on Autofac.Extras.Moq:
| Repository | Stars |
|---|---|
|
dotnet/yarp
A toolkit for developing high-performance HTTP reverse proxy applications.
|
|
|
smartstore/Smartstore
A modular, scalable and ultra-fast open-source all-in-one eCommerce platform built on ASP.NET Core 10
|
|
|
CodeMazeBlog/CodeMazeGuides
The main repository for all the Code Maze guides
|
|
|
Reaparr/Reaparr
Plex downloader that brings content from any server to yours!
|
|
|
axle-h/Retro.Net
Retro hardware libraries in .NET Core with an Angular front end
|
|
|
Azure/Industrial-IoT
Azure Industrial IoT Platform
|
|
| dotnet/systemweb-adapters | |
|
keremvaris/Sennedjem
Sennedjem CQRS (Command Query Responsibility Segregation) yaklaşımını benimseyen ve SOLID prensiplerini ve Clean Architecture yöntemlerini odaklayan bir yazılım geliştirme alt yapısıdır. RabbitMq, ElasticSearch vb araçlara entegre olmak konusunda çok yeteneklidir.
|
|
|
newbe36524/Newbe.Claptrap
This is a frameworks with reactive, event sourcing and Actor pattern as basic theories. On top of this, developers can create "distributed", "scale out", and "easy to test" application more simply. Claptrap and it`s Minions is on the way.
|
|
|
MattHoneycutt/SpecsFor
SpecsFor is a light-weight Behavior-Driven Development framework that focuses on ease of use for *developers* by minimizing testing friction.
|
|
|
phil-guo/ketchup
ketchup (番茄酱) 是一个基于dotnet core的微服务框架。
|
|
|
aykutalparslan/Ferrite
Experimental Telegram Server
|
|
|
pkuehnel/TeslaSolarCharger
A software to let your Tesla charge with solar energy ☀
|
|
|
hailstorm75/ModularDoc
Modular documentation generator for .NET libraries. Currently supporting Markdown only for GitHub, GitLab, and Bitbucket
|
| Version | Downloads | Last Updated |
|---|---|---|
| 7.0.0 | 2,761,531 | 10/1/2024 |
| 6.1.1 | 2,925,853 | 7/26/2023 |
| 6.1.0 | 4,336,229 | 10/21/2021 |
| 6.0.0 | 2,677,133 | 10/2/2020 |
| 5.0.1 | 1,349,608 | 3/22/2020 |
| 5.0.0 | 116,144 | 2/25/2020 |
| 4.3.0 | 3,342,525 | 10/23/2018 |
| 4.2.0 | 915,666 | 10/2/2017 |
| 4.1.0 | 35,189 | 9/28/2017 |
| 4.1.0-rc5-246 | 24,348 | 1/30/2017 |
| 4.1.0-rc4-242 | 1,490 | 1/29/2017 |
| 4.1.0-rc3-231 | 25,754 | 7/13/2016 |
| 4.0.0 | 1,398,081 | 10/13/2015 |
| 3.1.0 | 127,042 | 6/8/2015 |
| 3.0.2 | 77,174 | 3/27/2014 |
| 3.0.1 | 10,787 | 9/23/2013 |
| 3.0.0 | 13,776 | 1/30/2013 |
| 3.0.0-beta2 | 1,821 | 12/23/2012 |
| 3.0.0-beta | 2,097 | 11/1/2012 |
Release notes are at https://github.com/autofac/Autofac.Extras.Moq/releases