Refactor code structure and optimize performance across multiple modules
This commit is contained in:
@@ -11,6 +11,8 @@ using StellaOps.Signals.Persistence;
|
||||
using StellaOps.Signals.Services;
|
||||
using Xunit;
|
||||
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Signals.Tests;
|
||||
|
||||
public class UnknownsDecayServiceTests
|
||||
@@ -55,7 +57,8 @@ public class UnknownsDecayServiceTests
|
||||
|
||||
#region ApplyDecayAsync Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ApplyDecayAsync_EmptySubject_ReturnsZeroCounts()
|
||||
{
|
||||
var (decayService, _) = CreateServices();
|
||||
@@ -70,7 +73,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 +104,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 +141,8 @@ public class UnknownsDecayServiceTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ApplyDecayAsync_MultipleUnknowns_ProcessesAll()
|
||||
{
|
||||
var (decayService, _) = CreateServices();
|
||||
@@ -186,7 +192,8 @@ public class UnknownsDecayServiceTests
|
||||
|
||||
#region RunNightlyDecayBatchAsync Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task RunNightlyDecayBatchAsync_ProcessesAllSubjects()
|
||||
{
|
||||
var (decayService, _) = CreateServices();
|
||||
@@ -224,7 +231,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 +286,8 @@ public class UnknownsDecayServiceTests
|
||||
Assert.Equal(1, result.TotalUnknowns);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task RunNightlyDecayBatchAsync_CancellationRespected()
|
||||
{
|
||||
var (decayService, _) = CreateServices();
|
||||
@@ -311,7 +320,8 @@ public class UnknownsDecayServiceTests
|
||||
|
||||
#region ApplyDecayToUnknownAsync Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ApplyDecayToUnknownAsync_UpdatesScoringFields()
|
||||
{
|
||||
var (decayService, _) = CreateServices();
|
||||
@@ -342,7 +352,8 @@ public class UnknownsDecayServiceTests
|
||||
Assert.NotNull(result.NormalizationTrace);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ApplyDecayToUnknownAsync_SetsNextRescanBasedOnBand()
|
||||
{
|
||||
var (decayService, _) = CreateServices();
|
||||
@@ -368,7 +379,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