-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update build for .NET 6, improved packaging.
- Loading branch information
Showing
36 changed files
with
1,313 additions
and
1,133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
{ | ||
"recommendations": [ | ||
"davidanson.vscode-markdownlint", | ||
"editorconfig.editorconfig", | ||
"formulahendry.dotnet-test-explorer", | ||
"ms-dotnettools.csharp", | ||
"editorconfig.editorconfig", | ||
"davidanson.vscode-markdownlint" | ||
"ryanluker.vscode-coverage-gutters", | ||
"stkb.rewrap", | ||
"travisillig.vscode-json-stable-stringify" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,51 @@ | ||
# Autofac.Extras.Moq | ||
|
||
Moq auto mocking integration for [Autofac IoC](https://github.com/autofac/Autofac). | ||
Moq auto mocking integration for [Autofac](https://github.com/autofac/Autofac). | ||
|
||
[![Build status](https://ci.appveyor.com/api/projects/status/8c7natm3bsmn7ebx?svg=true)](https://ci.appveyor.com/project/Autofac/autofac-extras-moq) [![codecov](https://codecov.io/gh/Autofac/Autofac.Extras.Moq/branch/develop/graph/badge.svg)](https://app.codecov.io/gh/autofac/Autofac.Extras.Moq) [![NuGet](https://img.shields.io/nuget/v/Autofac.Extras.Moq.svg)](https://nuget.org/packages/Autofac.Extras.Moq) | ||
|
||
[![Open in Visual Studio Code](https://open.vscode.dev/badges/open-in-vscode.svg)](https://open.vscode.dev/autofac/Autofac.Extras.Moq) | ||
|
||
Please file issues and pull requests for this package in this repository rather than in the Autofac core repo. | ||
|
||
- [Documentation](https://autofac.readthedocs.io/en/latest/integration/moq.html) | ||
- [NuGet](https://www.nuget.org/packages/Autofac.Extras.Moq) | ||
- [Contributing](https://autofac.readthedocs.io/en/latest/contributors.html) | ||
|
||
## Quick Start | ||
|
||
Given you have a system under test and a dependency: | ||
|
||
```c# | ||
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. | ||
|
||
```c# | ||
[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](https://autofac.readthedocs.io/) as well as [API documentation](https://autofac.org/apidoc/). We're ready to answer your questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/autofac) or check out the [discussion forum](https://groups.google.com/forum/#forum/autofac). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.