Alvecta.Foundation.Infrastructure.EF.Testing
2.1.27
See the version list below for details.
dotnet add package Alvecta.Foundation.Infrastructure.EF.Testing --version 2.1.27
NuGet\Install-Package Alvecta.Foundation.Infrastructure.EF.Testing -Version 2.1.27
<PackageReference Include="Alvecta.Foundation.Infrastructure.EF.Testing" Version="2.1.27" />
<PackageVersion Include="Alvecta.Foundation.Infrastructure.EF.Testing" Version="2.1.27" />
<PackageReference Include="Alvecta.Foundation.Infrastructure.EF.Testing" />
paket add Alvecta.Foundation.Infrastructure.EF.Testing --version 2.1.27
#r "nuget: Alvecta.Foundation.Infrastructure.EF.Testing, 2.1.27"
#:package Alvecta.Foundation.Infrastructure.EF.Testing@2.1.27
#addin nuget:?package=Alvecta.Foundation.Infrastructure.EF.Testing&version=2.1.27
#tool nuget:?package=Alvecta.Foundation.Infrastructure.EF.Testing&version=2.1.27
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.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([]);
}
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 (>= 2.1.27)
- Microsoft.EntityFrameworkCore (>= 10.0.9)
- Microsoft.EntityFrameworkCore.Relational (>= 10.0.9)
- xunit.v3.assert (>= 3.2.2)
- xunit.v3.extensibility.core (>= 3.2.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.