Path: redb/redb.Tests.Integration/Tests/Unit/SqliteNativeExtensionGateTests.cs
Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb
Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Tests.Integration/Tests/Unit/SqliteNativeExtensionGateTests.cs
----
using redb.SQLite.Data;
namespace redb.Tests.Integration.Tests.Unit;
///
/// The native SQLite extension is versioned like the PostgreSQL and SQL Server modules: a build that does not report
/// the version the dialect requires is refused at initialization, naming the file. Before the gate a stale
/// redbsqlite.dll next to the application loaded silently and answered in an old shape - list item JSON in the
/// old form, a regex filter failing with an unrelated error.
///
public class SqliteNativeExtensionGateTests
{
[Fact]
public void AStaleExtension_IsRefused_NamingBothVersionsAndTheFile()
{
var act = () => SqliteNativeExtension.EnsureVersion(@"C:\app\redbsqlite.dll", deployed: "0.6.5", required: "0.6.6");
act.Should().Throw().Which.Message
.Should().Contain("0.6.5").And.Contain("0.6.6").And.Contain(@"C:\app\redbsqlite.dll");
}
[Fact]
public void AnExtensionWithoutTheVersionFunction_IsRefused()
{
var act = () => SqliteNativeExtension.EnsureVersion(@"C:\app\redbsqlite.dll", deployed: null, required: "0.6.6");
act.Should().Throw().Which.Message
.Should().Contain("pvt_module_version").And.Contain("0.6.6");
}
[Fact]
public void TheMatchingExtension_Passes()
{
var act = () => SqliteNativeExtension.EnsureVersion(@"C:\app\redbsqlite.dll", deployed: "0.6.6", required: "0.6.6");
act.Should().NotThrow();
}
}