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

This is a prerelease version of Rig.TUnit.Databases.Sql.SqlServer.
dotnet add package Rig.TUnit.Databases.Sql.SqlServer --version 0.1.0-beta.2
                    
NuGet\Install-Package Rig.TUnit.Databases.Sql.SqlServer -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.SqlServer" 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.SqlServer" Version="0.1.0-beta.2" />
                    
Directory.Packages.props
<PackageReference Include="Rig.TUnit.Databases.Sql.SqlServer" />
                    
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.SqlServer --version 0.1.0-beta.2
                    
#r "nuget: Rig.TUnit.Databases.Sql.SqlServer, 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.SqlServer@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.SqlServer&version=0.1.0-beta.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Rig.TUnit.Databases.Sql.SqlServer&version=0.1.0-beta.2&prerelease
                    
Install as a Cake Tool

Rig.TUnit.Databases.Sql.SqlServer

Testcontainers-backed SQL Server fixture using the mcr.microsoft.com/mssql/server:2022-latest image, integrated with Microsoft.EntityFrameworkCore.SqlServer.

What this package is

The Rig.TUnit SQL Server provider. SqlServerFixture spins the Microsoft 2022 Developer-edition container via Testcontainers and exposes a ready ConnectionString. Integrates with the Rig.TUnit.Databases.Sql family base for parity assertions and with EF Core via the standard UseSqlServer(connectionString) wire.

When to use it

  • Integration tests targeting SqlServer-specific features (OUTPUT INTO, temporal tables, MERGE, rowversion).
  • Multi-engine tests where SqlServer is a required matrix cell.
  • Verifying migration scripts before deploy.
  • Not for: unit tests — prefer SQLite in-memory.

Prerequisites

  • .NET 10 SDK
  • Docker Desktop / Colima (first pull ~1.5 GB)
  • Linux or Windows-containers-enabled Docker daemon.

Quick start

using Microsoft.EntityFrameworkCore;
using Rig.TUnit.Databases.Sql.SqlServer.Fixtures;

await using var fx = new SqlServerFixture();
await fx.InitializeAsync();

var opts = new DbContextOptionsBuilder<TestDb>()
    .UseSqlServer(fx.ConnectionString)
    .Options;

Options

Property Type Default Description
Image string "mcr.microsoft.com/mssql/server:2022-latest" Container image
StartupTimeoutSeconds int 180 SqlServer takes ~30-60s to warm
SaPassword string "RigTUnit_P@ss1" SA password — must satisfy policy
AcceptEula bool true Sets ACCEPT_EULA=Y
Edition string "Developer" Express / Developer / Standard / Enterprise

Fixture + helper APIs

  • Rig.TUnit.Databases.Sql.SqlServer.Fixtures.SqlServerFixture
  • Rig.TUnit.Databases.Sql.SqlServer.Options.SqlServerFixtureOptions
  • Rig.TUnit.Databases.Sql.SqlServer.Builder.SqlServerRigBuilder
  • UseSqlServer(RigBuilder, …) extension

Per-test isolation

Default is one container per fixture class; per-test DB isolation via CREATE DATABASE test_{IsolationKey} + DROP DATABASE in the Arrange / teardown pair. For heavy use, one fixture per test-class is typical — full per-test containers are cost-prohibitive for SqlServer's warm-up time.

Parallelism + performance

  • First-run pull: ~60–90 s (~1.5 GB).
  • Warm startup: ~30–60 s.
  • Per-test DB create + drop: ~150 ms.
  • Parallelism: cap at 4 unless your host has >16 GB RAM allocated to Docker — each container reserves ~2 GB.

Troubleshooting

  • The SA password does not meet SQL Server password policy — password must have 8+ chars + upper + lower + digit + symbol. The default RigTUnit_P@ss1 satisfies this; override carefully.
  • Container OOM — SqlServer's default memory target is 80 % of host; limit via -e MSSQL_MEMORY_LIMIT_MB=2048 in the Testcontainers config.
  • Login failed for user 'sa' — ephemeral container health-check reports ready before sa login is enabled. Fixture waits for a successful SELECT 1 before returning, so normal calls are safe.

See docs/troubleshooting.md#sqlserver.

Provider quirks + edge cases

  • rowversion / timestamp is a binary concurrency token — EF maps it to byte[] but reports DataType=Binary; use IsConcurrencyToken() in OnModelCreating.
  • Max identifier length is 128 chars — longest in the SQL family.
  • Case folding: default collation is SQL_Latin1_General_CP1_CI_AS (case INsensitive). Tests relying on exact case must use a case-sensitive collation.

Benchmarks

See SqlServerBenchmarks.cs; baseline 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 (1)

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

Package Downloads
Rig.TUnit.All

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

GitHub repositories

This package is not used by any popular GitHub repositories.

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