XBullet.EasyTesting.EntityFrameworkCore
1.0.6
See the version list below for details.
dotnet add package XBullet.EasyTesting.EntityFrameworkCore --version 1.0.6
NuGet\Install-Package XBullet.EasyTesting.EntityFrameworkCore -Version 1.0.6
<PackageReference Include="XBullet.EasyTesting.EntityFrameworkCore" Version="1.0.6" />
<PackageVersion Include="XBullet.EasyTesting.EntityFrameworkCore" Version="1.0.6" />
<PackageReference Include="XBullet.EasyTesting.EntityFrameworkCore" />
paket add XBullet.EasyTesting.EntityFrameworkCore --version 1.0.6
#r "nuget: XBullet.EasyTesting.EntityFrameworkCore, 1.0.6"
#:package XBullet.EasyTesting.EntityFrameworkCore@1.0.6
#addin nuget:?package=XBullet.EasyTesting.EntityFrameworkCore&version=1.0.6
#tool nuget:?package=XBullet.EasyTesting.EntityFrameworkCore&version=1.0.6
XBullet.EasyTesting.EntityFrameworkCore
Entity Framework Core database actions and test-factory support for XBullet.EasyTesting integration tests.
The package targets .NET 8 and .NET 10.
Install
dotnet add package XBullet.EasyTesting.EntityFrameworkCore
Derive your test factory from EntityFrameworkWebApplicationFactory<TEntryPoint, TDbContext> to configure an isolated database for each scenario. Tests can seed, query, and execute scoped database actions through the factory while requests still run through the in-memory ASP.NET Core host.
For fast tests that do not require relational database behavior, derive from
InMemoryEntityFrameworkWebApplicationFactory<TEntryPoint, TDbContext> instead. It registers
the EF Core in-memory provider automatically and creates an isolated database for each test
scenario:
public sealed class TestApiFactory
: InMemoryEntityFrameworkWebApplicationFactory<Program, TestApiDbContext>
{
}
The EF Core in-memory provider does not enforce relational constraints or support transactions.
Use EntityFrameworkWebApplicationFactory<TEntryPoint, TDbContext> with SQLite or the same
relational provider used in production when those behaviors are relevant to the test.
For an application that exposes IntegrationTestStartup and must not execute Program.Main, use
the equivalent Startup-based host. It runs directly on TestServer and keeps the same database and
scenario APIs:
public sealed class StartupTestHost
: StartupEntityFrameworkWebApplicationFactory<IntegrationTestStartup, AppDbContext>
{
protected override void ConfigureDatabaseServices(IServiceCollection services) =>
services.AddDbContext<AppDbContext>(options => options.UseSqlite(_connection));
}
var product = await factory.QueryDatabaseAsync(
(database, cancellationToken) => database.Products
.SingleAsync(item => item.Id == 42, cancellationToken));
See the repository documentation for factory setup and isolation examples.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.EntityFrameworkCore (>= 10.0.11)
- Microsoft.EntityFrameworkCore.InMemory (>= 10.0.11)
- XBullet.EasyTesting (>= 1.0.6)
-
net8.0
- Microsoft.EntityFrameworkCore (>= 8.0.30)
- Microsoft.EntityFrameworkCore.InMemory (>= 8.0.30)
- XBullet.EasyTesting (>= 1.0.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.