Autofac.Extras.Moq
7.0.0
Prefix Reserved
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" />
paket add Autofac.Extras.Moq --version 7.0.0
#r "nuget: Autofac.Extras.Moq, 7.0.0"
// Install Autofac.Extras.Moq as a Cake Addin #addin nuget:?package=Autofac.Extras.Moq&version=7.0.0 // Install Autofac.Extras.Moq as a Cake Tool #tool nuget:?package=Autofac.Extras.Moq&version=7.0.0
Autofac.Extras.Moq
Moq auto mocking integration for Autofac.
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!
Quick Start
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>();
}
}
Get Help
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 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Autofac (>= 8.1.0)
- Moq (>= 4.18.4)
- System.ComponentModel.TypeConverter (>= 4.3.0)
-
.NETStandard 2.1
- Autofac (>= 8.1.0)
- Moq (>= 4.18.4)
- System.ComponentModel.TypeConverter (>= 4.3.0)
-
net6.0
- Autofac (>= 8.1.0)
- Moq (>= 4.18.4)
- System.ComponentModel.TypeConverter (>= 4.3.0)
-
net8.0
- Autofac (>= 8.1.0)
- Moq (>= 4.18.4)
- System.ComponentModel.TypeConverter (>= 4.3.0)
NuGet packages (11)
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 |
|
JRevolt.Injection.Testing
Unit Testing Support for JRevolt.Injection |
|
DNC.Testing
DNC.Testing |
GitHub repositories (16)
Showing the top 5 popular GitHub repositories that depend on Autofac.Extras.Moq:
Repository | Stars |
---|---|
microsoft/reverse-proxy
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 7
|
|
CodeMazeBlog/CodeMazeGuides
The main repository for all the Code Maze guides
|
|
DevArchitecture/DevArchitecture
DevArchitecture Backend Project
|
|
chayxana/Restaurant-App
Restaurant App 🍔 is a sample open-source e-Commerce 🛒 application for ordering foods, powered by polyglot microservices architecture and cross-platform development including mobile and web
|
Version | Downloads | Last updated |
---|---|---|
7.0.0 | 92,804 | 10/1/2024 |
6.1.1 | 1,399,326 | 7/26/2023 |
6.1.0 | 3,284,283 | 10/21/2021 |
6.0.0 | 2,092,283 | 10/2/2020 |
5.0.1 | 1,169,524 | 3/22/2020 |
5.0.0 | 92,019 | 2/25/2020 |
4.3.0 | 2,879,239 | 10/23/2018 |
4.2.0 | 841,147 | 10/2/2017 |
4.1.0 | 26,224 | 9/28/2017 |
4.1.0-rc5-246 | 23,359 | 1/30/2017 |
4.1.0-rc4-242 | 1,001 | 1/29/2017 |
4.1.0-rc3-231 | 24,895 | 7/13/2016 |
4.0.0 | 1,270,378 | 10/13/2015 |
3.1.0 | 98,755 | 6/8/2015 |
3.0.2 | 71,637 | 3/27/2014 |
3.0.1 | 9,406 | 9/23/2013 |
3.0.0 | 11,193 | 1/30/2013 |
3.0.0-beta2 | 1,297 | 12/23/2012 |
3.0.0-beta | 1,567 | 11/1/2012 |
Release notes are at https://github.com/autofac/Autofac.Extras.Moq/releases