Refactor code structure and optimize performance across multiple modules
This commit is contained in:
@@ -10,6 +10,7 @@ using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Moq;
|
||||
using StellaOps.Concelier.Merge.Backport;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Concelier.Merge.Tests;
|
||||
|
||||
/// <summary>
|
||||
@@ -34,7 +35,8 @@ public sealed class ProvenanceScopeLifecycleTests
|
||||
|
||||
#region CreateOrUpdateAsync Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task CreateOrUpdateAsync_NewScope_CreatesProvenanceScope()
|
||||
{
|
||||
// Arrange
|
||||
@@ -74,7 +76,8 @@ public sealed class ProvenanceScopeLifecycleTests
|
||||
Times.Once);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task CreateOrUpdateAsync_ExistingScope_UpdatesProvenanceScope()
|
||||
{
|
||||
// Arrange
|
||||
@@ -117,7 +120,8 @@ public sealed class ProvenanceScopeLifecycleTests
|
||||
result.ProvenanceScopeId.Should().Be(existingScopeId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task CreateOrUpdateAsync_WithEvidenceResolver_ResolvesEvidence()
|
||||
{
|
||||
// Arrange
|
||||
@@ -171,7 +175,8 @@ public sealed class ProvenanceScopeLifecycleTests
|
||||
Times.Once);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task CreateOrUpdateAsync_NonDistroSource_StillCreatesScope()
|
||||
{
|
||||
// Arrange
|
||||
@@ -204,7 +209,8 @@ public sealed class ProvenanceScopeLifecycleTests
|
||||
|
||||
#region UpdateFromEvidenceAsync Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task UpdateFromEvidenceAsync_NewEvidence_CreatesScope()
|
||||
{
|
||||
// Arrange
|
||||
@@ -246,7 +252,8 @@ public sealed class ProvenanceScopeLifecycleTests
|
||||
Times.Once);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task UpdateFromEvidenceAsync_BetterEvidence_UpdatesScope()
|
||||
{
|
||||
// Arrange
|
||||
@@ -300,7 +307,8 @@ public sealed class ProvenanceScopeLifecycleTests
|
||||
Times.Once);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task UpdateFromEvidenceAsync_LowerConfidenceEvidence_SkipsUpdate()
|
||||
{
|
||||
// Arrange
|
||||
@@ -352,7 +360,8 @@ public sealed class ProvenanceScopeLifecycleTests
|
||||
|
||||
#region LinkEvidenceRefAsync Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task LinkEvidenceRefAsync_LinksEvidenceToScope()
|
||||
{
|
||||
// Arrange
|
||||
@@ -374,7 +383,8 @@ public sealed class ProvenanceScopeLifecycleTests
|
||||
|
||||
#region GetByCanonicalIdAsync Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task GetByCanonicalIdAsync_ReturnsAllScopes()
|
||||
{
|
||||
// Arrange
|
||||
@@ -418,7 +428,8 @@ public sealed class ProvenanceScopeLifecycleTests
|
||||
|
||||
#region DeleteByCanonicalIdAsync Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task DeleteByCanonicalIdAsync_DeletesAllScopes()
|
||||
{
|
||||
// Arrange
|
||||
@@ -439,7 +450,8 @@ public sealed class ProvenanceScopeLifecycleTests
|
||||
|
||||
#region Distro Release Extraction Tests
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Theory]
|
||||
[InlineData("pkg:deb/debian/curl@7.64.0-4+deb11u1", "debian", "debian:bullseye")]
|
||||
[InlineData("pkg:deb/debian/openssl@3.0.11-1~deb12u2", "debian", "debian:bookworm")]
|
||||
[InlineData("pkg:rpm/redhat/nginx@1.20.1-14.el9", "redhat", "redhat:9")]
|
||||
|
||||
Reference in New Issue
Block a user