VOOZH about

URL: https://www.nuget.org/packages/MockQueryable.FakeItEasy/

⇱ NuGet Gallery | MockQueryable.FakeItEasy 10.0.8




👁 Image
MockQueryable.FakeItEasy 10.0.8

dotnet add package MockQueryable.FakeItEasy --version 10.0.8
 
 
NuGet\Install-Package MockQueryable.FakeItEasy -Version 10.0.8
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MockQueryable.FakeItEasy" Version="10.0.8" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MockQueryable.FakeItEasy" Version="10.0.8" />
 
Directory.Packages.props
<PackageReference Include="MockQueryable.FakeItEasy" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MockQueryable.FakeItEasy --version 10.0.8
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MockQueryable.FakeItEasy, 10.0.8"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MockQueryable.FakeItEasy@10.0.8
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MockQueryable.FakeItEasy&version=10.0.8
 
Install as a Cake Addin
#tool nuget:?package=MockQueryable.FakeItEasy&version=10.0.8
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

MockQueryable

Extensions for mocking Entity Framework Core async queries like ToListAsync, FirstOrDefaultAsync, and more using popular mocking libraries such as Moq, NSubstitute, and FakeItEasy — all without hitting the database.

❤️ If you really like the tool, please 👉 Support the project or ☕ Buy me a coffee.


📦 NuGet Packages

Package Latest Version Install via Package Manager
👁 Download
👁 Version
Install-Package MockQueryable.Core
👁 Download
👁 Version
Install-Package MockQueryable.EntityFrameworkCore
👁 Download
👁 Version
Install-Package MockQueryable.Moq
👁 Download
👁 Version
Install-Package MockQueryable.NSubstitute
👁 Download
👁 Version
Install-Package MockQueryable.FakeItEasy

✅ Build & Status

👁 codecov
👁 build
👁 release
👁 License


⭐ GitHub Stats

👁 Stars
👁 Contributors
👁 Last Commit
👁 Commit Activity
👁 Open Issues


💡 Why Use MockQueryable?

Avoid hitting the real database in unit tests when querying via IQueryable:

var query = _userRepository.GetQueryable();

await query.AnyAsync(x => ...);
await query.FirstOrDefaultAsync(x => ...);
await query.ToListAsync();
// etc.

🚀 Getting Started

1. Create Test Data

var users = new List<UserEntity>
{
 new UserEntity { LastName = "Smith", DateOfBirth = new DateTime(2012, 1, 20) },
 // More test data...
};

2. Build the Mock

var mock = users.BuildMock(); // for IQueryable

3. Set Up in Your favorite Mocking Framework

Moq
_userRepository.Setup(x => x.GetQueryable()).Returns(mock);
NSubstitute
_userRepository.GetQueryable().Returns(mock);
FakeItEasy
A.CallTo(() => userRepository.GetQueryable()).Returns(mock);

🗃️ Mocking DbSet<T>

var mockDbSet = users.BuildMockDbSet();

// Moq
var repo = new TestDbSetRepository(mockDbSet.Object);

// NSubstitute / FakeItEasy
var repo = new TestDbSetRepository(mockDbSet);

🔧 Adding Custom Logic

Example: Custom FindAsync

mock.Setup(x => x.FindAsync(userId)).ReturnsAsync((object[] ids) =>
{
 var id = (Guid)ids[0];
 return users.FirstOrDefault(x => x.Id == id);
});

Example: Custom Expression Visitor

Build a mock with the custom for testing EF.Functions.Like

var mockDbSet = users.BuildMockDbSet<UserEntity, SampleLikeExpressionVisitor>();

🧩 Extend for Other Frameworks

You can even create your own extensions. Check the example here.


🔍 Sample Project

See the sample project for working examples.


Product Versions Compatible and additional computed target framework versions.
.NET net10.0 net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.8 9,706 5/16/2026
10.0.5 19,850 3/15/2026
10.0.2 16,560 1/29/2026
10.0.1 22,021 11/22/2025
10.0.0 368 11/22/2025
9.0.0 24,063 10/6/2025
8.0.1 25,498 10/6/2025
8.0.0 29,402 7/27/2025
7.0.4-beta 3,954 9/24/2024
7.0.3 460,981 9/2/2024
7.0.2 23,505 8/20/2024
7.0.1 294,326 3/7/2024
7.0.0 428,149 11/21/2022
6.0.1 562,176 3/28/2022
6.0.0 7,050 3/24/2022
5.0.2 22,624 3/24/2022
5.0.1 426,843 5/25/2021
5.0.0 72,042 11/12/2020
5.0.0-preview.7 871 7/28/2020
3.1.3 93,453 5/19/2020
Loading failed

#128 Microsoft.EntityFrameworkCore and Microsoft.EntityFrameworkCore.Relational v 10.0.8 - supported
 #123 NUnit from 4.5.1 to 4.6.0