more audit work
This commit is contained in:
@@ -19,6 +19,7 @@ namespace StellaOps.Scanner.Reachability.Tests;
|
||||
public sealed class GraphDeltaComputerTests
|
||||
{
|
||||
private readonly GraphDeltaComputer _computer;
|
||||
private static CancellationToken TestCancellationToken => TestContext.Current.CancellationToken;
|
||||
|
||||
public GraphDeltaComputerTests()
|
||||
{
|
||||
@@ -34,7 +35,7 @@ public sealed class GraphDeltaComputerTests
|
||||
var graph2 = new TestGraphSnapshot("hash1", new[] { "A", "B" }, new[] { ("A", "B") });
|
||||
|
||||
// Act
|
||||
var delta = await _computer.ComputeDeltaAsync(graph1, graph2);
|
||||
var delta = await _computer.ComputeDeltaAsync(graph1, graph2, TestCancellationToken);
|
||||
|
||||
// Assert
|
||||
delta.HasChanges.Should().BeFalse();
|
||||
@@ -49,7 +50,7 @@ public sealed class GraphDeltaComputerTests
|
||||
var graph2 = new TestGraphSnapshot("hash2", new[] { "A", "B", "C" }, new[] { ("A", "B"), ("B", "C") });
|
||||
|
||||
// Act
|
||||
var delta = await _computer.ComputeDeltaAsync(graph1, graph2);
|
||||
var delta = await _computer.ComputeDeltaAsync(graph1, graph2, TestCancellationToken);
|
||||
|
||||
// Assert
|
||||
delta.HasChanges.Should().BeTrue();
|
||||
@@ -68,7 +69,7 @@ public sealed class GraphDeltaComputerTests
|
||||
var graph2 = new TestGraphSnapshot("hash2", new[] { "A", "B" }, new[] { ("A", "B") });
|
||||
|
||||
// Act
|
||||
var delta = await _computer.ComputeDeltaAsync(graph1, graph2);
|
||||
var delta = await _computer.ComputeDeltaAsync(graph1, graph2, TestCancellationToken);
|
||||
|
||||
// Assert
|
||||
delta.HasChanges.Should().BeTrue();
|
||||
@@ -86,7 +87,7 @@ public sealed class GraphDeltaComputerTests
|
||||
var graph2 = new TestGraphSnapshot("hash2", new[] { "A", "B", "C" }, new[] { ("A", "C") });
|
||||
|
||||
// Act
|
||||
var delta = await _computer.ComputeDeltaAsync(graph1, graph2);
|
||||
var delta = await _computer.ComputeDeltaAsync(graph1, graph2, TestCancellationToken);
|
||||
|
||||
// Assert
|
||||
delta.HasChanges.Should().BeTrue();
|
||||
@@ -115,6 +116,7 @@ public sealed class GraphDeltaComputerTests
|
||||
public sealed class ImpactSetCalculatorTests
|
||||
{
|
||||
private readonly ImpactSetCalculator _calculator;
|
||||
private static CancellationToken TestCancellationToken => TestContext.Current.CancellationToken;
|
||||
|
||||
public ImpactSetCalculatorTests()
|
||||
{
|
||||
@@ -130,7 +132,7 @@ public sealed class ImpactSetCalculatorTests
|
||||
var graph = new TestGraphSnapshot("hash1", new[] { "Entry", "A", "B" }, new[] { ("Entry", "A"), ("A", "B") });
|
||||
|
||||
// Act
|
||||
var impact = await _calculator.CalculateImpactAsync(delta, graph);
|
||||
var impact = await _calculator.CalculateImpactAsync(delta, graph, TestCancellationToken);
|
||||
|
||||
// Assert
|
||||
impact.RequiresFullRecompute.Should().BeFalse();
|
||||
@@ -152,12 +154,12 @@ public sealed class ImpactSetCalculatorTests
|
||||
|
||||
var graph = new TestGraphSnapshot(
|
||||
"hash2",
|
||||
new[] { "Entry", "A", "B", "C" },
|
||||
new[] { "Entry", "Entry2", "Entry3", "Entry4", "A", "B", "C" },
|
||||
new[] { ("Entry", "A"), ("A", "B"), ("B", "C") },
|
||||
new[] { "Entry" });
|
||||
new[] { "Entry", "Entry2", "Entry3", "Entry4" });
|
||||
|
||||
// Act
|
||||
var impact = await _calculator.CalculateImpactAsync(delta, graph);
|
||||
var impact = await _calculator.CalculateImpactAsync(delta, graph, TestCancellationToken);
|
||||
|
||||
// Assert
|
||||
impact.RequiresFullRecompute.Should().BeFalse();
|
||||
@@ -171,6 +173,7 @@ public sealed class ImpactSetCalculatorTests
|
||||
// Arrange - More than 30% affected
|
||||
var delta = new GraphDelta
|
||||
{
|
||||
AddedNodes = new HashSet<string> { "Entry1", "Entry2", "Entry3", "Entry4" },
|
||||
AffectedMethodKeys = new HashSet<string> { "Entry1", "Entry2", "Entry3", "Entry4" }
|
||||
};
|
||||
|
||||
@@ -181,7 +184,7 @@ public sealed class ImpactSetCalculatorTests
|
||||
new[] { "Entry1", "Entry2", "Entry3", "Entry4" });
|
||||
|
||||
// Act
|
||||
var impact = await _calculator.CalculateImpactAsync(delta, graph);
|
||||
var impact = await _calculator.CalculateImpactAsync(delta, graph, TestCancellationToken);
|
||||
|
||||
// Assert - All 4 entries affected = 100% > 30% threshold
|
||||
impact.RequiresFullRecompute.Should().BeTrue();
|
||||
@@ -207,6 +210,7 @@ public sealed class ImpactSetCalculatorTests
|
||||
public sealed class StateFlipDetectorTests
|
||||
{
|
||||
private readonly StateFlipDetector _detector;
|
||||
private static CancellationToken TestCancellationToken => TestContext.Current.CancellationToken;
|
||||
|
||||
public StateFlipDetectorTests()
|
||||
{
|
||||
@@ -229,7 +233,7 @@ public sealed class StateFlipDetectorTests
|
||||
};
|
||||
|
||||
// Act
|
||||
var result = await _detector.DetectFlipsAsync(previous, current);
|
||||
var result = await _detector.DetectFlipsAsync(previous, current, TestCancellationToken);
|
||||
|
||||
// Assert
|
||||
result.HasFlips.Should().BeFalse();
|
||||
@@ -253,7 +257,7 @@ public sealed class StateFlipDetectorTests
|
||||
};
|
||||
|
||||
// Act
|
||||
var result = await _detector.DetectFlipsAsync(previous, current);
|
||||
var result = await _detector.DetectFlipsAsync(previous, current, TestCancellationToken);
|
||||
|
||||
// Assert
|
||||
result.HasFlips.Should().BeTrue();
|
||||
@@ -280,7 +284,7 @@ public sealed class StateFlipDetectorTests
|
||||
};
|
||||
|
||||
// Act
|
||||
var result = await _detector.DetectFlipsAsync(previous, current);
|
||||
var result = await _detector.DetectFlipsAsync(previous, current, TestCancellationToken);
|
||||
|
||||
// Assert
|
||||
result.HasFlips.Should().BeTrue();
|
||||
@@ -304,7 +308,7 @@ public sealed class StateFlipDetectorTests
|
||||
};
|
||||
|
||||
// Act
|
||||
var result = await _detector.DetectFlipsAsync(previous, current);
|
||||
var result = await _detector.DetectFlipsAsync(previous, current, TestCancellationToken);
|
||||
|
||||
// Assert
|
||||
result.HasFlips.Should().BeTrue();
|
||||
@@ -325,7 +329,7 @@ public sealed class StateFlipDetectorTests
|
||||
var current = new List<ReachablePairResult>();
|
||||
|
||||
// Act
|
||||
var result = await _detector.DetectFlipsAsync(previous, current);
|
||||
var result = await _detector.DetectFlipsAsync(previous, current, TestCancellationToken);
|
||||
|
||||
// Assert
|
||||
result.HasFlips.Should().BeTrue();
|
||||
@@ -352,7 +356,7 @@ public sealed class StateFlipDetectorTests
|
||||
};
|
||||
|
||||
// Act
|
||||
var result = await _detector.DetectFlipsAsync(previous, current);
|
||||
var result = await _detector.DetectFlipsAsync(previous, current, TestCancellationToken);
|
||||
|
||||
// Assert
|
||||
result.NewRiskCount.Should().Be(2); // E2->S2 became reachable, E3->S3 new
|
||||
|
||||
Reference in New Issue
Block a user