Rig.TUnit.Databases.Sql 0.1.0-beta.2

This is a prerelease version of Rig.TUnit.Databases.Sql.
dotnet add package Rig.TUnit.Databases.Sql --version 0.1.0-beta.2
                    
NuGet\Install-Package Rig.TUnit.Databases.Sql -Version 0.1.0-beta.2
                    
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="Rig.TUnit.Databases.Sql" Version="0.1.0-beta.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rig.TUnit.Databases.Sql" Version="0.1.0-beta.2" />
                    
Directory.Packages.props
<PackageReference Include="Rig.TUnit.Databases.Sql" />
                    
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 Rig.TUnit.Databases.Sql --version 0.1.0-beta.2
                    
#r "nuget: Rig.TUnit.Databases.Sql, 0.1.0-beta.2"
                    
#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 Rig.TUnit.Databases.Sql@0.1.0-beta.2
                    
#: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=Rig.TUnit.Databases.Sql&version=0.1.0-beta.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Rig.TUnit.Databases.Sql&version=0.1.0-beta.2&prerelease
                    
Install as a Cake Tool

Rig.TUnit.Databases.Sql

Family-base package for SQL-database test fixtures: EF Core provider contract, SqlContract suite, transaction helpers, DbContextHelper<TContext>.

What this package is

The shared foundation for every SQL database provider Rig.TUnit ships (MySql, Oracle, Postgresql, SqlServer, Sqlite). It defines SqlRigBuilder<TSelf> with ReplaceDbContext<T>, the EF-agnostic DbContextHelper<TContext>, InMemoryDbExtensions, and SQL-specific assertions (RawSqlAssert). Also ships the SqlContract TUnit suite ([InheritsTests]) that leaf integration projects run to prove parity of semantics across engines: transactions, concurrency tokens, migration apply/rollback, and streaming result sets.

Install this one directly only when you are writing a new SQL provider or consuming provider-agnostic assertions.

When to use it

  • Authoring a new SQL backend (DuckDB, SingleStore, …).
  • Sharing test fixtures across multi-engine integration tests.
  • Not for: concrete SQL testing — install one of the five leaf packages.

Prerequisites

  • .NET 10 SDK
  • Microsoft.EntityFrameworkCore 10.x
  • The leaf provider's native client (Npgsql, Pomelo.MySql, Oracle.EFCore, etc.).

Quick start

using Rig.TUnit.Core.Builder;
using Rig.TUnit.Core.Helpers;

var rig = new RigBuilder()
    .WithIsolation(IsolationKey.FromExecutionContext())
    .Build();

await using var _ = rig;

Options

Property Type Default Description
MigrationStrategy MigrationStrategy ApplyOnInit ApplyOnInit / SkipMigrations / EnsureCreated.
CommandTimeoutSeconds int 30 EF Database.SetCommandTimeout.
EnableDetailedErrors bool true Turn on EnableDetailedErrors().
EnableSensitiveDataLogging bool true Turn on EnableSensitiveDataLogging().

Fixture + helper APIs

  • Rig.TUnit.Databases.Sql.Builder.SqlRigBuilder<TSelf> — CRTP builder
  • Rig.TUnit.Databases.Sql.Helpers.DbContextHelper<TContext>
  • Rig.TUnit.Databases.Sql.Extensions.InMemoryDbExtensions
  • Rig.TUnit.Databases.Sql.Assertions.RawSqlAssert
  • Rig.TUnit.Databases.Sql.Contracts.SqlContract — family TUnit suite

Per-test isolation

Each leaf provider materialises a fresh database/schema per test; strategy varies (ephemeral DB, schema-per-test, or IsolationKey prefix). The base contract suite relies on the per-test guarantee without assuming one strategy.

Parallelism + performance

§9 — N/A: family-base; parallelism profile depends on the concrete

engine. Sqlite and Postgres are fully parallel; Oracle's session-setup cost forces a lower Iterations value.

Troubleshooting

  • ModelBuilding errors differ across engines — use provider-specific HasColumnType calls inside OnModelCreating or guard with Database.IsSqlServer() / Database.IsNpgsql().

See docs/troubleshooting.md.

Provider quirks + edge cases

  • SQL engines differ on: identity columns, RETURNING clauses, case folding, max identifier length (30 Oracle, 64 MySql, 63 Postgres, 128 SqlServer), and default isolation level. Contract tests normalise these.

Benchmarks

§12 — N/A: family-base. Concrete leaves have individual

Rig.TUnit.Benchmarks/*SqlBenchmarks.cs entries tracked in benchmarks/baseline-005.json.

License

MIT. See LICENSE.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on Rig.TUnit.Databases.Sql:

Package Downloads
Rig.TUnit.Databases.Sql.Oracle

TUnit fixture for Oracle Database (gvenzl/oracle-free) backed by Testcontainers. Per-test isolation and schema helpers for Oracle 23ai.

Rig.TUnit.Databases.Sql.SqlServer

TUnit fixture for SQL Server backed by Testcontainers. Per-test isolation, schema bootstrapping, and assertions for SQL Server 2022+.

Rig.TUnit.All

Meta-package containing every Rig.TUnit.* package. DISCOURAGED — prefer per-feature or per-stack meta-packages (Rig.TUnit, Rig.TUnit.Microservices).

Rig.TUnit.Databases.Sql.Sqlite

TUnit fixture for SQLite - in-memory or file-based, no container required. The fastest tier of the SQL provider matrix.

Rig.TUnit.Databases.Sql.Postgresql

TUnit fixture for PostgreSQL backed by Testcontainers. Per-test isolation, schema bootstrapping, and assertions for Postgres 16.x.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-beta.2 56 4/27/2026
0.0.0-alpha.0.14 50 4/26/2026