Refactor code structure and optimize performance across multiple modules
This commit is contained in:
@@ -8,6 +8,7 @@ using StellaOps.Policy.Engine.Snapshots;
|
||||
using StellaOps.Policy.Engine.TrustWeighting;
|
||||
using StellaOps.Policy.Engine.Violations;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Policy.Engine.Tests;
|
||||
|
||||
public sealed class PolicyDecisionServiceTests
|
||||
@@ -78,7 +79,8 @@ public sealed class PolicyDecisionServiceTests
|
||||
return (decisionService, snapshot.SnapshotId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task GetDecisionsAsync_ReturnsDecisionsWithEvidence()
|
||||
{
|
||||
var (service, snapshotId) = BuildService();
|
||||
@@ -97,7 +99,8 @@ public sealed class PolicyDecisionServiceTests
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task GetDecisionsAsync_BuildsSummaryStatistics()
|
||||
{
|
||||
var (service, snapshotId) = BuildService();
|
||||
@@ -110,7 +113,8 @@ public sealed class PolicyDecisionServiceTests
|
||||
Assert.NotEmpty(response.Summary.TopSeveritySources);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task GetDecisionsAsync_FiltersById()
|
||||
{
|
||||
var (service, snapshotId) = BuildService();
|
||||
@@ -124,7 +128,8 @@ public sealed class PolicyDecisionServiceTests
|
||||
Assert.Equal("CVE-2021-44228", response.Decisions[0].AdvisoryId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task GetDecisionsAsync_FiltersByTenant()
|
||||
{
|
||||
var (service, snapshotId) = BuildService();
|
||||
@@ -137,7 +142,8 @@ public sealed class PolicyDecisionServiceTests
|
||||
Assert.All(response.Decisions, d => Assert.Equal("acme", d.TenantId));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task GetDecisionsAsync_LimitsTopSources()
|
||||
{
|
||||
var (service, snapshotId) = BuildService();
|
||||
@@ -153,7 +159,8 @@ public sealed class PolicyDecisionServiceTests
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task GetDecisionsAsync_ExcludesEvidenceWhenNotRequested()
|
||||
{
|
||||
var (service, snapshotId) = BuildService();
|
||||
@@ -166,7 +173,8 @@ public sealed class PolicyDecisionServiceTests
|
||||
Assert.All(response.Decisions, d => Assert.Null(d.Evidence));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task GetDecisionsAsync_ReturnsDeterministicOrder()
|
||||
{
|
||||
var (service, snapshotId) = BuildService();
|
||||
@@ -180,7 +188,8 @@ public sealed class PolicyDecisionServiceTests
|
||||
response2.Decisions.Select(d => d.ComponentPurl));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task GetDecisionsAsync_ThrowsOnEmptySnapshotId()
|
||||
{
|
||||
var (service, _) = BuildService();
|
||||
@@ -189,7 +198,8 @@ public sealed class PolicyDecisionServiceTests
|
||||
await Assert.ThrowsAsync<ArgumentException>(() => service.GetDecisionsAsync(request));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task GetDecisionsAsync_TopSourcesHaveRanks()
|
||||
{
|
||||
var (service, snapshotId) = BuildService();
|
||||
|
||||
Reference in New Issue
Block a user