Refactor code structure and optimize performance across multiple modules
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using StellaOps.Scanner.Reachability.Gates;
|
||||
using Xunit;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Scanner.Reachability.Tests;
|
||||
|
||||
/// <summary>
|
||||
@@ -9,7 +10,8 @@ namespace StellaOps.Scanner.Reachability.Tests;
|
||||
/// </summary>
|
||||
public sealed class GateDetectionTests
|
||||
{
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void GateDetectionResult_Empty_HasNoGates()
|
||||
{
|
||||
Assert.False(GateDetectionResult.Empty.HasGates);
|
||||
@@ -17,7 +19,8 @@ public sealed class GateDetectionTests
|
||||
Assert.Null(GateDetectionResult.Empty.PrimaryGate);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void GateDetectionResult_WithGates_HasPrimaryGate()
|
||||
{
|
||||
var gates = new[]
|
||||
@@ -33,7 +36,8 @@ public sealed class GateDetectionTests
|
||||
Assert.Equal(GateType.FeatureFlag, result.PrimaryGate?.Type);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void GateMultiplierConfig_Default_HasExpectedValues()
|
||||
{
|
||||
var config = GateMultiplierConfig.Default;
|
||||
@@ -45,7 +49,8 @@ public sealed class GateDetectionTests
|
||||
Assert.Equal(500, config.MinimumMultiplierBps);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task CompositeGateDetector_NoDetectors_ReturnsEmpty()
|
||||
{
|
||||
var detector = new CompositeGateDetector([]);
|
||||
@@ -57,7 +62,8 @@ public sealed class GateDetectionTests
|
||||
Assert.Equal(10000, result.CombinedMultiplierBps);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task CompositeGateDetector_EmptyCallPath_ReturnsEmpty()
|
||||
{
|
||||
var detector = new CompositeGateDetector([new MockAuthDetector()]);
|
||||
@@ -68,7 +74,8 @@ public sealed class GateDetectionTests
|
||||
Assert.False(result.HasGates);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task CompositeGateDetector_SingleGate_AppliesMultiplier()
|
||||
{
|
||||
var authDetector = new MockAuthDetector(
|
||||
@@ -83,7 +90,8 @@ public sealed class GateDetectionTests
|
||||
Assert.Equal(3000, result.CombinedMultiplierBps);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task CompositeGateDetector_MultipleGateTypes_MultipliesMultipliers()
|
||||
{
|
||||
var authDetector = new MockAuthDetector(
|
||||
@@ -101,7 +109,8 @@ public sealed class GateDetectionTests
|
||||
Assert.Equal(600, result.CombinedMultiplierBps);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task CompositeGateDetector_DuplicateGates_Deduplicates()
|
||||
{
|
||||
var authDetector1 = new MockAuthDetector(
|
||||
@@ -118,7 +127,8 @@ public sealed class GateDetectionTests
|
||||
Assert.Equal(0.9, result.Gates[0].Confidence);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task CompositeGateDetector_AllGateTypes_AppliesMinimumFloor()
|
||||
{
|
||||
var detectors = new IGateDetector[]
|
||||
@@ -138,7 +148,8 @@ public sealed class GateDetectionTests
|
||||
Assert.Equal(500, result.CombinedMultiplierBps);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task CompositeGateDetector_DetectorException_ContinuesWithOthers()
|
||||
{
|
||||
var failingDetector = new FailingGateDetector();
|
||||
|
||||
Reference in New Issue
Block a user