save development progress

This commit is contained in:
StellaOps Bot
2025-12-25 23:09:58 +02:00
parent d71853ad7e
commit aa70af062e
351 changed files with 37683 additions and 150156 deletions

View File

@@ -0,0 +1,79 @@
using System.Net;
using FluentAssertions;
using Xunit;
namespace Examples.Integration.Tests;
/// <summary>
/// Tests that verify multiple microservices can register and receive
/// correctly routed requests through the gateway.
/// </summary>
public sealed class MultiServiceRoutingTests : IClassFixture<GatewayFixture>
{
private readonly GatewayFixture _fixture;
public MultiServiceRoutingTests(GatewayFixture fixture)
{
_fixture = fixture;
}
[Fact]
public async Task Gateway_RoutesBillingRequests_ToBillingService()
{
// Act
var response = await _fixture.GatewayClient.GetAsync("/invoices/INV-001");
// Assert
response.StatusCode.Should().Be(HttpStatusCode.OK);
var content = await response.Content.ReadAsStringAsync();
content.Should().Contain("INV-001");
}
[Fact]
public async Task Gateway_RoutesInventoryRequests_ToInventoryService()
{
// Act
var response = await _fixture.GatewayClient.GetAsync("/items/SKU-001");
// Assert
response.StatusCode.Should().Be(HttpStatusCode.OK);
var content = await response.Content.ReadAsStringAsync();
content.Should().Contain("SKU-001");
}
[Fact]
public async Task Gateway_HandlesSequentialRequestsToDifferentServices()
{
// Act - Send requests to both services
var billingResponse = await _fixture.GatewayClient.GetAsync("/invoices/INV-001");
var inventoryResponse = await _fixture.GatewayClient.GetAsync("/items/SKU-001");
// Assert - Both should succeed
billingResponse.StatusCode.Should().Be(HttpStatusCode.OK);
inventoryResponse.StatusCode.Should().Be(HttpStatusCode.OK);
}
[Fact]
public async Task Gateway_HandlesConcurrentRequestsToDifferentServices()
{
// Act - Send requests to both services concurrently
var billingTask = _fixture.GatewayClient.GetAsync("/invoices/INV-001");
var inventoryTask = _fixture.GatewayClient.GetAsync("/items/SKU-001");
await Task.WhenAll(billingTask, inventoryTask);
// Assert - Both should succeed
billingTask.Result.StatusCode.Should().Be(HttpStatusCode.OK);
inventoryTask.Result.StatusCode.Should().Be(HttpStatusCode.OK);
}
[Fact]
public async Task Gateway_ReturnsNotFound_ForUnknownRoute()
{
// Act
var response = await _fixture.GatewayClient.GetAsync("/unknown/route");
// Assert
response.StatusCode.Should().Be(HttpStatusCode.NotFound);
}
}