fix(localdb): DI review fixes — onReady leak guard, BusyTimeoutMs ctor guard, shared allow-list
This commit is contained in:
@@ -56,6 +56,21 @@ public sealed class DependencyInjectionTests : IDisposable
|
||||
Assert.Contains("widget", db.ReplicatedTables.Keys);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AddZbLocalDb_OnReadyThrows_ExceptionPropagates()
|
||||
{
|
||||
var services = new ServiceCollection();
|
||||
services.AddZbLocalDb(Config(), _ => throw new InvalidOperationException("boom"));
|
||||
using var provider = services.BuildServiceProvider();
|
||||
|
||||
var first = Assert.Throws<InvalidOperationException>(() => provider.GetRequiredService<ILocalDb>());
|
||||
Assert.Equal("boom", first.Message);
|
||||
|
||||
// No half-initialized singleton is cached: the next resolution re-runs the factory and fails again.
|
||||
var second = Assert.Throws<InvalidOperationException>(() => provider.GetRequiredService<ILocalDb>());
|
||||
Assert.Equal("boom", second.Message);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Validator_EmptyPath_Fails()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user