Refactor code structure and optimize performance across multiple modules
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using StellaOps.Router.Common.Enums;
|
||||
using StellaOps.Router.Integration.Tests.Fixtures;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Router.Integration.Tests;
|
||||
|
||||
/// <summary>
|
||||
@@ -18,7 +19,8 @@ public sealed class ConnectionManagerIntegrationTests
|
||||
|
||||
#region Initialization Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ConnectionManager_IsInitialized()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -28,7 +30,8 @@ public sealed class ConnectionManagerIntegrationTests
|
||||
connectionManager.Should().NotBeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ConnectionManager_HasConnections()
|
||||
{
|
||||
// Arrange
|
||||
@@ -41,7 +44,8 @@ public sealed class ConnectionManagerIntegrationTests
|
||||
connections.Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ConnectionManager_ConnectionHasCorrectServiceInfo()
|
||||
{
|
||||
// Arrange
|
||||
@@ -58,7 +62,8 @@ public sealed class ConnectionManagerIntegrationTests
|
||||
connection.Instance.InstanceId.Should().Be("test-instance-001");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ConnectionManager_ConnectionHasEndpoints()
|
||||
{
|
||||
// Arrange
|
||||
@@ -75,7 +80,8 @@ public sealed class ConnectionManagerIntegrationTests
|
||||
|
||||
#region Status Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ConnectionManager_DefaultStatus_IsHealthy()
|
||||
{
|
||||
// Arrange
|
||||
@@ -88,7 +94,8 @@ public sealed class ConnectionManagerIntegrationTests
|
||||
status.Should().Be(InstanceHealthStatus.Healthy);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ConnectionManager_CanChangeStatus()
|
||||
{
|
||||
// Arrange
|
||||
@@ -106,7 +113,8 @@ public sealed class ConnectionManagerIntegrationTests
|
||||
newStatus.Should().Be(InstanceHealthStatus.Degraded);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Theory]
|
||||
[InlineData(InstanceHealthStatus.Healthy)]
|
||||
[InlineData(InstanceHealthStatus.Degraded)]
|
||||
[InlineData(InstanceHealthStatus.Draining)]
|
||||
@@ -132,7 +140,8 @@ public sealed class ConnectionManagerIntegrationTests
|
||||
|
||||
#region Metrics Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ConnectionManager_InFlightRequestCount_InitiallyZero()
|
||||
{
|
||||
// Arrange
|
||||
@@ -145,7 +154,8 @@ public sealed class ConnectionManagerIntegrationTests
|
||||
count.Should().BeGreaterOrEqualTo(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ConnectionManager_ErrorRate_InitiallyZero()
|
||||
{
|
||||
// Arrange
|
||||
@@ -159,7 +169,8 @@ public sealed class ConnectionManagerIntegrationTests
|
||||
errorRate.Should().BeLessThanOrEqualTo(1.0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ConnectionManager_CanSetInFlightRequestCount()
|
||||
{
|
||||
// Arrange
|
||||
@@ -177,7 +188,8 @@ public sealed class ConnectionManagerIntegrationTests
|
||||
newCount.Should().Be(42);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ConnectionManager_CanSetErrorRate()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
@@ -6,6 +6,7 @@ using StellaOps.Router.Common.Frames;
|
||||
using StellaOps.Router.Common.Models;
|
||||
using StellaOps.Router.Integration.Tests.Fixtures;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Router.Integration.Tests;
|
||||
|
||||
/// <summary>
|
||||
@@ -24,7 +25,8 @@ public sealed class EndToEndRoutingTests
|
||||
|
||||
#region Basic Request/Response Flow
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Route_EchoEndpoint_IsRegistered()
|
||||
{
|
||||
// Arrange & Act - Verify endpoint is registered for routing
|
||||
@@ -35,7 +37,8 @@ public sealed class EndToEndRoutingTests
|
||||
endpoints.Should().Contain(e => e.Path == "/echo" && e.Method == "POST");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Route_GetUserEndpoint_MatchesPathPattern()
|
||||
{
|
||||
// Act
|
||||
@@ -50,7 +53,8 @@ public sealed class EndToEndRoutingTests
|
||||
getUserEndpoint!.Path.Should().Be("/users/{userId}");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Route_CreateUserEndpoint_PreservesCorrelationId()
|
||||
{
|
||||
// Arrange
|
||||
@@ -82,7 +86,8 @@ public sealed class EndToEndRoutingTests
|
||||
|
||||
#region Endpoint Registration Verification
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void EndpointRegistry_ContainsAllTestEndpoints()
|
||||
{
|
||||
// Arrange
|
||||
@@ -109,7 +114,8 @@ public sealed class EndToEndRoutingTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void EndpointRegistry_EachEndpointHasUniqueMethodPath()
|
||||
{
|
||||
// Act
|
||||
@@ -124,7 +130,8 @@ public sealed class EndToEndRoutingTests
|
||||
|
||||
#region Connection Manager State
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ConnectionManager_HasActiveConnections()
|
||||
{
|
||||
// Act
|
||||
@@ -134,7 +141,8 @@ public sealed class EndToEndRoutingTests
|
||||
connections.Should().NotBeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void ConnectionManager_ConnectionsHaveInstanceInfo()
|
||||
{
|
||||
// Act
|
||||
@@ -153,7 +161,8 @@ public sealed class EndToEndRoutingTests
|
||||
|
||||
#region Frame Protocol Integration
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Frame_RequestSerializationRoundTrip_PreservesAllFields()
|
||||
{
|
||||
// Arrange
|
||||
@@ -185,7 +194,8 @@ public sealed class EndToEndRoutingTests
|
||||
restored.Payload.ToArray().Should().BeEquivalentTo(original.Payload.ToArray());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Frame_ResponseSerializationRoundTrip_PreservesAllFields()
|
||||
{
|
||||
// Arrange
|
||||
@@ -217,7 +227,8 @@ public sealed class EndToEndRoutingTests
|
||||
|
||||
#region Path Matching Integration
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Theory]
|
||||
[InlineData("GET", "/users/123", true)]
|
||||
[InlineData("GET", "/users/abc-def", true)]
|
||||
[InlineData("GET", "/users/", false)]
|
||||
@@ -237,7 +248,8 @@ public sealed class EndToEndRoutingTests
|
||||
isMatch.Should().Be(shouldMatch);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Theory]
|
||||
[InlineData("/echo", "/echo", true)]
|
||||
[InlineData("/echo", "/Echo", true)] // PathMatcher is case-insensitive
|
||||
[InlineData("/users", "/users", true)]
|
||||
@@ -259,7 +271,8 @@ public sealed class EndToEndRoutingTests
|
||||
|
||||
#region Routing Determinism
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Routing_SameRequest_AlwaysSameEndpoint()
|
||||
{
|
||||
// Arrange
|
||||
@@ -283,7 +296,8 @@ public sealed class EndToEndRoutingTests
|
||||
results.Should().OnlyContain(r => r == "POST:/echo");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Routing_MultipleEndpoints_DeterministicOrdering()
|
||||
{
|
||||
// Act - Get endpoints multiple times
|
||||
@@ -300,7 +314,8 @@ public sealed class EndToEndRoutingTests
|
||||
|
||||
#region Error Routing
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void EndpointRegistry_ContainsFailEndpoint()
|
||||
{
|
||||
// Act
|
||||
@@ -310,7 +325,8 @@ public sealed class EndToEndRoutingTests
|
||||
endpoints.Should().Contain(e => e.Path == "/fail" && e.Method == "POST");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Routing_UnknownPath_NoMatchingEndpoint()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using StellaOps.Microservice;
|
||||
using StellaOps.Router.Integration.Tests.Fixtures;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Router.Integration.Tests;
|
||||
|
||||
/// <summary>
|
||||
@@ -18,7 +19,8 @@ public sealed class EndpointRegistryIntegrationTests
|
||||
|
||||
#region Endpoint Discovery Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Registry_ContainsAllTestEndpoints()
|
||||
{
|
||||
// Arrange
|
||||
@@ -31,7 +33,8 @@ public sealed class EndpointRegistryIntegrationTests
|
||||
endpoints.Should().HaveCount(17);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Theory]
|
||||
[InlineData("POST", "/echo")]
|
||||
[InlineData("GET", "/users/123")]
|
||||
[InlineData("POST", "/users")]
|
||||
@@ -54,7 +57,8 @@ public sealed class EndpointRegistryIntegrationTests
|
||||
match!.Endpoint.Method.Should().Be(method);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Registry_ReturnsNull_ForUnknownEndpoint()
|
||||
{
|
||||
// Arrange
|
||||
@@ -68,7 +72,8 @@ public sealed class EndpointRegistryIntegrationTests
|
||||
match.Should().BeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Registry_MatchesPathParameters()
|
||||
{
|
||||
// Arrange
|
||||
@@ -82,7 +87,8 @@ public sealed class EndpointRegistryIntegrationTests
|
||||
match!.Endpoint.Path.Should().Be("/users/{userId}");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Registry_ExtractsPathParameters()
|
||||
{
|
||||
// Arrange
|
||||
@@ -101,7 +107,8 @@ public sealed class EndpointRegistryIntegrationTests
|
||||
|
||||
#region Endpoint Metadata Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Endpoint_HasCorrectTimeout()
|
||||
{
|
||||
// Arrange
|
||||
@@ -116,7 +123,8 @@ public sealed class EndpointRegistryIntegrationTests
|
||||
slowMatch!.Endpoint.DefaultTimeout.Should().Be(TimeSpan.FromSeconds(60));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Endpoint_HasCorrectStreamingFlag()
|
||||
{
|
||||
// Arrange
|
||||
@@ -131,7 +139,8 @@ public sealed class EndpointRegistryIntegrationTests
|
||||
echoMatch!.Endpoint.SupportsStreaming.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Endpoint_HasCorrectClaims()
|
||||
{
|
||||
// Arrange
|
||||
@@ -148,7 +157,8 @@ public sealed class EndpointRegistryIntegrationTests
|
||||
echoMatch!.Endpoint.RequiringClaims.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Endpoint_HasCorrectHandlerType()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
@@ -36,7 +36,8 @@ public sealed class MessageOrderingTests : IAsyncLifetime, IDisposable
|
||||
|
||||
#region FIFO Ordering Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Ordering_SingleProducer_SingleConsumer_FIFO()
|
||||
{
|
||||
// Arrange
|
||||
@@ -63,7 +64,8 @@ public sealed class MessageOrderingTests : IAsyncLifetime, IDisposable
|
||||
receivedOrder.Should().BeEquivalentTo(sentOrder, options => options.WithStrictOrdering());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Ordering_SingleProducer_DelayedConsumer_FIFO()
|
||||
{
|
||||
// Arrange
|
||||
@@ -92,7 +94,8 @@ public sealed class MessageOrderingTests : IAsyncLifetime, IDisposable
|
||||
receivedOrder.Should().BeEquivalentTo(sentOrder, options => options.WithStrictOrdering());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Ordering_ConcurrentProducerConsumer_FIFO()
|
||||
{
|
||||
// Arrange
|
||||
@@ -131,7 +134,8 @@ public sealed class MessageOrderingTests : IAsyncLifetime, IDisposable
|
||||
|
||||
#region Bidirectional Ordering
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Ordering_BothDirections_IndependentFIFO()
|
||||
{
|
||||
// Arrange
|
||||
@@ -182,7 +186,8 @@ public sealed class MessageOrderingTests : IAsyncLifetime, IDisposable
|
||||
|
||||
#region Ordering Under Backpressure
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Ordering_WithBackpressure_FIFO()
|
||||
{
|
||||
// Arrange - Small buffer to force backpressure
|
||||
@@ -223,7 +228,8 @@ public sealed class MessageOrderingTests : IAsyncLifetime, IDisposable
|
||||
|
||||
#region Frame Type Ordering
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Ordering_MixedFrameTypes_FIFO()
|
||||
{
|
||||
// Arrange
|
||||
@@ -262,7 +268,8 @@ public sealed class MessageOrderingTests : IAsyncLifetime, IDisposable
|
||||
|
||||
#region Correlation ID Ordering
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Ordering_CorrelationIds_Preserved()
|
||||
{
|
||||
// Arrange
|
||||
@@ -297,7 +304,8 @@ public sealed class MessageOrderingTests : IAsyncLifetime, IDisposable
|
||||
|
||||
#region Large Message Ordering
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Ordering_VariablePayloadSizes_FIFO()
|
||||
{
|
||||
// Arrange
|
||||
@@ -334,7 +342,8 @@ public sealed class MessageOrderingTests : IAsyncLifetime, IDisposable
|
||||
|
||||
#region Ordering Determinism
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Ordering_MultipleRuns_Deterministic()
|
||||
{
|
||||
// Run the same sequence multiple times and verify deterministic ordering
|
||||
@@ -343,6 +352,7 @@ public sealed class MessageOrderingTests : IAsyncLifetime, IDisposable
|
||||
for (int run = 0; run < 3; run++)
|
||||
{
|
||||
using var channel = new InMemoryChannel($"determinism-{run}", bufferSize: 100);
|
||||
using StellaOps.TestKit;
|
||||
var received = new List<int>();
|
||||
|
||||
// Same sequence each run
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Text;
|
||||
using System.Text.Json;
|
||||
using StellaOps.Router.Integration.Tests.Fixtures;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Router.Integration.Tests;
|
||||
|
||||
/// <summary>
|
||||
@@ -26,7 +27,8 @@ public sealed class ParameterBindingTests
|
||||
|
||||
#region FromQuery - Query Parameter Binding
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromQuery_StringParameter_BindsCorrectly()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -41,7 +43,8 @@ public sealed class ParameterBindingTests
|
||||
result!.Query.Should().Be("test-search-term");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromQuery_IntParameter_BindsCorrectly()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -58,7 +61,8 @@ public sealed class ParameterBindingTests
|
||||
result.PageSize.Should().Be(25);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromQuery_BoolParameter_BindsCorrectly()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -73,7 +77,8 @@ public sealed class ParameterBindingTests
|
||||
result!.IncludeDeleted.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromQuery_MultipleParameters_BindCorrectly()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -94,7 +99,8 @@ public sealed class ParameterBindingTests
|
||||
result.IncludeDeleted.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromQuery_UrlEncodedValues_BindCorrectly()
|
||||
{
|
||||
// Arrange - Query with special characters
|
||||
@@ -112,7 +118,8 @@ public sealed class ParameterBindingTests
|
||||
result!.Query.Should().Be(query);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromQuery_OptionalParameters_UseDefaults()
|
||||
{
|
||||
// Arrange & Act - No query parameters provided
|
||||
@@ -129,7 +136,8 @@ public sealed class ParameterBindingTests
|
||||
result.SortOrder.Should().Be("asc"); // Default
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromQuery_OverrideDefaults_BindCorrectly()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -150,7 +158,8 @@ public sealed class ParameterBindingTests
|
||||
result.SortOrder.Should().Be("desc");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromQuery_WithAnonymousObject_BindsCorrectly()
|
||||
{
|
||||
// Arrange & Act - Using anonymous object for multiple query params
|
||||
@@ -171,7 +180,8 @@ public sealed class ParameterBindingTests
|
||||
|
||||
#region FromRoute - Path Parameter Binding
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromRoute_SinglePathParameter_BindsCorrectly()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -185,7 +195,8 @@ public sealed class ParameterBindingTests
|
||||
result!.UserId.Should().Be("user-123");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromRoute_MultiplePathParameters_BindCorrectly()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -201,7 +212,8 @@ public sealed class ParameterBindingTests
|
||||
result.Name.Should().Be("Item-widget-456-in-electronics");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromRoute_NumericPathParameter_BindsCorrectly()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -215,7 +227,8 @@ public sealed class ParameterBindingTests
|
||||
result!.UserId.Should().Be("12345");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromRoute_GuidPathParameter_BindsCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
@@ -232,7 +245,8 @@ public sealed class ParameterBindingTests
|
||||
result!.UserId.Should().Be(guid);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromRoute_SpecialCharactersInPath_BindsCorrectly()
|
||||
{
|
||||
// Arrange - URL-encoded special characters
|
||||
@@ -255,7 +269,8 @@ public sealed class ParameterBindingTests
|
||||
|
||||
#region FromHeader - Header Binding
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromHeader_AuthorizationHeader_BindsCorrectly()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -270,7 +285,8 @@ public sealed class ParameterBindingTests
|
||||
result!.Authorization.Should().Be("Bearer test-token-12345");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromHeader_CustomHeaders_BindCorrectly()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -289,7 +305,8 @@ public sealed class ParameterBindingTests
|
||||
result!.AcceptLanguage.Should().Be("en-US");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromHeader_MultipleHeaders_AllAccessible()
|
||||
{
|
||||
// Arrange
|
||||
@@ -319,7 +336,8 @@ public sealed class ParameterBindingTests
|
||||
result.AllHeaders.Should().ContainKey("Accept-Language");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromHeader_BearerToken_ParsesCorrectly()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -338,7 +356,8 @@ public sealed class ParameterBindingTests
|
||||
|
||||
#region FromBody - JSON Body Binding
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromBody_SimpleJson_BindsCorrectly()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -353,7 +372,8 @@ public sealed class ParameterBindingTests
|
||||
result!.Echo.Should().Contain("Hello, World!");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromBody_ComplexObject_BindsCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
@@ -372,7 +392,8 @@ public sealed class ParameterBindingTests
|
||||
result.UserId.Should().NotBeNullOrEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromBody_AnonymousObject_BindsCorrectly()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -387,7 +408,8 @@ public sealed class ParameterBindingTests
|
||||
result!.Echo.Should().Contain("Anonymous type test");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromBody_NestedObject_BindsCorrectly()
|
||||
{
|
||||
// Arrange - For raw echo we can test nested JSON structure
|
||||
@@ -414,7 +436,8 @@ public sealed class ParameterBindingTests
|
||||
body.Should().Contain("deeply nested");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromBody_CamelCaseNaming_BindsCorrectly()
|
||||
{
|
||||
// Arrange - Ensure camelCase property naming works
|
||||
@@ -435,7 +458,8 @@ public sealed class ParameterBindingTests
|
||||
|
||||
#region FromForm - Form Data Binding
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromForm_SimpleFormData_BindsCorrectly()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -452,7 +476,8 @@ public sealed class ParameterBindingTests
|
||||
result!.Password.Should().Be("secret123");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromForm_BooleanField_BindsCorrectly()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -469,7 +494,8 @@ public sealed class ParameterBindingTests
|
||||
result!.RememberMe.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromForm_WithAnonymousObject_BindsCorrectly()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -486,7 +512,8 @@ public sealed class ParameterBindingTests
|
||||
result!.RememberMe.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromForm_UrlEncodedSpecialChars_BindsCorrectly()
|
||||
{
|
||||
// Arrange - Special characters that need URL encoding
|
||||
@@ -505,7 +532,8 @@ public sealed class ParameterBindingTests
|
||||
result!.Password.Should().Be(password);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task FromForm_ContentType_IsCorrect()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -525,7 +553,8 @@ public sealed class ParameterBindingTests
|
||||
|
||||
#region Combined Binding - Multiple Sources
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task CombinedBinding_PathAndBody_BindCorrectly()
|
||||
{
|
||||
// Arrange - PUT /resources/{resourceId} with JSON body
|
||||
@@ -545,7 +574,8 @@ public sealed class ParameterBindingTests
|
||||
result!.Description.Should().Be("New description");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task CombinedBinding_PathQueryAndBody_BindCorrectly()
|
||||
{
|
||||
// Arrange - PUT /resources/{resourceId}?format=json&verbose=true with body
|
||||
@@ -568,7 +598,8 @@ public sealed class ParameterBindingTests
|
||||
result!.Name.Should().Be("Full Update");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task CombinedBinding_HeadersAndBody_BindCorrectly()
|
||||
{
|
||||
// Arrange - POST with headers and JSON body
|
||||
@@ -589,7 +620,8 @@ public sealed class ParameterBindingTests
|
||||
|
||||
#region HTTP Methods
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task HttpGet_ReturnsData()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -603,7 +635,8 @@ public sealed class ParameterBindingTests
|
||||
result!.UserId.Should().Be("get-test-user");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task HttpPost_CreatesResource()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -618,7 +651,8 @@ public sealed class ParameterBindingTests
|
||||
result!.Success.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task HttpPut_UpdatesResource()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -634,7 +668,8 @@ public sealed class ParameterBindingTests
|
||||
result!.Name.Should().Be("Updated Name");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task HttpPatch_PartialUpdate()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -653,7 +688,8 @@ public sealed class ParameterBindingTests
|
||||
result!.UpdatedFields.Should().Contain("price");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task HttpPatch_PartialUpdate_OnlySpecifiedFields()
|
||||
{
|
||||
// Arrange & Act - Only update name, not price
|
||||
@@ -669,7 +705,8 @@ public sealed class ParameterBindingTests
|
||||
result!.UpdatedFields.Should().NotContain("price");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task HttpDelete_RemovesResource()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -688,7 +725,8 @@ public sealed class ParameterBindingTests
|
||||
|
||||
#region Raw Body Handling
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task RawBody_PlainText_HandledCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
@@ -705,7 +743,8 @@ public sealed class ParameterBindingTests
|
||||
body.Should().Be(text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task RawBody_Xml_HandledCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
@@ -722,7 +761,8 @@ public sealed class ParameterBindingTests
|
||||
body.Should().Be(xml);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task RawBody_Binary_HandledCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
@@ -740,7 +780,8 @@ public sealed class ParameterBindingTests
|
||||
response.Payload.Length.Should().BeGreaterThan(0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task RawBody_ResponseHeaders_IncludeContentLength()
|
||||
{
|
||||
// Arrange
|
||||
@@ -761,7 +802,8 @@ public sealed class ParameterBindingTests
|
||||
|
||||
#region Edge Cases
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task EmptyBody_HandledCorrectly()
|
||||
{
|
||||
// Arrange & Act - GET with no body should work for endpoints with optional params
|
||||
@@ -777,7 +819,8 @@ public sealed class ParameterBindingTests
|
||||
result.Limit.Should().Be(20);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task EmptyQueryString_UsesDefaults()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -793,7 +836,8 @@ public sealed class ParameterBindingTests
|
||||
result.PageSize.Should().Be(10);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task ConcurrentRequests_HandleCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
@@ -816,7 +860,8 @@ public sealed class ParameterBindingTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task LargePayload_HandledCorrectly()
|
||||
{
|
||||
// Arrange - Create a moderately large message
|
||||
@@ -834,7 +879,8 @@ public sealed class ParameterBindingTests
|
||||
result!.Echo.Should().Contain(largeMessage);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task UnicodeContent_HandledCorrectly()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using StellaOps.Microservice;
|
||||
using StellaOps.Router.Integration.Tests.Fixtures;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Router.Integration.Tests;
|
||||
|
||||
/// <summary>
|
||||
@@ -18,7 +19,8 @@ public sealed class PathMatchingIntegrationTests
|
||||
|
||||
#region Exact Path Matching Tests
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Theory]
|
||||
[InlineData("POST", "/echo")]
|
||||
[InlineData("POST", "/users")]
|
||||
[InlineData("POST", "/slow")]
|
||||
@@ -43,7 +45,8 @@ public sealed class PathMatchingIntegrationTests
|
||||
|
||||
#region Parameterized Path Tests
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Theory]
|
||||
[InlineData("/users/123", "/users/{userId}")]
|
||||
[InlineData("/users/abc-def", "/users/{userId}")]
|
||||
[InlineData("/users/user_001", "/users/{userId}")]
|
||||
@@ -60,7 +63,8 @@ public sealed class PathMatchingIntegrationTests
|
||||
match!.Endpoint.Path.Should().Be(expectedPattern);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void PathMatching_PostUsersPath_MatchesCreateEndpoint()
|
||||
{
|
||||
// Arrange
|
||||
@@ -78,7 +82,8 @@ public sealed class PathMatchingIntegrationTests
|
||||
|
||||
#region Non-Matching Path Tests
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Theory]
|
||||
[InlineData("GET", "/nonexistent")]
|
||||
[InlineData("POST", "/unknown/path")]
|
||||
[InlineData("PUT", "/echo")] // Wrong method
|
||||
@@ -100,7 +105,8 @@ public sealed class PathMatchingIntegrationTests
|
||||
|
||||
#region Method Matching Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void PathMatching_SamePathDifferentMethods_MatchCorrectEndpoint()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
@@ -4,6 +4,7 @@ using StellaOps.Router.Common.Frames;
|
||||
using StellaOps.Router.Common.Models;
|
||||
using StellaOps.Router.Integration.Tests.Fixtures;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Router.Integration.Tests;
|
||||
|
||||
/// <summary>
|
||||
@@ -23,7 +24,8 @@ public sealed class RequestDispatchIntegrationTests
|
||||
|
||||
#region Echo Endpoint Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Dispatch_EchoEndpoint_ReturnsExpectedResponse()
|
||||
{
|
||||
// Arrange
|
||||
@@ -43,7 +45,8 @@ public sealed class RequestDispatchIntegrationTests
|
||||
echoResponse.Timestamp.Should().BeCloseTo(DateTime.UtcNow, TimeSpan.FromSeconds(5));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Dispatch_EchoEndpoint_ReturnsValidRequestId()
|
||||
{
|
||||
// Arrange
|
||||
@@ -56,7 +59,8 @@ public sealed class RequestDispatchIntegrationTests
|
||||
response.RequestId.Should().NotBeNullOrEmpty();
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Theory]
|
||||
[InlineData("Simple message")]
|
||||
[InlineData("Numbers and underscores 123_456_789")]
|
||||
[InlineData("Long message with multiple words and spaces")]
|
||||
@@ -78,7 +82,8 @@ public sealed class RequestDispatchIntegrationTests
|
||||
|
||||
#region User Endpoints Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Dispatch_GetUser_EndpointResponds()
|
||||
{
|
||||
// Arrange - Path parameters are extracted by the microservice
|
||||
@@ -93,7 +98,8 @@ public sealed class RequestDispatchIntegrationTests
|
||||
response.StatusCode.Should().BeOneOf(200, 400); // 400 if path param binding issue, 200 if working
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Dispatch_CreateUser_ReturnsNewUserId()
|
||||
{
|
||||
// Arrange
|
||||
@@ -115,7 +121,8 @@ public sealed class RequestDispatchIntegrationTests
|
||||
|
||||
#region Error Handling Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Dispatch_FailEndpoint_ReturnsInternalError()
|
||||
{
|
||||
// Arrange
|
||||
@@ -128,7 +135,8 @@ public sealed class RequestDispatchIntegrationTests
|
||||
response.StatusCode.Should().Be(500);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Dispatch_NonexistentEndpoint_Returns404()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -138,7 +146,8 @@ public sealed class RequestDispatchIntegrationTests
|
||||
response.StatusCode.Should().Be(404);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Dispatch_WrongHttpMethod_Returns404()
|
||||
{
|
||||
// Arrange - /echo is POST only
|
||||
@@ -155,7 +164,8 @@ public sealed class RequestDispatchIntegrationTests
|
||||
|
||||
#region Slow/Timeout Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Dispatch_SlowEndpoint_CompletesWithinTimeout()
|
||||
{
|
||||
// Arrange - 100ms delay should complete within 30s timeout
|
||||
@@ -175,7 +185,8 @@ public sealed class RequestDispatchIntegrationTests
|
||||
|
||||
#region Concurrent Requests Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Dispatch_MultipleRequests_AllSucceed()
|
||||
{
|
||||
// Arrange
|
||||
@@ -192,7 +203,8 @@ public sealed class RequestDispatchIntegrationTests
|
||||
responses.Should().OnlyContain(r => r.StatusCode == 200);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Dispatch_ConcurrentDifferentEndpoints_AllSucceed()
|
||||
{
|
||||
// Arrange & Act - only use endpoints that work with request body binding
|
||||
@@ -216,7 +228,8 @@ public sealed class RequestDispatchIntegrationTests
|
||||
|
||||
#region Connection State Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Connection_HasRegisteredEndpoints()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -231,7 +244,8 @@ public sealed class RequestDispatchIntegrationTests
|
||||
connection.Endpoints.Should().ContainKey(("POST", "/users"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Connection_HasCorrectInstanceInfo()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -249,7 +263,8 @@ public sealed class RequestDispatchIntegrationTests
|
||||
|
||||
#region Frame Protocol Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Dispatch_RequestFrameConversion_PreservesData()
|
||||
{
|
||||
// Arrange
|
||||
@@ -284,7 +299,8 @@ public sealed class RequestDispatchIntegrationTests
|
||||
|
||||
#region Determinism Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public async Task Dispatch_SameRequest_ProducesDeterministicResponse()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
@@ -21,7 +21,8 @@ public sealed class ServiceRegistrationIntegrationTests
|
||||
|
||||
#region Core Services Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Services_MicroserviceOptionsAreRegistered()
|
||||
{
|
||||
// Act
|
||||
@@ -33,7 +34,8 @@ public sealed class ServiceRegistrationIntegrationTests
|
||||
options.Version.Should().Be("1.0.0");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Services_EndpointRegistryIsRegistered()
|
||||
{
|
||||
// Act
|
||||
@@ -43,7 +45,8 @@ public sealed class ServiceRegistrationIntegrationTests
|
||||
registry.Should().NotBeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Services_ConnectionManagerIsRegistered()
|
||||
{
|
||||
// Act
|
||||
@@ -53,7 +56,8 @@ public sealed class ServiceRegistrationIntegrationTests
|
||||
connectionManager.Should().NotBeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Services_RequestDispatcherIsRegistered()
|
||||
{
|
||||
// Act
|
||||
@@ -63,7 +67,8 @@ public sealed class ServiceRegistrationIntegrationTests
|
||||
dispatcher.Should().NotBeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Services_EndpointDiscoveryServiceIsRegistered()
|
||||
{
|
||||
// Act
|
||||
@@ -77,7 +82,8 @@ public sealed class ServiceRegistrationIntegrationTests
|
||||
|
||||
#region Transport Services Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Services_TransportClientIsRegistered()
|
||||
{
|
||||
// Act
|
||||
@@ -88,7 +94,8 @@ public sealed class ServiceRegistrationIntegrationTests
|
||||
client.Should().BeOfType<InMemoryTransportClient>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Services_TransportServerIsRegistered()
|
||||
{
|
||||
// Act
|
||||
@@ -99,7 +106,8 @@ public sealed class ServiceRegistrationIntegrationTests
|
||||
server.Should().BeOfType<InMemoryTransportServer>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Services_InMemoryConnectionRegistryIsRegistered()
|
||||
{
|
||||
// Act
|
||||
@@ -113,7 +121,8 @@ public sealed class ServiceRegistrationIntegrationTests
|
||||
|
||||
#region Endpoint Handler Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Services_EndpointHandlersAreRegistered()
|
||||
{
|
||||
// Act
|
||||
@@ -128,13 +137,15 @@ public sealed class ServiceRegistrationIntegrationTests
|
||||
createUserEndpoint.Should().NotBeNull();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Services_EndpointHandlersAreScopedInstances()
|
||||
{
|
||||
// Act
|
||||
using var scope1 = _fixture.Services.CreateScope();
|
||||
using var scope2 = _fixture.Services.CreateScope();
|
||||
|
||||
using StellaOps.TestKit;
|
||||
var echo1 = scope1.ServiceProvider.GetService<EchoEndpoint>();
|
||||
var echo2 = scope2.ServiceProvider.GetService<EchoEndpoint>();
|
||||
|
||||
@@ -146,7 +157,8 @@ public sealed class ServiceRegistrationIntegrationTests
|
||||
|
||||
#region Singleton Services Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Services_SingletonServicesAreSameInstance()
|
||||
{
|
||||
// Act
|
||||
|
||||
@@ -3,6 +3,7 @@ using StellaOps.Router.Common.Abstractions;
|
||||
using StellaOps.Router.Integration.Tests.Fixtures;
|
||||
using StellaOps.Router.Transport.InMemory;
|
||||
|
||||
using StellaOps.TestKit;
|
||||
namespace StellaOps.Router.Integration.Tests;
|
||||
|
||||
/// <summary>
|
||||
@@ -20,7 +21,8 @@ public sealed class TransportIntegrationTests
|
||||
|
||||
#region InMemory Transport Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Transport_ClientIsRegistered()
|
||||
{
|
||||
// Arrange & Act
|
||||
@@ -31,7 +33,8 @@ public sealed class TransportIntegrationTests
|
||||
client.Should().BeOfType<InMemoryTransportClient>();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Transport_ConnectionRegistryIsShared()
|
||||
{
|
||||
// Arrange
|
||||
@@ -45,7 +48,8 @@ public sealed class TransportIntegrationTests
|
||||
|
||||
#region Connection Lifecycle Tests
|
||||
|
||||
[Fact]
|
||||
[Trait("Category", TestCategories.Unit)]
|
||||
[Fact]
|
||||
public void Transport_ConnectionIsEstablished()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
Reference in New Issue
Block a user