nuget reorganization

This commit is contained in:
master
2025-11-18 23:45:25 +02:00
parent 77cee6a209
commit d3ecd7f8e6
7712 changed files with 13963 additions and 10007504 deletions

View File

@@ -65,6 +65,70 @@ public sealed class SurfaceEnvironmentBuilderTests
}
}
[Fact]
public void Build_Throws_WhenEndpointMissing_AndRequired()
{
var services = CreateServices();
var exception = Assert.Throws<SurfaceEnvironmentException>(() =>
SurfaceEnvironmentFactory.Create(services, options => options.RequireSurfaceEndpoint = true));
Assert.Equal("SURFACE_FS_ENDPOINT", exception.Variable);
}
[Fact]
public void Build_Throws_WhenEndpointInvalid()
{
Environment.SetEnvironmentVariable("SCANNER_SURFACE_FS_ENDPOINT", "not-a-uri");
try
{
var services = CreateServices();
var ex = Assert.Throws<SurfaceEnvironmentException>(() => SurfaceEnvironmentFactory.Create(services));
Assert.Equal("SURFACE_FS_ENDPOINT", ex.Variable);
}
finally
{
Environment.SetEnvironmentVariable("SCANNER_SURFACE_FS_ENDPOINT", null);
}
}
[Fact]
public void Build_Throws_WhenTlsCertificateMissing()
{
Environment.SetEnvironmentVariable("SCANNER_SURFACE_FS_ENDPOINT", "https://surface.example.test");
Environment.SetEnvironmentVariable("SCANNER_SURFACE_TLS_CERT_PATH", "/does/not/exist.pem");
try
{
var services = CreateServices();
var ex = Assert.Throws<SurfaceEnvironmentException>(() => SurfaceEnvironmentFactory.Create(services));
Assert.Equal("SURFACE_TLS_CERT_PATH", ex.Variable);
}
finally
{
Environment.SetEnvironmentVariable("SCANNER_SURFACE_TLS_CERT_PATH", null);
Environment.SetEnvironmentVariable("SCANNER_SURFACE_FS_ENDPOINT", null);
}
}
[Fact]
public void Build_UsesTenantResolver_WhenNotProvided()
{
Environment.SetEnvironmentVariable("SCANNER_SURFACE_FS_ENDPOINT", "https://surface.example.test");
try
{
var services = CreateServices();
var environment = SurfaceEnvironmentFactory.Create(services, options =>
{
options.TenantResolver = _ => "resolved-tenant";
});
Assert.Equal("resolved-tenant", environment.Settings.Tenant);
}
finally
{
Environment.SetEnvironmentVariable("SCANNER_SURFACE_FS_ENDPOINT", null);
}
}
private static IServiceProvider CreateServices(Action<IServiceCollection>? configure = null)
{
var services = new ServiceCollection();