Refactor code structure and optimize performance across multiple modules
This commit is contained in:
@@ -8,6 +8,8 @@ using StellaOps.Scheduler.WebService.PolicySimulations;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Scheduler.WebService.Tests;
|
||||
|
||||
public sealed class PolicySimulationEndpointTests : IClassFixture<WebApplicationFactory<Program>>
|
||||
@@ -19,7 +21,8 @@ public sealed class PolicySimulationEndpointTests : IClassFixture<WebApplication
|
||||
_factory = factory;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task CreateListGetSimulation()
|
||||
{
|
||||
using var client = _factory.CreateClient();
|
||||
@@ -56,7 +59,8 @@ public sealed class PolicySimulationEndpointTests : IClassFixture<WebApplication
|
||||
Assert.Equal(runId, simulation.GetProperty("simulation").GetProperty("runId").GetString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task MetricsEndpointWithoutProviderReturns501()
|
||||
{
|
||||
using var client = _factory.CreateClient();
|
||||
@@ -67,7 +71,8 @@ public sealed class PolicySimulationEndpointTests : IClassFixture<WebApplication
|
||||
Assert.Equal(HttpStatusCode.NotImplemented, response.StatusCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task MetricsEndpointReturnsSummary()
|
||||
{
|
||||
var stub = new StubPolicySimulationMetricsProvider
|
||||
@@ -111,7 +116,8 @@ public sealed class PolicySimulationEndpointTests : IClassFixture<WebApplication
|
||||
Assert.Equal(2.0, payload.GetProperty("policy_simulation_latency").GetProperty("mean_seconds").GetDouble());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task CreateSimulationRequiresScopeHeader()
|
||||
{
|
||||
using var client = _factory.CreateClient();
|
||||
@@ -126,7 +132,8 @@ public sealed class PolicySimulationEndpointTests : IClassFixture<WebApplication
|
||||
Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task CreateSimulationRequiresPolicySimulateScope()
|
||||
{
|
||||
using var client = _factory.CreateClient();
|
||||
@@ -142,7 +149,8 @@ public sealed class PolicySimulationEndpointTests : IClassFixture<WebApplication
|
||||
Assert.Equal(HttpStatusCode.Forbidden, response.StatusCode);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task CancelSimulationMarksStatus()
|
||||
{
|
||||
using var client = _factory.CreateClient();
|
||||
@@ -167,7 +175,8 @@ public sealed class PolicySimulationEndpointTests : IClassFixture<WebApplication
|
||||
Assert.True(cancelled.GetProperty("simulation").GetProperty("cancellationRequested").GetBoolean());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task RetrySimulationCreatesNewRun()
|
||||
{
|
||||
using var client = _factory.CreateClient();
|
||||
@@ -197,7 +206,8 @@ public sealed class PolicySimulationEndpointTests : IClassFixture<WebApplication
|
||||
Assert.Equal(runId, retryOf.GetString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task StreamSimulationEmitsCoreEvents()
|
||||
{
|
||||
using var client = _factory.CreateClient();
|
||||
|
||||
Reference in New Issue
Block a user