Path: redb/redb.Tests.Integration/Tests/MsSqlPro/MsSqlProIndexCatalogTests.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/MsSqlPro/MsSqlProIndexCatalogTests.cs
----
using Microsoft.Extensions.DependencyInjection;
using redb.Core.Models;
using redb.Core.Models.Configuration;
using redb.MSSql.Pro.Sql;
using redb.MSSql.Sql;
using redb.Tests.Integration.Tests.MsSql;
namespace redb.Tests.Integration.Tests.MsSqlPro;
///
/// MsSqlProIndexCatalog.Pro, the index of the streams query form, against a fresh SQL Server Pro database of this build
/// with the planner on (see ).
///
public class MsSqlProIndexCatalogTests : MsSqlIndexCatalogTests
{
protected override void AddRedb(IServiceCollection services, string connectionString, Action configure)
=> redb.Core.Pro.Extensions.RedbProServiceCollectionExtensions.AddRedbPro(services,
o => redb.MSSql.Pro.Extensions.MsSqlProOptionsExtensions.UseMsSql(o, connectionString).Configure(configure));
protected override IReadOnlyList Catalog => MsSqlProIndexCatalog.Pro;
protected override IReadOnlyList CoveredElsewhere => MsSqlIndexCatalog.Base;
protected override (string File, string Namespace, string Class, string Member, RedbIndexOrigin Origin) Target =>
("redb.MSSql.Pro/Sql/MsSqlProIndexCatalog.g.cs", "redb.MSSql.Pro.Sql", "MsSqlProIndexCatalog", "Pro", RedbIndexOrigin.ProModule);
}
/// The streams index of SQL Server Pro is built once (see ).
public class MsSqlProStreamsIndexOnceTests : Base.StreamsIndexOnceTestsBase
{
protected override async Task CreateDatabaseAsync(string name)
{
await MsSqlIndexCatalogTests.ExecAdminAsync($"CREATE DATABASE [{name}]");
return new Microsoft.Data.SqlClient.SqlConnectionStringBuilder(MsSqlIndexCatalogTests.AdminBase) { InitialCatalog = name }.ConnectionString;
}
protected override async Task DropDatabaseAsync(string name)
{
Microsoft.Data.SqlClient.SqlConnection.ClearAllPools();
await MsSqlIndexCatalogTests.ExecAdminAsync(
$"IF DB_ID(N'{name}') IS NOT NULL BEGIN ALTER DATABASE [{name}] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; DROP DATABASE [{name}]; END");
}
protected override void AddRedbPro(IServiceCollection services, string connectionString, Action configure)
=> redb.Core.Pro.Extensions.RedbProServiceCollectionExtensions.AddRedbPro(services,
o => redb.MSSql.Pro.Extensions.MsSqlProOptionsExtensions.UseMsSql(o, connectionString).Configure(configure));
protected override string StreamsIndex => "IX__values__structure_object_scalar";
protected override string DropStreamsIndexSql => "DROP INDEX [IX__values__structure_object_scalar] ON [dbo].[_values]";
}