Skip to content

Commit

Permalink
fix interface bug for db health checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas Kürzdörfer committed Nov 25, 2024
1 parent b63c2a0 commit a9d7708
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void ConfigureApplication(IApplicationBuilder applicationBuilder)
public void ConfigureHealthChecks(IHealthChecksBuilder healthChecksBuilder)
{
var dbContexts = implementationResolver.FindAssemblies().SelectMany(x => x.GetTypes())
.Where(x => x.GetInterfaces().Any(i => i == typeof(IDbContext)))
.Where(x => x.IsClass && !x.IsAbstract && x.IsAssignableTo(typeof(IDbContext)))
.ToList();
var registerHc = typeof(DependencyInjectionExtensions).GetMethods(BindingFlags.Static | BindingFlags.Public)
.Single(x => x.GetParameters().Length == 1 && x.GetParameters()[0].ParameterType == typeof(IHealthChecksBuilder));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public void ConfiguresHealthChecks()
_implementationResolver.FindAssemblies().Returns([typeof(EntityFrameworkPluginTests).Assembly]);
var healthCheckBuilder = Substitute.For<IHealthChecksBuilder>();
_plugin.ConfigureHealthChecks(healthCheckBuilder);
healthCheckBuilder.Received(1).Add(Arg.Any<HealthCheckRegistration>());
healthCheckBuilder.Received(1).Add(Arg.Is<HealthCheckRegistration>(h => h.Name == nameof(TestContext)));
}

Expand Down

0 comments on commit a9d7708

Please sign in to comment.