Alvecta.Foundation.Infrastructure.EF.Testing
8.1.81
See the version list below for details.
dotnet add package Alvecta.Foundation.Infrastructure.EF.Testing --version 8.1.81
NuGet\Install-Package Alvecta.Foundation.Infrastructure.EF.Testing -Version 8.1.81
<PackageReference Include="Alvecta.Foundation.Infrastructure.EF.Testing" Version="8.1.81" />
<PackageVersion Include="Alvecta.Foundation.Infrastructure.EF.Testing" Version="8.1.81" />
<PackageReference Include="Alvecta.Foundation.Infrastructure.EF.Testing" />
paket add Alvecta.Foundation.Infrastructure.EF.Testing --version 8.1.81
#r "nuget: Alvecta.Foundation.Infrastructure.EF.Testing, 8.1.81"
#:package Alvecta.Foundation.Infrastructure.EF.Testing@8.1.81
#addin nuget:?package=Alvecta.Foundation.Infrastructure.EF.Testing&version=8.1.81
#tool nuget:?package=Alvecta.Foundation.Infrastructure.EF.Testing&version=8.1.81
Alvecta.Foundation.Infrastructure.EF.Testing
EF Core persistence test harness for solutions that follow the Alvecta read/write DbContext split: a projection-only read context that maps the query schema and owns the migrations, and a write context that maps the domain entities as a relational subset of it.
The package is a library of abstract xunit base classes (not a runnable test project). Each consuming solution adds thin sealed run-host subclasses that supply the context factories.
What it pins
SchemaParityTestsBase<TReadDbContext, TWriteDbContext>— the scalar shapes of the two models (table names, columns, store types, nullability — navigations excluded) must match exactly, and the read face keeps its structural guarantees: no tracking, the projection-only materialization interceptor registered, and refusingSaveChangesAsync.MigrationsDriftTestsBase<TDbContext>— the migrations-owning context has no pending model changes relative to its snapshot.MigrationsScriptTestsBase<TDbContext>— the SQL the migrations send to the database, as the provider's migrations SQL generator writes it (a custom generator's rewrites included), is pinned in two files of the run host's test project:<RunHost>.Up.sql, from an empty database to the latest migration, and<RunHost>.Down.sql, back. Every run writes the generated script over the pinned one and fails when they differed: a new migration or a provider upgrade that changes the SQL fails once, its diff is reviewed and committed, and the next run passes. Line endings become\nand the EF version in the history rows becomes<ProductVersion>. The project folder is found by walking up from the test output to the folder holding<assembly name>.csproj, so the output has to lie inside the project folder (the defaultbin/layout, not the artifacts layout).ModelShapes— the shape-rendering helper behind the parity assertion, public for solution-specific comparisons.
Usage
public sealed class ConnectorSchemaParityTests
: SchemaParityTestsBase<ConnectorReadDbContext, ConnectorWriteDbContext>
{
protected override ConnectorReadDbContext CreateReadDbContext() => TestDbContexts.ConnectorRead();
protected override ConnectorWriteDbContext CreateWriteDbContext() => TestDbContexts.ConnectorWrite();
}
public sealed class ConnectorMigrationsDriftTests : MigrationsDriftTestsBase<ConnectorReadDbContext>
{
// Build through the design-time factory the `dotnet ef` tooling uses, so the comparison sees
// exactly what migration generation would see.
protected override ConnectorReadDbContext CreateDbContext()
=> new ConnectorDbContextDesignTimeFactory().CreateDbContext([]);
}
// Pins ConnectorMigrationsScriptTests.Up.sql and .Down.sql in the test project's folder.
public sealed class ConnectorMigrationsScriptTests : MigrationsScriptTestsBase<ConnectorReadDbContext>
{
protected override ConnectorReadDbContext CreateDbContext()
=> new ConnectorDbContextDesignTimeFactory().CreateDbContext([]);
}
Contexts built against a dummy connection string are fine — none of the tests touches the database.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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
- Alvecta.Foundation.Infrastructure.EF (>= 8.1.81)
- Alvecta.Utils (>= 8.2.77)
- Microsoft.EntityFrameworkCore (>= 10.0.14)
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.14)
- xunit.v3.assert (>= 4.0.2)
- xunit.v3.extensibility.core (>= 4.0.2)
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 |
|---|---|---|
| 9.4.91 | 49 | 11/20/2026 |
| 9.3.90 | 114 | 11/13/2026 |
| 9.2.89 | 91 | 11/12/2026 |
| 9.1.88 | 94 | 11/11/2026 |
| 9.0.87 | 101 | 11/4/2026 |
| 9.0.86 | 86 | 11/4/2026 |
| 9.0.85 | 94 | 11/4/2026 |
| 9.0.84 | 89 | 11/4/2026 |
| 9.0.83 | 102 | 10/29/2026 |
| 9.0.82 | 109 | 10/29/2026 |
| 8.1.81 | 95 | 10/29/2026 |
| 8.0.80 | 96 | 10/28/2026 |
| 8.0.79 | 94 | 10/28/2026 |
| 8.0.78 | 101 | 10/28/2026 |
| 8.0.77 | 102 | 10/28/2026 |
| 7.1.76 | 107 | 10/27/2026 |
| 7.1.75 | 94 | 10/26/2026 |
| 7.0.74 | 99 | 10/26/2026 |
| 7.0.73 | 99 | 10/23/2026 |
| 7.0.72 | 102 | 10/23/2026 |