Skip to content

Conversation

@Catlandor
Copy link
Contributor

PR Details

  • Fix .AsQueryable calls to the test data set by returning the mocked data set instead of the actual data set for the faked AsQueryable call
  • Deleted duplicated tests (identical code)

Description

Following call:
A.CallTo(() => mock.AsQueryable()).Returns(data.AsQueryable());

...was replaced with:
A.CallTo(() => mock.AsQueryable()).Returns(mock);

This fixes the issue, as the mock will relay any further calls to the test query provider. So any further calls work the same as if .AsQueryable() was not called.

Related Issue

#88

How Has This Been Tested

  • Created new unit tests for all three variants to ensure that AsQueryable() calls work for all mocking frameworks.
  • Ensured all new unit tests passed and that existing tests remained unaffected.

Checklist

  • My code follows the code style of this project.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@romantitov
Copy link
Owner

Hello @Catlandor . Thanks for your effort and the PR. What should be the version number of the MockQueryable that should include your changes?

@Catlandor
Copy link
Contributor Author

Hi @romantitov
If nothing else will be included in the release, I would suggest releasing this as version 8.0.1, as it's a bugfix of something that worked before and broke with one of the adjustments from version 8.0.0.
Thank you for your review!

@romantitov romantitov merged commit e9a560d into romantitov:master Oct 6, 2025
1 check passed
renebentes pushed a commit to renebentes/3054 that referenced this pull request Oct 8, 2025
Updated
[MockQueryable.NSubstitute](https://github.com/romantitov/MockQueryable)
from 8.0.0 to 8.0.1.

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

_Sourced from [MockQueryable.NSubstitute's
releases](https://github.com/romantitov/MockQueryable/releases)._

## 8.0.1

## What's Changed
* #​88 Fix `.AsQueryable` calls to the test data set by @​Catlandor in
romantitov/MockQueryable#90
* Move EF Dependency to v8 by @​johnw86 in
romantitov/MockQueryable#91

## New Contributors
* @​johnw86 made their first contribution in
romantitov/MockQueryable#91

**Full Changelog**:
romantitov/MockQueryable@v8.0.0...v8.0.1

Commits viewable in [compare
view](romantitov/MockQueryable@v8.0.0...v8.0.1).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=MockQueryable.NSubstitute&package-manager=nuget&previous-version=8.0.0&new-version=8.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 merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@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] <[email protected]>
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.

2 participants