Skip to content

Allow GetMock<IServiceProvider>() to return a mock instead of the AutoMocker instance#451

Merged
Keboo merged 1 commit into
masterfrom
fix450
Mar 16, 2026
Merged

Allow GetMock<IServiceProvider>() to return a mock instead of the AutoMocker instance#451
Keboo merged 1 commit into
masterfrom
fix450

Conversation

@Keboo
Copy link
Copy Markdown
Collaborator

@Keboo Keboo commented Mar 16, 2026

Fixes #450. This change ensures that the SelfResolver is bypassed when a mock is explicitly requested via GetMock, allowing a mock of IServiceProvider (or other self-resolved types) to be created rather than returning the AutoMocker instance itself.

…oMocker instance

Fixes #450. This change ensures that the SelfResolver is bypassed when a mock is explicitly requested via GetMock, allowing a mock of IServiceProvider (or other self-resolved types) to be created rather than returning the AutoMocker instance itself.
@Keboo Keboo enabled auto-merge (squash) March 16, 2026 15:33
@Keboo Keboo merged commit f94bafe into master Mar 16, 2026
3 checks passed
@Keboo Keboo deleted the fix450 branch March 16, 2026 15:34
intellitect-bot pushed a commit to IntelliTect/EssentialCSharp.Web that referenced this pull request Mar 23, 2026
Updated [Moq.AutoMock](https://github.com/moq/Moq.AutoMocker) from 4.0.0
to 4.0.1.

<details>
<summary>Release notes</summary>

_Sourced from [Moq.AutoMock's
releases](https://github.com/moq/Moq.AutoMocker/releases)._

## 4.0.1

## What's Changed
* Allow GetMock<IServiceProvider>() to return a mock instead of the
AutoMocker instance by @​Keboo in
moq/Moq.AutoMocker#451


**Full Changelog**:
moq/Moq.AutoMocker@v4.0.0...v4.0.1

Commits viewable in [compare
view](moq/Moq.AutoMocker@v4.0.0...v4.0.1).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=Moq.AutoMock&package-manager=nuget&previous-version=4.0.0&new-version=4.0.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
BenjaminMichaelis pushed a commit to IntelliTect/EssentialCSharp.Web that referenced this pull request Apr 25, 2026
Updated [Moq.AutoMock](https://github.com/moq/Moq.AutoMocker) from 4.0.0
to 4.0.1.

<details>
<summary>Release notes</summary>

_Sourced from [Moq.AutoMock's
releases](https://github.com/moq/Moq.AutoMocker/releases)._

## 4.0.1

## What's Changed
* Allow GetMock<IServiceProvider>() to return a mock instead of the
AutoMocker instance by @​Keboo in
moq/Moq.AutoMocker#451


**Full Changelog**:
moq/Moq.AutoMocker@v4.0.0...v4.0.1

Commits viewable in [compare
view](moq/Moq.AutoMocker@v4.0.0...v4.0.1).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=Moq.AutoMock&package-manager=nuget&previous-version=4.0.0&new-version=4.0.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
github-actions Bot pushed a commit to BenjaminMichaelis/DotnetTemplates that referenced this pull request May 6, 2026
[//]: # (dependabot-start)
⚠️  **Dependabot is rebasing this PR** ⚠️ 

Rebasing might not happen immediately, so don't worry if this takes some
time.

Note: if you make any changes to this PR yourself, they will take
precedence over the rebase.

---

[//]: # (dependabot-end)

Updated [Moq.AutoMock](https://github.com/moq/Moq.AutoMocker) from 3.5.0
to 4.0.2.

<details>
<summary>Release notes</summary>

_Sourced from [Moq.AutoMock's
releases](https://github.com/moq/Moq.AutoMocker/releases)._

## 4.0.1

## What's Changed
* Allow GetMock<IServiceProvider>() to return a mock instead of the
AutoMocker instance by @​Keboo in
moq/Moq.AutoMocker#451


**Full Changelog**:
moq/Moq.AutoMocker@v4.0.0...v4.0.1

## 4.0.0

## What's Changed
* Fix 406: Adds tests for disabling source generators by @​Keboo in
moq/Moq.AutoMocker#407
* Bump NUnit3TestAdapter from 5.2.0 to 6.0.0 by @​dependabot[bot] in
moq/Moq.AutoMocker#408
* Bump TUnit from 1.3.15 to 1.5.6 by @​dependabot[bot] in
moq/Moq.AutoMocker#409
* Clarifies Source Generator Ambiguities and Disabling by @​Keboo in
moq/Moq.AutoMocker#411
* Bump the github-actions group with 2 updates by @​dependabot[bot] in
moq/Moq.AutoMocker#413
* Bump NUnit3TestAdapter from 6.0.0 to 6.0.1 by @​dependabot[bot] in
moq/Moq.AutoMocker#416
* Bump TUnit from 1.5.6 to 1.6.5 by @​dependabot[bot] in
moq/Moq.AutoMocker#417
* Adds package validation and documentation by @​Keboo in
moq/Moq.AutoMocker#418
* Bump TUnit from 1.6.5 to 1.7.0 by @​dependabot[bot] in
moq/Moq.AutoMocker#419
* Bump TUnit from 1.7.0 to 1.9.2 by @​dependabot[bot] in
moq/Moq.AutoMocker#420
* Bump NUnit3TestAdapter from 6.0.1 to 6.1.0 by @​dependabot[bot] in
moq/Moq.AutoMocker#421
* Bump TUnit from 1.9.2 to 1.9.81 by @​dependabot[bot] in
moq/Moq.AutoMocker#422
* Bump TUnit from 1.9.81 to 1.12.3 by @​dependabot[bot] in
moq/Moq.AutoMocker#423
* Bump xunit.v3 from 3.2.1 to 3.2.2 by @​dependabot[bot] in
moq/Moq.AutoMocker#424
* Bump TUnit from 1.12.3 to 1.12.53 by @​dependabot[bot] in
moq/Moq.AutoMocker#425
* Adds Use overload for registering implementation type by @​Keboo in
moq/Moq.AutoMocker#426
* Bump TUnit from 1.12.53 to 1.12.111 by @​dependabot[bot] in
moq/Moq.AutoMocker#427
* Adds primary constructor test coverage by @​Keboo in
moq/Moq.AutoMocker#428
* Refactor: Rename `AddFakeLogging` to `WithFakeLogging` by @​Keboo in
moq/Moq.AutoMocker#429
* Bump Microsoft.SourceLink.GitHub from 8.0.0 to 10.0.102 by
@​dependabot[bot] in moq/Moq.AutoMocker#431
* Bump TUnit from 1.12.111 to 1.13.11 by @​dependabot[bot] in
moq/Moq.AutoMocker#433
* Bump MSTest from 4.0.2 to 4.1.0 by @​dependabot[bot] in
moq/Moq.AutoMocker#432
* Adds fluent HttpClient mocking support by @​Keboo in
moq/Moq.AutoMocker#434
* Bump coverlet.collector from 6.0.4 to 8.0.0 by @​dependabot[bot] in
moq/Moq.AutoMocker#435
* Bump TUnit from 1.13.11 to 1.15.0 by @​dependabot[bot] in
moq/Moq.AutoMocker#437
* Bump Microsoft.SourceLink.GitHub from 10.0.102 to 10.0.103 by
@​dependabot[bot] in moq/Moq.AutoMocker#436
* Bump Microsoft.ApplicationInsights from 2.23.0 to 3.0.0 by
@​dependabot[bot] in moq/Moq.AutoMocker#430
* Refactors HTTP response extensions by @​Keboo in
moq/Moq.AutoMocker#438
* Bump NUnit from 4.4.0 to 4.5.0 by @​dependabot[bot] in
moq/Moq.AutoMocker#439
* Bump TUnit from 1.15.0 to 1.17.7 by @​dependabot[bot] in
moq/Moq.AutoMocker#440
* Adds resolver insertion and SimpleTypeResolver base by @​Keboo in
moq/Moq.AutoMocker#441
* Bump TUnit from 1.17.7 to 1.18.0 by @​dependabot[bot] in
moq/Moq.AutoMocker#444
* Bump actions/upload-artifact from 6 to 7 in the github-actions group
by @​dependabot[bot] in moq/Moq.AutoMocker#442
* Bump Microsoft.NET.Test.Sdk from 18.0.1 to 18.3.0 by @​dependabot[bot]
in moq/Moq.AutoMocker#443
* Bump NUnit from 4.5.0 to 4.5.1 by @​dependabot[bot] in
moq/Moq.AutoMocker#446
* Bump TUnit from 1.18.0 to 1.19.16 by @​dependabot[bot] in
moq/Moq.AutoMocker#447


**Full Changelog**:
moq/Moq.AutoMocker@v3.6.1...v4.0.0

Commits viewable in [compare
view](https://github.com/moq/Moq.AutoMocker/commits).
</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
github-actions Bot pushed a commit to BenjaminMichaelis/DotnetTemplates that referenced this pull request May 15, 2026
Updated [Moq.AutoMock](https://github.com/moq/Moq.AutoMocker) from 3.5.0
to 4.0.2.

<details>
<summary>Release notes</summary>

_Sourced from [Moq.AutoMock's
releases](https://github.com/moq/Moq.AutoMocker/releases)._

## 4.0.1

## What's Changed
* Allow GetMock<IServiceProvider>() to return a mock instead of the
AutoMocker instance by @​Keboo in
moq/Moq.AutoMocker#451


**Full Changelog**:
moq/Moq.AutoMocker@v4.0.0...v4.0.1

## 4.0.0

## What's Changed
* Fix 406: Adds tests for disabling source generators by @​Keboo in
moq/Moq.AutoMocker#407
* Bump NUnit3TestAdapter from 5.2.0 to 6.0.0 by @​dependabot[bot] in
moq/Moq.AutoMocker#408
* Bump TUnit from 1.3.15 to 1.5.6 by @​dependabot[bot] in
moq/Moq.AutoMocker#409
* Clarifies Source Generator Ambiguities and Disabling by @​Keboo in
moq/Moq.AutoMocker#411
* Bump the github-actions group with 2 updates by @​dependabot[bot] in
moq/Moq.AutoMocker#413
* Bump NUnit3TestAdapter from 6.0.0 to 6.0.1 by @​dependabot[bot] in
moq/Moq.AutoMocker#416
* Bump TUnit from 1.5.6 to 1.6.5 by @​dependabot[bot] in
moq/Moq.AutoMocker#417
* Adds package validation and documentation by @​Keboo in
moq/Moq.AutoMocker#418
* Bump TUnit from 1.6.5 to 1.7.0 by @​dependabot[bot] in
moq/Moq.AutoMocker#419
* Bump TUnit from 1.7.0 to 1.9.2 by @​dependabot[bot] in
moq/Moq.AutoMocker#420
* Bump NUnit3TestAdapter from 6.0.1 to 6.1.0 by @​dependabot[bot] in
moq/Moq.AutoMocker#421
* Bump TUnit from 1.9.2 to 1.9.81 by @​dependabot[bot] in
moq/Moq.AutoMocker#422
* Bump TUnit from 1.9.81 to 1.12.3 by @​dependabot[bot] in
moq/Moq.AutoMocker#423
* Bump xunit.v3 from 3.2.1 to 3.2.2 by @​dependabot[bot] in
moq/Moq.AutoMocker#424
* Bump TUnit from 1.12.3 to 1.12.53 by @​dependabot[bot] in
moq/Moq.AutoMocker#425
* Adds Use overload for registering implementation type by @​Keboo in
moq/Moq.AutoMocker#426
* Bump TUnit from 1.12.53 to 1.12.111 by @​dependabot[bot] in
moq/Moq.AutoMocker#427
* Adds primary constructor test coverage by @​Keboo in
moq/Moq.AutoMocker#428
* Refactor: Rename `AddFakeLogging` to `WithFakeLogging` by @​Keboo in
moq/Moq.AutoMocker#429
* Bump Microsoft.SourceLink.GitHub from 8.0.0 to 10.0.102 by
@​dependabot[bot] in moq/Moq.AutoMocker#431
* Bump TUnit from 1.12.111 to 1.13.11 by @​dependabot[bot] in
moq/Moq.AutoMocker#433
* Bump MSTest from 4.0.2 to 4.1.0 by @​dependabot[bot] in
moq/Moq.AutoMocker#432
* Adds fluent HttpClient mocking support by @​Keboo in
moq/Moq.AutoMocker#434
* Bump coverlet.collector from 6.0.4 to 8.0.0 by @​dependabot[bot] in
moq/Moq.AutoMocker#435
* Bump TUnit from 1.13.11 to 1.15.0 by @​dependabot[bot] in
moq/Moq.AutoMocker#437
* Bump Microsoft.SourceLink.GitHub from 10.0.102 to 10.0.103 by
@​dependabot[bot] in moq/Moq.AutoMocker#436
* Bump Microsoft.ApplicationInsights from 2.23.0 to 3.0.0 by
@​dependabot[bot] in moq/Moq.AutoMocker#430
* Refactors HTTP response extensions by @​Keboo in
moq/Moq.AutoMocker#438
* Bump NUnit from 4.4.0 to 4.5.0 by @​dependabot[bot] in
moq/Moq.AutoMocker#439
* Bump TUnit from 1.15.0 to 1.17.7 by @​dependabot[bot] in
moq/Moq.AutoMocker#440
* Adds resolver insertion and SimpleTypeResolver base by @​Keboo in
moq/Moq.AutoMocker#441
* Bump TUnit from 1.17.7 to 1.18.0 by @​dependabot[bot] in
moq/Moq.AutoMocker#444
* Bump actions/upload-artifact from 6 to 7 in the github-actions group
by @​dependabot[bot] in moq/Moq.AutoMocker#442
* Bump Microsoft.NET.Test.Sdk from 18.0.1 to 18.3.0 by @​dependabot[bot]
in moq/Moq.AutoMocker#443
* Bump NUnit from 4.5.0 to 4.5.1 by @​dependabot[bot] in
moq/Moq.AutoMocker#446
* Bump TUnit from 1.18.0 to 1.19.16 by @​dependabot[bot] in
moq/Moq.AutoMocker#447


**Full Changelog**:
moq/Moq.AutoMocker@v3.6.1...v4.0.0

Commits viewable in [compare
view](https://github.com/moq/Moq.AutoMocker/commits).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=Moq.AutoMock&package-manager=nuget&previous-version=3.5.0&new-version=4.0.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Functional regression in Moq.AutoMock 4.0.0

1 participant