30 lines
965 B
C#
30 lines
965 B
C#
using System.Text.Json;
|
|
using StellaOps.Policy;
|
|
using Xunit;
|
|
|
|
namespace StellaOps.Policy.Tests;
|
|
|
|
public class SplSchemaResourceTests
|
|
{
|
|
[Fact]
|
|
public void Schema_IncludesReachabilityAndExploitability()
|
|
{
|
|
var schema = SplSchemaResource.GetSchema();
|
|
using var doc = JsonDocument.Parse(schema);
|
|
var match = doc.RootElement
|
|
.GetProperty("properties")
|
|
.GetProperty("spec")
|
|
.GetProperty("properties")
|
|
.GetProperty("statements")
|
|
.GetProperty("items")
|
|
.GetProperty("properties")
|
|
.GetProperty("match")
|
|
.GetProperty("properties");
|
|
|
|
Assert.True(match.TryGetProperty("reachability", out var reachability));
|
|
Assert.Equal(JsonValueKind.Object, reachability.ValueKind);
|
|
Assert.True(match.TryGetProperty("exploitability", out var exploitability));
|
|
Assert.Equal(JsonValueKind.Object, exploitability.ValueKind);
|
|
}
|
|
}
|