Refactor code structure and optimize performance across multiple modules
This commit is contained in:
@@ -5,13 +5,15 @@ using System.Collections.Immutable;
|
||||
using FluentAssertions;
|
||||
using StellaOps.Scanner.Emit.Lineage;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Scanner.Emit.Lineage.Tests;
|
||||
|
||||
public class SbomLineageTests
|
||||
{
|
||||
#region SbomId Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void SbomId_New_CreatesUniqueId()
|
||||
{
|
||||
var id1 = SbomId.New();
|
||||
@@ -20,7 +22,8 @@ public class SbomLineageTests
|
||||
id1.Should().NotBe(id2);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void SbomId_Parse_RoundTrips()
|
||||
{
|
||||
var original = SbomId.New();
|
||||
@@ -29,7 +32,8 @@ public class SbomLineageTests
|
||||
parsed.Should().Be(original);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void SbomId_ToString_ReturnsGuidString()
|
||||
{
|
||||
var id = SbomId.New();
|
||||
@@ -42,7 +46,8 @@ public class SbomLineageTests
|
||||
|
||||
#region SbomLineage Model Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void SbomLineage_RequiredProperties_MustBeSet()
|
||||
{
|
||||
var lineage = new SbomLineage
|
||||
@@ -58,7 +63,8 @@ public class SbomLineageTests
|
||||
lineage.ContentHash.Should().Be("sha256:def456");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void SbomLineage_WithParent_TracksLineage()
|
||||
{
|
||||
var parentId = SbomId.New();
|
||||
@@ -78,7 +84,8 @@ public class SbomLineageTests
|
||||
child.Ancestors.Should().Contain(parentId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void SbomLineage_WithDiffPointer_TracksChanges()
|
||||
{
|
||||
var diff = new SbomDiffPointer
|
||||
@@ -103,7 +110,8 @@ public class SbomLineageTests
|
||||
lineage.DiffFromParent!.TotalChanges.Should().Be(10);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void SbomLineage_RootLineage_HasNoParent()
|
||||
{
|
||||
var root = new SbomLineage
|
||||
@@ -123,7 +131,8 @@ public class SbomLineageTests
|
||||
|
||||
#region SbomDiffPointer Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void SbomDiffPointer_TotalChanges_SumsAllCategories()
|
||||
{
|
||||
var pointer = new SbomDiffPointer
|
||||
@@ -137,7 +146,8 @@ public class SbomLineageTests
|
||||
pointer.TotalChanges.Should().Be(23);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void SbomDiffPointer_EmptyDiff_HasZeroChanges()
|
||||
{
|
||||
var pointer = new SbomDiffPointer
|
||||
|
||||
Reference in New Issue
Block a user