Refactor code structure and optimize performance across multiple modules
This commit is contained in:
@@ -11,6 +11,7 @@ namespace StellaOps.Scanner.Triage.Tests;
|
||||
public sealed class TriageSchemaIntegrationTests : IAsyncLifetime
|
||||
{
|
||||
private readonly TriagePostgresFixture _fixture;
|
||||
using StellaOps.TestKit;
|
||||
private TriageDbContext? _context;
|
||||
|
||||
public TriageSchemaIntegrationTests(TriagePostgresFixture fixture)
|
||||
@@ -37,7 +38,8 @@ public sealed class TriageSchemaIntegrationTests : IAsyncLifetime
|
||||
|
||||
private TriageDbContext Context => _context ?? throw new InvalidOperationException("Context not initialized");
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Schema_Creates_Successfully()
|
||||
{
|
||||
// Arrange / Act
|
||||
@@ -51,7 +53,8 @@ public sealed class TriageSchemaIntegrationTests : IAsyncLifetime
|
||||
Assert.Equal(0, decisionsCount);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Can_Create_And_Query_TriageFinding()
|
||||
{
|
||||
// Arrange
|
||||
@@ -80,7 +83,8 @@ public sealed class TriageSchemaIntegrationTests : IAsyncLifetime
|
||||
Assert.Equal(finding.CveId, retrieved.CveId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Can_Create_TriageDecision_With_Finding()
|
||||
{
|
||||
// Arrange
|
||||
@@ -126,7 +130,8 @@ public sealed class TriageSchemaIntegrationTests : IAsyncLifetime
|
||||
Assert.Equal(finding.Purl, retrieved.Finding!.Purl);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Can_Create_TriageRiskResult_With_Finding()
|
||||
{
|
||||
// Arrange
|
||||
@@ -174,7 +179,8 @@ public sealed class TriageSchemaIntegrationTests : IAsyncLifetime
|
||||
Assert.NotNull(retrieved.Finding);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Finding_Cascade_Deletes_Related_Entities()
|
||||
{
|
||||
// Arrange
|
||||
@@ -227,7 +233,8 @@ public sealed class TriageSchemaIntegrationTests : IAsyncLifetime
|
||||
Assert.Empty(await Context.RiskResults.Where(r => r.FindingId == finding.Id).ToListAsync());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Unique_Constraint_Prevents_Duplicate_Findings()
|
||||
{
|
||||
// Arrange
|
||||
@@ -268,7 +275,8 @@ public sealed class TriageSchemaIntegrationTests : IAsyncLifetime
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Indexes_Exist_For_Performance()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
Reference in New Issue
Block a user