Path: redb-route/tests/redb.Route.Tests.Core/Integration/MsSqlFixture.cs Snapshot: redb-route, 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-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/tests/redb.Route.Tests.Core/Integration/MsSqlFixture.cs ---- using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using redb.Core; using redb.Core.Models.Configuration; using redb.Core.Pro.Extensions; using redb.MSSql.Pro.Extensions; using redb.Route.RedbCore.Models; namespace redb.Route.Tests.Core.Integration; /// /// Shared xUnit fixture that boots a real MSSql-backed , /// creates the database schema and syncs the scheme. /// public sealed class MsSqlFixture : IAsyncLifetime { public IRedbService Redb { get; private set; } = null!; public ServiceProvider ServiceProvider { get; private set; } = null!; public async Task InitializeAsync() { var config = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .Build(); var connectionString = global::redb.Route.Tests.Shared.TestDatabases.MsSql(config.GetConnectionString("MSSql")!); var license = config["Redb:License"]; var services = new ServiceCollection(); services.AddLogging(); services.AddRedbPro(options => { options.UseMsSql(connectionString) .Configure(c => { c.PropsSaveStrategy = PropsSaveStrategy.DeleteInsert; }); if (!string.IsNullOrWhiteSpace(license)) options.WithLicense(license); }); ServiceProvider = services.BuildServiceProvider(); Redb = ServiceProvider.GetRequiredService(); try { await Redb.InitializeAsync(ensureCreated: true); } catch { // Schema may already exist from a parallel TFM run or previous session await Redb.InitializeAsync(); } await Redb.SyncSchemeAsync(); } public async Task DisposeAsync() { if (ServiceProvider is IAsyncDisposable asyncDisposable) await asyncDisposable.DisposeAsync(); else ServiceProvider?.Dispose(); } } [CollectionDefinition("MsSql")] public class MsSqlCollection : ICollectionFixture;