Refactor code structure and optimize performance across multiple modules
This commit is contained in:
@@ -55,7 +55,8 @@ public class UnknownsDecayServiceTests
|
||||
|
||||
#region ApplyDecayAsync Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ApplyDecayAsync_EmptySubject_ReturnsZeroCounts()
|
||||
{
|
||||
var (decayService, _) = CreateServices();
|
||||
@@ -70,7 +71,8 @@ public class UnknownsDecayServiceTests
|
||||
Assert.Equal(0, result.BandChanges);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ApplyDecayAsync_SingleUnknown_UpdatesAndPersists()
|
||||
{
|
||||
var (decayService, _) = CreateServices();
|
||||
@@ -100,7 +102,8 @@ public class UnknownsDecayServiceTests
|
||||
Assert.True(updated[0].UpdatedAt >= now);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ApplyDecayAsync_BandChangesTracked()
|
||||
{
|
||||
var (decayService, _) = CreateServices();
|
||||
@@ -136,7 +139,8 @@ public class UnknownsDecayServiceTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ApplyDecayAsync_MultipleUnknowns_ProcessesAll()
|
||||
{
|
||||
var (decayService, _) = CreateServices();
|
||||
@@ -186,7 +190,8 @@ public class UnknownsDecayServiceTests
|
||||
|
||||
#region RunNightlyDecayBatchAsync Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task RunNightlyDecayBatchAsync_ProcessesAllSubjects()
|
||||
{
|
||||
var (decayService, _) = CreateServices();
|
||||
@@ -224,7 +229,8 @@ public class UnknownsDecayServiceTests
|
||||
Assert.True(result.Duration >= TimeSpan.Zero);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task RunNightlyDecayBatchAsync_RespectsMaxSubjectsLimit()
|
||||
{
|
||||
var decayOptions = new UnknownsDecayOptions { MaxSubjectsPerBatch = 1 };
|
||||
@@ -278,7 +284,8 @@ public class UnknownsDecayServiceTests
|
||||
Assert.Equal(1, result.TotalUnknowns);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task RunNightlyDecayBatchAsync_CancellationRespected()
|
||||
{
|
||||
var (decayService, _) = CreateServices();
|
||||
@@ -301,6 +308,7 @@ public class UnknownsDecayServiceTests
|
||||
}
|
||||
|
||||
using var cts = new CancellationTokenSource();
|
||||
using StellaOps.TestKit;
|
||||
cts.Cancel();
|
||||
|
||||
await Assert.ThrowsAsync<OperationCanceledException>(() =>
|
||||
@@ -311,7 +319,8 @@ public class UnknownsDecayServiceTests
|
||||
|
||||
#region ApplyDecayToUnknownAsync Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ApplyDecayToUnknownAsync_UpdatesScoringFields()
|
||||
{
|
||||
var (decayService, _) = CreateServices();
|
||||
@@ -342,7 +351,8 @@ public class UnknownsDecayServiceTests
|
||||
Assert.NotNull(result.NormalizationTrace);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ApplyDecayToUnknownAsync_SetsNextRescanBasedOnBand()
|
||||
{
|
||||
var (decayService, _) = CreateServices();
|
||||
@@ -368,7 +378,8 @@ public class UnknownsDecayServiceTests
|
||||
|
||||
#region Decay Result Aggregation Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ApplyDecayAsync_ResultCountsAreAccurate()
|
||||
{
|
||||
var (decayService, _) = CreateServices();
|
||||
|
||||
Reference in New Issue
Block a user