Refactor code structure and optimize performance across multiple modules
This commit is contained in:
@@ -2,11 +2,13 @@ using System;
|
||||
using StellaOps.Concelier.Models;
|
||||
using Xunit;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Concelier.Models.Tests;
|
||||
|
||||
public sealed class AdvisoryProvenanceTests
|
||||
{
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void FieldMask_NormalizesAndDeduplicates()
|
||||
{
|
||||
var timestamp = DateTimeOffset.Parse("2025-01-01T00:00:00Z");
|
||||
@@ -25,14 +27,16 @@ public sealed class AdvisoryProvenanceTests
|
||||
Assert.Null(provenance.DecisionReason);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void EmptyProvenance_ExposesEmptyFieldMask()
|
||||
{
|
||||
Assert.True(AdvisoryProvenance.Empty.FieldMask.IsEmpty);
|
||||
Assert.Null(AdvisoryProvenance.Empty.DecisionReason);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void DecisionReason_IsTrimmed()
|
||||
{
|
||||
var timestamp = DateTimeOffset.Parse("2025-03-01T00:00:00Z");
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
using System.Linq;
|
||||
using StellaOps.Concelier.Models;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Concelier.Models.Tests;
|
||||
|
||||
public sealed class AdvisoryTests
|
||||
{
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void CanonicalizesAliasesAndReferences()
|
||||
{
|
||||
var advisory = new Advisory(
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
using System;
|
||||
using StellaOps.Concelier.Models;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Concelier.Models.Tests;
|
||||
|
||||
public sealed class AffectedPackageStatusTests
|
||||
{
|
||||
[Theory]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Theory]
|
||||
[InlineData("Known_Affected", AffectedPackageStatusCatalog.KnownAffected)]
|
||||
[InlineData("KNOWN-NOT-AFFECTED", AffectedPackageStatusCatalog.KnownNotAffected)]
|
||||
[InlineData("Under Investigation", AffectedPackageStatusCatalog.UnderInvestigation)]
|
||||
@@ -28,14 +30,16 @@ public sealed class AffectedPackageStatusTests
|
||||
Assert.Equal(provenance, status.Provenance);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Constructor_ThrowsForUnknownStatus()
|
||||
{
|
||||
var provenance = new AdvisoryProvenance("test", "status", "value", DateTimeOffset.UtcNow);
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => new AffectedPackageStatus("unsupported", provenance));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Theory]
|
||||
[InlineData("Not Impacted", AffectedPackageStatusCatalog.NotAffected)]
|
||||
[InlineData("Resolved", AffectedPackageStatusCatalog.Fixed)]
|
||||
[InlineData("Mitigation provided", AffectedPackageStatusCatalog.Mitigated)]
|
||||
@@ -46,13 +50,15 @@ public sealed class AffectedPackageStatusTests
|
||||
Assert.Equal(expected, normalized);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void TryNormalize_ReturnsFalseForUnknown()
|
||||
{
|
||||
Assert.False(AffectedPackageStatusCatalog.TryNormalize("unsupported", out _));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Allowed_ReturnsCanonicalStatuses()
|
||||
{
|
||||
var expected = new[]
|
||||
|
||||
@@ -2,11 +2,13 @@ using System;
|
||||
using StellaOps.Concelier.Models;
|
||||
using Xunit;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Concelier.Models.Tests;
|
||||
|
||||
public sealed class AffectedVersionRangeExtensionsTests
|
||||
{
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ToNormalizedVersionRule_UsesNevraPrimitivesWhenAvailable()
|
||||
{
|
||||
var range = new AffectedVersionRange(
|
||||
@@ -33,7 +35,8 @@ public sealed class AffectedVersionRangeExtensionsTests
|
||||
Assert.Equal("pkg-1.2.0-2.x86_64", rule.Max);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ToNormalizedVersionRule_FallsBackForEvrWhenPrimitivesMissing()
|
||||
{
|
||||
var range = new AffectedVersionRange(
|
||||
@@ -55,7 +58,8 @@ public sealed class AffectedVersionRangeExtensionsTests
|
||||
Assert.Equal("fallback", rule.Notes);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ToNormalizedVersionRule_ReturnsNullForUnknownKind()
|
||||
{
|
||||
var range = new AffectedVersionRange(
|
||||
@@ -72,7 +76,8 @@ public sealed class AffectedVersionRangeExtensionsTests
|
||||
Assert.Null(rule);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ToNormalizedVersionRule_FallsBackForApkRange()
|
||||
{
|
||||
var range = new AffectedVersionRange(
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using StellaOps.Concelier.Models;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Concelier.Models.Tests;
|
||||
|
||||
public sealed class AliasSchemeRegistryTests
|
||||
{
|
||||
[Theory]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Theory]
|
||||
[InlineData("cve-2024-1234", AliasSchemes.Cve, "CVE-2024-1234")]
|
||||
[InlineData("GHSA-xxxx-yyyy-zzzz", AliasSchemes.Ghsa, "GHSA-xxxx-yyyy-zzzz")]
|
||||
[InlineData("osv-2023-15", AliasSchemes.OsV, "OSV-2023-15")]
|
||||
@@ -21,7 +23,8 @@ public sealed class AliasSchemeRegistryTests
|
||||
Assert.Equal(expectedAlias, normalized);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void TryNormalize_ReturnsFalseForUnknownAlias()
|
||||
{
|
||||
var success = AliasSchemeRegistry.TryNormalize("custom-identifier", out var normalized, out var scheme);
|
||||
@@ -31,7 +34,8 @@ public sealed class AliasSchemeRegistryTests
|
||||
Assert.Equal(string.Empty, scheme);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Validation_NormalizesAliasWhenRecognized()
|
||||
{
|
||||
var result = Validation.TryNormalizeAlias(" rhsa-2024:0252 ", out var normalized);
|
||||
@@ -41,7 +45,8 @@ public sealed class AliasSchemeRegistryTests
|
||||
Assert.Equal("RHSA-2024:0252", normalized);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Validation_RejectsEmptyAlias()
|
||||
{
|
||||
var result = Validation.TryNormalizeAlias(" ", out var normalized);
|
||||
|
||||
@@ -8,7 +8,8 @@ namespace StellaOps.Concelier.Models.Tests;
|
||||
|
||||
public sealed class CanonicalJsonSerializerTests
|
||||
{
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void SerializesPropertiesInDeterministicOrder()
|
||||
{
|
||||
var advisory = new Advisory(
|
||||
@@ -34,7 +35,8 @@ public sealed class CanonicalJsonSerializerTests
|
||||
Assert.Equal(sorted, propertyNames);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void SnapshotSerializerProducesStableOutput()
|
||||
{
|
||||
var advisory = new Advisory(
|
||||
@@ -64,7 +66,8 @@ public sealed class CanonicalJsonSerializerTests
|
||||
Assert.Equal(normalized1, normalized2);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void SerializesRangePrimitivesPayload()
|
||||
{
|
||||
var recordedAt = new DateTimeOffset(2025, 2, 1, 0, 0, 0, TimeSpan.Zero);
|
||||
@@ -125,6 +128,7 @@ public sealed class CanonicalJsonSerializerTests
|
||||
|
||||
var json = CanonicalJsonSerializer.Serialize(advisory);
|
||||
using var document = JsonDocument.Parse(json);
|
||||
using StellaOps.TestKit;
|
||||
var rangeElement = document.RootElement
|
||||
.GetProperty("affectedPackages")[0]
|
||||
.GetProperty("versionRanges")[0];
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
using StellaOps.Concelier.Models;
|
||||
using Xunit;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Concelier.Models.Tests;
|
||||
|
||||
public sealed class EvrPrimitiveExtensionsTests
|
||||
{
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ToNormalizedVersionRule_ProducesRangeForIntroducedAndFixed()
|
||||
{
|
||||
var primitive = new EvrPrimitive(
|
||||
@@ -25,7 +27,8 @@ public sealed class EvrPrimitiveExtensionsTests
|
||||
Assert.Equal("ubuntu:focal", rule.Notes);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ToNormalizedVersionRule_GreaterThanOrEqualWhenOnlyIntroduced()
|
||||
{
|
||||
var primitive = new EvrPrimitive(
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
using StellaOps.Concelier.Models;
|
||||
using Xunit;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Concelier.Models.Tests;
|
||||
|
||||
public sealed class NevraPrimitiveExtensionsTests
|
||||
{
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ToNormalizedVersionRule_ProducesRangeWhenBoundsAvailable()
|
||||
{
|
||||
var primitive = new NevraPrimitive(
|
||||
@@ -25,7 +27,8 @@ public sealed class NevraPrimitiveExtensionsTests
|
||||
Assert.Equal("rhel-8", rule.Notes);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ToNormalizedVersionRule_UsesLastAffectedAsInclusiveUpperBound()
|
||||
{
|
||||
var primitive = new NevraPrimitive(
|
||||
|
||||
@@ -3,11 +3,13 @@ using System.Linq;
|
||||
using StellaOps.Concelier.Models;
|
||||
using Xunit;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Concelier.Models.Tests;
|
||||
|
||||
public sealed class NormalizedVersionRuleTests
|
||||
{
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void NormalizedVersions_AreDeduplicatedAndOrdered()
|
||||
{
|
||||
var recordedAt = DateTimeOffset.Parse("2025-01-05T00:00:00Z");
|
||||
@@ -59,7 +61,8 @@ public sealed class NormalizedVersionRuleTests
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void NormalizedVersionRule_NormalizesTypeSeparators()
|
||||
{
|
||||
var rule = new NormalizedVersionRule("semver", "tie_breaker", value: "1.2.3");
|
||||
|
||||
@@ -9,7 +9,8 @@ namespace StellaOps.Concelier.Models.Tests;
|
||||
|
||||
public sealed class OsvGhsaParityDiagnosticsTests
|
||||
{
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void RecordReport_EmitsTotalAndIssues()
|
||||
{
|
||||
var issues = ImmutableArray.Create(
|
||||
@@ -45,13 +46,15 @@ public sealed class OsvGhsaParityDiagnosticsTests
|
||||
Assert.Equal("none", severity.Tags["fieldMask"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void RecordReport_NoIssues_OnlyEmitsTotal()
|
||||
{
|
||||
var report = new OsvGhsaParityReport(0, ImmutableArray<OsvGhsaParityIssue>.Empty);
|
||||
var measurements = new List<(string Instrument, long Value, IReadOnlyDictionary<string, object?> Tags)>();
|
||||
using var listener = CreateListener(measurements);
|
||||
|
||||
using StellaOps.TestKit;
|
||||
OsvGhsaParityDiagnostics.RecordReport(report, "");
|
||||
|
||||
listener.Dispose();
|
||||
|
||||
@@ -3,11 +3,13 @@ using System.Collections.Generic;
|
||||
using StellaOps.Concelier.Models;
|
||||
using Xunit;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Concelier.Models.Tests;
|
||||
|
||||
public sealed class OsvGhsaParityInspectorTests
|
||||
{
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Compare_ReturnsNoIssues_WhenDatasetsMatch()
|
||||
{
|
||||
var ghsaId = "GHSA-1111";
|
||||
@@ -21,7 +23,8 @@ public sealed class OsvGhsaParityInspectorTests
|
||||
Assert.Empty(report.Issues);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Compare_FlagsMissingOsvEntry()
|
||||
{
|
||||
var ghsaId = "GHSA-2222";
|
||||
@@ -35,7 +38,8 @@ public sealed class OsvGhsaParityInspectorTests
|
||||
Assert.Contains(ProvenanceFieldMasks.AffectedPackages, issue.FieldMask);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Compare_FlagsMissingGhsaEntry()
|
||||
{
|
||||
var ghsaId = "GHSA-2424";
|
||||
@@ -49,7 +53,8 @@ public sealed class OsvGhsaParityInspectorTests
|
||||
Assert.Contains(ProvenanceFieldMasks.AffectedPackages, issue.FieldMask);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Compare_FlagsSeverityMismatch()
|
||||
{
|
||||
var ghsaId = "GHSA-3333";
|
||||
@@ -63,7 +68,8 @@ public sealed class OsvGhsaParityInspectorTests
|
||||
Assert.Contains(ProvenanceFieldMasks.Advisory, issue.FieldMask);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Compare_FlagsRangeMismatch()
|
||||
{
|
||||
var ghsaId = "GHSA-4444";
|
||||
|
||||
@@ -11,7 +11,8 @@ namespace StellaOps.Concelier.Models.Tests;
|
||||
|
||||
public sealed class ProvenanceDiagnosticsTests
|
||||
{
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void RecordMissing_AddsExpectedTagsAndDeduplicates()
|
||||
{
|
||||
ResetState();
|
||||
@@ -44,7 +45,8 @@ public sealed class ProvenanceDiagnosticsTests
|
||||
Assert.Equal(ProvenanceFieldMasks.References, second.Tags["fieldMask"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ReportResumeWindow_ClearsTrackedEntries_WhenWindowBackfills()
|
||||
{
|
||||
ResetState();
|
||||
@@ -68,7 +70,8 @@ public sealed class ProvenanceDiagnosticsTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ReportResumeWindow_RetainsEntries_WhenWindowTooRecent()
|
||||
{
|
||||
ResetState();
|
||||
@@ -86,7 +89,8 @@ public sealed class ProvenanceDiagnosticsTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void RecordRangePrimitive_EmitsCoverageMetric()
|
||||
{
|
||||
var range = new AffectedVersionRange(
|
||||
@@ -108,6 +112,7 @@ public sealed class ProvenanceDiagnosticsTests
|
||||
var measurements = new List<(string Instrument, long Value, IReadOnlyDictionary<string, object?> Tags)>();
|
||||
using var listener = CreateListener(measurements, "concelier.range.primitives");
|
||||
|
||||
using StellaOps.TestKit;
|
||||
ProvenanceDiagnostics.RecordRangePrimitive("source-D", range);
|
||||
|
||||
listener.Dispose();
|
||||
|
||||
@@ -2,11 +2,13 @@ using System.Collections.Generic;
|
||||
using StellaOps.Concelier.Models;
|
||||
using Xunit;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Concelier.Models.Tests;
|
||||
|
||||
public sealed class RangePrimitivesTests
|
||||
{
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void GetCoverageTag_ReturnsSpecificKinds()
|
||||
{
|
||||
var primitives = new RangePrimitives(
|
||||
@@ -18,7 +20,8 @@ public sealed class RangePrimitivesTests
|
||||
Assert.Equal("nevra+semver", primitives.GetCoverageTag());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void GetCoverageTag_ReturnsVendorWhenOnlyExtensions()
|
||||
{
|
||||
var primitives = new RangePrimitives(
|
||||
@@ -31,7 +34,8 @@ public sealed class RangePrimitivesTests
|
||||
Assert.Equal("vendor", primitives.GetCoverageTag());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void GetCoverageTag_ReturnsNoneWhenEmpty()
|
||||
{
|
||||
var primitives = new RangePrimitives(null, null, null, null);
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
using StellaOps.Concelier.Models;
|
||||
using Xunit;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Concelier.Models.Tests;
|
||||
|
||||
public sealed class SemVerPrimitiveTests
|
||||
{
|
||||
[Theory]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Theory]
|
||||
[InlineData("1.0.0", true, "2.0.0", false, null, false, null, null, SemVerPrimitiveStyles.Range)]
|
||||
[InlineData("1.0.0", true, null, false, null, false, null, null, SemVerPrimitiveStyles.GreaterThanOrEqual)]
|
||||
[InlineData("1.0.0", false, null, false, null, false, null, null, SemVerPrimitiveStyles.GreaterThan)]
|
||||
@@ -38,7 +40,8 @@ public sealed class SemVerPrimitiveTests
|
||||
Assert.Equal(expectedStyle, primitive.Style);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void EqualityIncludesExactValue()
|
||||
{
|
||||
var baseline = new SemVerPrimitive(
|
||||
@@ -57,7 +60,8 @@ public sealed class SemVerPrimitiveTests
|
||||
Assert.Equal(SemVerPrimitiveStyles.Range, baseline.Style);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ToNormalizedVersionRule_MapsRangeBounds()
|
||||
{
|
||||
var primitive = new SemVerPrimitive(
|
||||
@@ -82,7 +86,8 @@ public sealed class SemVerPrimitiveTests
|
||||
Assert.Equal(">=1.0.0 <2.0.0", rule.Notes);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ToNormalizedVersionRule_ExactUsesExactValue()
|
||||
{
|
||||
var primitive = new SemVerPrimitive(
|
||||
@@ -106,7 +111,8 @@ public sealed class SemVerPrimitiveTests
|
||||
Assert.Equal("from-ghsa", rule.Notes);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ToNormalizedVersionRule_GreaterThanMapsMinimum()
|
||||
{
|
||||
var primitive = new SemVerPrimitive(
|
||||
@@ -130,7 +136,8 @@ public sealed class SemVerPrimitiveTests
|
||||
Assert.Null(rule.Notes);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ToNormalizedVersionRule_UsesConstraintExpressionAsFallbackNotes()
|
||||
{
|
||||
var primitive = new SemVerPrimitive(
|
||||
@@ -148,7 +155,8 @@ public sealed class SemVerPrimitiveTests
|
||||
Assert.Equal("> 1.4.0", rule!.Notes);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ToNormalizedVersionRule_ExactCarriesConstraintExpressionWhenNotesMissing()
|
||||
{
|
||||
var primitive = new SemVerPrimitive(
|
||||
@@ -169,7 +177,8 @@ public sealed class SemVerPrimitiveTests
|
||||
Assert.Equal("= 3.2.1", rule.Notes);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ToNormalizedVersionRule_ExplicitNotesOverrideConstraintExpression()
|
||||
{
|
||||
var primitive = new SemVerPrimitive(
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using StellaOps.Concelier.Models;
|
||||
using Xunit;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Concelier.Models.Tests;
|
||||
|
||||
public sealed class SerializationDeterminismTests
|
||||
@@ -18,7 +19,8 @@ public sealed class SerializationDeterminismTests
|
||||
"ar-SA"
|
||||
};
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void CanonicalSerializer_ProducesStableJsonAcrossCultures()
|
||||
{
|
||||
var examples = CanonicalExampleFactory.GetExamples().ToArray();
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using StellaOps.Concelier.Models;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Concelier.Models.Tests;
|
||||
|
||||
public sealed class SeverityNormalizationTests
|
||||
{
|
||||
[Theory]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Theory]
|
||||
[InlineData("CRITICAL", "critical")]
|
||||
[InlineData("Important", "high")]
|
||||
[InlineData("moderate", "medium")]
|
||||
@@ -27,7 +29,8 @@ public sealed class SeverityNormalizationTests
|
||||
Assert.Equal(expected, normalized);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Normalize_ReturnsNullWhenInputNullOrWhitespace()
|
||||
{
|
||||
Assert.Null(SeverityNormalization.Normalize(null));
|
||||
|
||||
Reference in New Issue
Block a user