Refactor code structure and optimize performance across multiple modules
This commit is contained in:
@@ -4,9 +4,11 @@ using FluentAssertions;
|
||||
using StellaOps.Feedser.Core;
|
||||
using Xunit;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
public sealed class HunkSigExtractorTests
|
||||
{
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ExtractFromDiff_SimpleAddition_ExtractsPatchSignature()
|
||||
{
|
||||
// Arrange
|
||||
@@ -35,7 +37,8 @@ public sealed class HunkSigExtractorTests
|
||||
result.PatchSigId.Should().StartWith("sha256:");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ExtractFromDiff_MultipleHunks_ExtractsAllHunks()
|
||||
{
|
||||
// Arrange
|
||||
@@ -66,7 +69,8 @@ public sealed class HunkSigExtractorTests
|
||||
result.AffectedFiles.Should().Contain("src/file2.c");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ExtractFromDiff_Removal_ExtractsRemovedLines()
|
||||
{
|
||||
// Arrange
|
||||
@@ -91,7 +95,8 @@ public sealed class HunkSigExtractorTests
|
||||
hunk.AddedLines.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ExtractFromDiff_NormalizesWhitespace()
|
||||
{
|
||||
// Arrange
|
||||
@@ -120,7 +125,8 @@ public sealed class HunkSigExtractorTests
|
||||
// Note: Exact match depends on normalization strategy
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ExtractFromDiff_EmptyDiff_ReturnsNoHunks()
|
||||
{
|
||||
// Arrange
|
||||
@@ -138,7 +144,8 @@ public sealed class HunkSigExtractorTests
|
||||
result.AffectedFiles.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ExtractFromDiff_MultipleChangesInOneHunk_CombinesCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
@@ -169,7 +176,8 @@ public sealed class HunkSigExtractorTests
|
||||
hunk.RemovedLines.Should().HaveCount(2);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ExtractFromDiff_DeterministicHashing_ProducesSameHashForSameContent()
|
||||
{
|
||||
// Arrange
|
||||
@@ -189,7 +197,8 @@ public sealed class HunkSigExtractorTests
|
||||
result1.PatchSigId.Should().Be(result2.PatchSigId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ExtractFromDiff_AffectedFiles_AreSortedAlphabetically()
|
||||
{
|
||||
// Arrange
|
||||
@@ -213,7 +222,8 @@ public sealed class HunkSigExtractorTests
|
||||
result.AffectedFiles.Should().Equal("aaa.c", "mmm.c", "zzz.c");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ExtractFromDiff_ExtractorVersion_IsRecorded()
|
||||
{
|
||||
// Arrange
|
||||
@@ -230,7 +240,8 @@ public sealed class HunkSigExtractorTests
|
||||
result.ExtractorVersion.Should().MatchRegex(@"\d+\.\d+\.\d+");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ExtractFromDiff_ExtractedAt_IsRecent()
|
||||
{
|
||||
// Arrange
|
||||
@@ -249,7 +260,8 @@ public sealed class HunkSigExtractorTests
|
||||
result.ExtractedAt.Should().BeBefore(after);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ExtractFromDiff_ContextLines_ArePreserved()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\StellaOps.Feedser.Core\StellaOps.Feedser.Core.csproj" />
|
||||
<ProjectReference Include="../../../__Libraries/StellaOps.TestKit/StellaOps.TestKit.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user