stabilizaiton work - projects rework for maintenanceability and ui livening
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
// <copyright file="EvidencePackServiceTests.CreateFromRun.cs" company="StellaOps">
|
||||
// Copyright (c) StellaOps. Licensed under the BUSL-1.1.
|
||||
// </copyright>
|
||||
using System.Threading;
|
||||
using FluentAssertions;
|
||||
using StellaOps.Evidence.Pack.Models;
|
||||
using Xunit;
|
||||
|
||||
namespace StellaOps.Evidence.Pack.Tests;
|
||||
|
||||
public sealed partial class EvidencePackServiceTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task CreateFromRunAsync_AggregatesExistingPacksAsync()
|
||||
{
|
||||
var subject = new EvidenceSubject { Type = EvidenceSubjectType.Finding, FindingId = "finding-123" };
|
||||
|
||||
var context1 = new EvidencePackContext { TenantId = "tenant-1", RunId = "run-agg" };
|
||||
var context2 = new EvidencePackContext { TenantId = "tenant-1", RunId = "run-agg" };
|
||||
|
||||
await _service.CreateAsync(
|
||||
[new EvidenceClaim
|
||||
{
|
||||
ClaimId = "c1",
|
||||
Text = "Claim 1",
|
||||
Type = ClaimType.VulnerabilityStatus,
|
||||
Status = "affected",
|
||||
Confidence = 0.8,
|
||||
EvidenceIds = ["e1"]
|
||||
}],
|
||||
[CreateEvidence("e1")],
|
||||
subject,
|
||||
context1,
|
||||
CancellationToken.None);
|
||||
|
||||
await _service.CreateAsync(
|
||||
[new EvidenceClaim
|
||||
{
|
||||
ClaimId = "c2",
|
||||
Text = "Claim 2",
|
||||
Type = ClaimType.Reachability,
|
||||
Status = "reachable",
|
||||
Confidence = 0.9,
|
||||
EvidenceIds = ["e2"]
|
||||
}],
|
||||
[CreateEvidence("e2")],
|
||||
subject,
|
||||
context2,
|
||||
CancellationToken.None);
|
||||
|
||||
var aggregated = await _service.CreateFromRunAsync("run-agg", subject, CancellationToken.None);
|
||||
|
||||
aggregated.Claims.Should().HaveCount(2);
|
||||
aggregated.Evidence.Should().HaveCount(2);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user