Refactor code structure and optimize performance across multiple modules

This commit is contained in:
StellaOps Bot
2025-12-26 20:03:22 +02:00
parent c786faae84
commit f10d83c444
1385 changed files with 69732 additions and 10280 deletions

View File

@@ -18,7 +18,8 @@ public sealed class EvidenceEndpointsTests
{
private static readonly JsonSerializerOptions SerializerOptions = new(JsonSerializerDefaults.Web);
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task GetEvidence_ReturnsBadRequest_WhenScanIdInvalid()
{
using var secrets = new TestSurfaceSecretsScope();
@@ -34,7 +35,8 @@ public sealed class EvidenceEndpointsTests
response.StatusCode.Should().Be(HttpStatusCode.NotFound); // Route doesn't match
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task GetEvidence_ReturnsNotFound_WhenScanDoesNotExist()
{
using var secrets = new TestSurfaceSecretsScope();
@@ -50,7 +52,8 @@ public sealed class EvidenceEndpointsTests
response.StatusCode.Should().Be(HttpStatusCode.NotFound);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task GetEvidence_ReturnsListEndpoint_WhenFindingIdEmpty()
{
// When no finding ID is provided, the route matches the list endpoint
@@ -71,7 +74,8 @@ public sealed class EvidenceEndpointsTests
response.StatusCode.Should().Be(HttpStatusCode.OK);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task ListEvidence_ReturnsEmptyList_WhenNoFindings()
{
using var secrets = new TestSurfaceSecretsScope();
@@ -93,7 +97,8 @@ public sealed class EvidenceEndpointsTests
result.Items.Should().BeEmpty();
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task ListEvidence_ReturnsEmptyList_WhenScanDoesNotExist()
{
// The current implementation returns empty list for non-existent scans
@@ -105,6 +110,7 @@ public sealed class EvidenceEndpointsTests
});
using var client = factory.CreateClient();
using StellaOps.TestKit;
var response = await client.GetAsync("/api/v1/scans/nonexistent-scan/evidence");
// Current behavior: returns empty list (200 OK) for non-existent scans
@@ -134,7 +140,8 @@ public sealed class EvidenceEndpointsTests
/// </summary>
public sealed class EvidenceTtlTests
{
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void DefaultEvidenceTtlDays_DefaultsToSevenDays()
{
// Verify the default configuration
@@ -143,7 +150,8 @@ public sealed class EvidenceTtlTests
options.DefaultEvidenceTtlDays.Should().Be(7);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void VexEvidenceTtlDays_DefaultsToThirtyDays()
{
var options = new StellaOps.Scanner.WebService.Services.EvidenceCompositionOptions();
@@ -151,7 +159,8 @@ public sealed class EvidenceTtlTests
options.VexEvidenceTtlDays.Should().Be(30);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void StaleWarningThresholdDays_DefaultsToOne()
{
var options = new StellaOps.Scanner.WebService.Services.EvidenceCompositionOptions();
@@ -159,7 +168,8 @@ public sealed class EvidenceTtlTests
options.StaleWarningThresholdDays.Should().Be(1);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void EvidenceCompositionOptions_CanBeConfigured()
{
var options = new StellaOps.Scanner.WebService.Services.EvidenceCompositionOptions