fix(configuration-database): resolve ConfigurationDatabase-013,014 — fail-fast on missing key ring, single converter local; ConfigurationDatabase-012 left open (cross-module design decision)

This commit is contained in:
Joseph Doherty
2026-05-17 03:18:24 -04:00
parent a768135237
commit 3d3f43229f
5 changed files with 326 additions and 16 deletions

View File

@@ -1,3 +1,4 @@
using Microsoft.AspNetCore.DataProtection;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
@@ -10,10 +11,16 @@ namespace ScadaLink.ConfigurationDatabase.Tests;
/// Test DbContext that adapts SQL Server-specific features for SQLite:
/// - Maps DateTimeOffset to sortable ISO 8601 strings (SQLite has no native DateTimeOffset ORDER BY)
/// - Replaces SQL Server RowVersion with a nullable byte[] column (SQLite can't auto-generate rowversion)
///
/// Constructed with an explicit ephemeral Data Protection provider so secret-bearing
/// columns are write-capable in tests. The schema-only no-provider constructor would
/// throw on a secret-column write (ConfigurationDatabase-013); passing a provider here
/// makes the test fixture's intent explicit at the call site.
/// </summary>
public class SqliteTestDbContext : ScadaLinkDbContext
{
public SqliteTestDbContext(DbContextOptions<ScadaLinkDbContext> options) : base(options)
public SqliteTestDbContext(DbContextOptions<ScadaLinkDbContext> options)
: base(options, new EphemeralDataProtectionProvider())
{
}