Refactor code structure for improved readability and maintainability; optimize performance in key functions.
This commit is contained in:
@@ -210,6 +210,40 @@ public sealed class ExceptionObjectTests
|
||||
exception.EvidenceRefs.Should().Contain("sha256:evidence1hash");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExceptionObject_IsBlockedByRecheck_WhenBlockTriggered_ShouldBeTrue()
|
||||
{
|
||||
// Arrange
|
||||
var exception = CreateException(recheckResult: new RecheckEvaluationResult
|
||||
{
|
||||
IsTriggered = true,
|
||||
TriggeredConditions = [],
|
||||
RecommendedAction = RecheckAction.Block,
|
||||
EvaluatedAt = DateTimeOffset.UtcNow
|
||||
});
|
||||
|
||||
// Act & Assert
|
||||
exception.IsBlockedByRecheck.Should().BeTrue();
|
||||
exception.RequiresReapproval.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExceptionObject_RequiresReapproval_WhenReapprovalTriggered_ShouldBeTrue()
|
||||
{
|
||||
// Arrange
|
||||
var exception = CreateException(recheckResult: new RecheckEvaluationResult
|
||||
{
|
||||
IsTriggered = true,
|
||||
TriggeredConditions = [],
|
||||
RecommendedAction = RecheckAction.RequireReapproval,
|
||||
EvaluatedAt = DateTimeOffset.UtcNow
|
||||
});
|
||||
|
||||
// Act & Assert
|
||||
exception.RequiresReapproval.Should().BeTrue();
|
||||
exception.IsBlockedByRecheck.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ExceptionObject_WithMetadata_ShouldStoreKeyValuePairs()
|
||||
{
|
||||
@@ -265,7 +299,8 @@ public sealed class ExceptionObjectTests
|
||||
DateTimeOffset? expiresAt = null,
|
||||
ImmutableArray<string>? approverIds = null,
|
||||
ImmutableArray<string>? evidenceRefs = null,
|
||||
ImmutableDictionary<string, string>? metadata = null)
|
||||
ImmutableDictionary<string, string>? metadata = null,
|
||||
RecheckEvaluationResult? recheckResult = null)
|
||||
{
|
||||
return new ExceptionObject
|
||||
{
|
||||
@@ -287,7 +322,9 @@ public sealed class ExceptionObjectTests
|
||||
Rationale = "This is a test rationale that meets the minimum character requirement of 50 characters.",
|
||||
EvidenceRefs = evidenceRefs ?? [],
|
||||
CompensatingControls = [],
|
||||
Metadata = metadata ?? ImmutableDictionary<string, string>.Empty
|
||||
Metadata = metadata ?? ImmutableDictionary<string, string>.Empty,
|
||||
LastRecheckResult = recheckResult,
|
||||
LastRecheckAt = recheckResult?.EvaluatedAt
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user