Refactor code structure and optimize performance across multiple modules
This commit is contained in:
@@ -10,6 +10,7 @@ using System.Text.Json;
|
||||
using StellaOps.Scanner.WebService.Contracts;
|
||||
using Xunit;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Scanner.WebService.Tests;
|
||||
|
||||
public class FindingEvidenceContractsTests
|
||||
@@ -20,7 +21,8 @@ public class FindingEvidenceContractsTests
|
||||
WriteIndented = false
|
||||
};
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void FindingEvidenceResponse_SerializesToSnakeCase()
|
||||
{
|
||||
var response = new FindingEvidenceResponse
|
||||
@@ -49,7 +51,8 @@ public class FindingEvidenceContractsTests
|
||||
Assert.Contains("\"freshness\":", json);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void FindingEvidenceResponse_RoundTripsCorrectly()
|
||||
{
|
||||
var original = new FindingEvidenceResponse
|
||||
@@ -98,7 +101,8 @@ public class FindingEvidenceContractsTests
|
||||
Assert.Equal(original.Score?.RiskScore, deserialized.Score?.RiskScore);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ComponentInfo_SerializesAllFields()
|
||||
{
|
||||
var component = new ComponentInfo
|
||||
@@ -117,7 +121,8 @@ public class FindingEvidenceContractsTests
|
||||
Assert.Contains("\"ecosystem\":\"nuget\"", json);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void EntrypointInfo_SerializesAllFields()
|
||||
{
|
||||
var entrypoint = new EntrypointInfo
|
||||
@@ -136,7 +141,8 @@ public class FindingEvidenceContractsTests
|
||||
Assert.Contains("\"auth\":\"mtls\"", json);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void BoundaryInfo_SerializesWithControls()
|
||||
{
|
||||
var boundary = new BoundaryInfo
|
||||
@@ -153,7 +159,8 @@ public class FindingEvidenceContractsTests
|
||||
Assert.Contains("\"controls\":[\"waf\",\"rate_limit\"]", json);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void VexStatusInfo_SerializesCorrectly()
|
||||
{
|
||||
var vex = new VexStatusInfo
|
||||
@@ -171,7 +178,8 @@ public class FindingEvidenceContractsTests
|
||||
Assert.Contains("\"issuer\":\"vendor\"", json);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ScoreInfo_SerializesContributions()
|
||||
{
|
||||
var score = new ScoreInfo
|
||||
@@ -201,7 +209,8 @@ public class FindingEvidenceContractsTests
|
||||
Assert.Contains("\"factor\":\"reachability\"", json);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void FreshnessInfo_SerializesCorrectly()
|
||||
{
|
||||
var freshness = new FreshnessInfo
|
||||
@@ -218,7 +227,8 @@ public class FindingEvidenceContractsTests
|
||||
Assert.Contains("\"ttl_remaining_hours\":0", json);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void NullOptionalFields_AreOmittedOrNullInJson()
|
||||
{
|
||||
var response = new FindingEvidenceResponse
|
||||
|
||||
Reference in New Issue
Block a user